TXLWizard.Patterns.Array¶
Implements a class for Pattern objects of type Array (AREF).
Replicates the referenced structure in two directions.
Classes¶
Array (ReferencedStructureID, OriginPoint, ...) |
Implements a class for Pattern objects of type Array. |
-
class
TXLWizard.Patterns.Array.
Array
(ReferencedStructureID, OriginPoint, PositionDelta1, PositionDelta2, Repetitions1, Repetitions2, **kwargs)[source]¶ Bases:
TXLWizard.Patterns.AbstractPattern.AbstractPattern
Implements a class for Pattern objects of type Array.
Corresponds to the TXL command AREF.
Replicates the referenced structure ReferencedStructureID in two directions PositionDelta1 and PositionDelta2 for the number of times specified in Repetitions1 and Repetitions2, starting at OriginPoint.
The x- and y-coordinates of the replicated objects are calculated as follows: OriginPoint+i*PositionDelta1+j*PositionDelta2 where i is an integer that ranges from 0 to Repetitions1 - 1 and j is an integer that ranges from 0 to Repetitions2 - 1
Parameters: - ReferencedStructureID (str) – ID of the structure being referenced to
- OriginPoint (list of float) – x- and y- coordinates of the starting point
- PositionDelta1 (list of float) – x- and y- coordinates of the first replication direction.
- PositionDelta2 (list of float) – x- and y- coordinates of the second replication direction.
- Repetitions1 (int) – Number of replications in the first replication direction
- Repetitions2 (int) – Number of replications in the second replication direction
- **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 Definition Structure for Circle that will be reused. Could also be a content structure.
>>> CircleStructure = TXLWriter.AddDefinitionStructure('MyCircleID') >>> CircleStructure.AddPattern( ... 'Circle', ... Center=[0, 0], ... Radius=50, ... Layer=1 ... ) <TXLWizard.Patterns.Circle.Circle object at 0x...>
Create array of the definition structure above with 10 repetitions at distance 100 in x-direction 20 repetitions at distance 200 in y-direction
>>> CircleArray = TXLWriter.AddContentStructure('MyCircleArray') >>> CircleArray.AddPattern( ... 'Array', ... ReferencedStructureID=CircleStructure.ID, ... OriginPoint=[40,60], ... PositionDelta1=[ ... 100, 0 ... ], ... PositionDelta2=[ ... 0, 200 ... ], ... Repetitions1=10, ... Repetitions2=20 ... ) <TXLWizard.Patterns.Array.Array object at 0x...>
Generate Files
>>> TXLWriter.GenerateFiles('Tests/Results/Patterns/Array')
-
PositionDelta1
= None¶ list of float – x- and y- coordinates of the first replication direction.
-
PositionDelta2
= None¶ list of float – x- and y- coordinates of the second replication direction.
-
ReferencedStructureID
= None¶ str – ID of the structure being referenced to
-
Repetitions1
= None¶ int – Number of replications in the first replication direction
-
Repetitions2
= None¶ int – Number of replications in the second replication direction
-
Type
= None¶ str – specifies the type of the pattern. Set to ‘Array’