Closed Cartman0 closed 1 year ago
The coordinates stored in the Element.anchors
dictionary are relative to the element, not to the drawing. You can use Element.absanchors
to get the absolute position of the anchor relative to the drawing:
d += elm.Line().left().at(_Dl2.absanchors[f's{i+1}']).tox(0).dot()
Alternatively, use the attribute that is created when the element is added to the drawing:
d += elm.Line().left().at(_Dl2.s2).tox(0).dot()
@cdelker thx for rep!
what are the differences between .s2
, .anchors['s2']
and .absanchors['s2']
?
.anchors
are set in the element definition, and are relative to the element's local origin. absanchors
are the anchor points translated to global coordinates once an element is placed in a drawing, and are relative to the drawing origin. Attributes like s2
attribute store the same value as the absanchors['s2']
but is set as an attribute for convenience.
(I want to align Ic chips to row(vertical) direction. (to express 8-bit memory))
The following code has drawn the following diagram.
In the code, it will draw line to the left from 2nd Ic.s, but has drawn line to the left from 1st Ic.s in the result diagram.
my usage is wrong?
my env: