TXLWizard.Patterns.Structure

Implements a class for Structure objects (STRUCT).

A Structure is a container for Pattern objects.

Classes

Structure(ID, **kwargs) Implements a class for Structure objects.
class TXLWizard.Patterns.Structure.Structure(ID, **kwargs)[source]

Bases: TXLWizard.Patterns.AbstractPattern.AbstractPattern

Implements a class for Structure objects.

Corresponds to the TXL command STRUCT.

A Structure is a container for Pattern objects.

Parameters:
  • ID (str) – Unique identification of the structure. Also used when referencing to this structure.
  • TXLOutput (bool, optional) –

    If set to False, the TXL Output is suppressed.

    Defaults to True

  • **kwargs – keyword arguments passed to the TXLWizard.Patterns.AbstractPattern.AbstractPattern constructor. Can specify attributes of the current pattern.

Examples

Import required modules

>>> import TXLWizard.TXLWriter

Initialize TXLWriter

>>> TXLWriter = TXLWizard.TXLWriter.TXLWriter()

Create Content Structure

>>> CircleStructure = TXLWriter.AddContentStructure('MyCircleID',
...     TXLOutput = True
... )
>>> CircleStructure.AddPattern(
...     'Circle',
...     Center=[0, 0],
...     Radius=50,
...     Layer=1
... ) 
<TXLWizard.Patterns.Circle.Circle object at 0x...>

Generate Files

>>> TXLWriter.GenerateFiles('Tests/Results/Patterns/Structure')
AddPattern(PatternType, **kwargs)[source]

Adds a Pattern of type PatternType to the structure. Creates an instance of TXLWizard.Patterns.{PatternType}.{PatternType}. The kwargs are passed to the corresponding constructor and allow specifying pattern parameters as defined in the constructor of the corresponding pattern class and attributes as defined in TXLWizard.Patterns.AbstractPattern.AbstractPattern.

Parameters:
  • PatternType ({'Array', 'Circle', 'Ellipse', 'Polygon', 'Polyline', 'Reference'}) – Type of the pattern to be added.
  • **kwargs – keyword arguments are passed to the corresponding constructor and allow specifying pattern parameters as defined in the constructor of the corresponding pattern class and attributes as defined in TXLWizard.Patterns.AbstractPattern.AbstractPattern.
Returns:

returns the created pattern object

Return type:

TXLWizard.Patterns.{PatternType}.{PatternType}

CurrentAttributes = None

dict – attribute values of the next pattern to be added. Default values are copied from self.DefaultAttributes

ID = None

str – Unique identification of the structure. Also used when referencing to this structure.

Patterns = None

list of TXLWizard.Patterns.AbstractPattern.AbstractPattern – Patterns that are contained in this structure

TXLOutput = None

bool – If set to False, the TXL Output is suppressed.

Type = None

str – specifies the type of the pattern. Set to ‘Structure’