def create_by_diagonal(top_left: tuple, bottom_right: tuple): """ :type top_left: (float | str, float | str) :type bottom_right: (float | str, float | str) :rtype: Rectangle """ vs.Rect(Units.resolve_length_units(top_left), Units.resolve_length_units(bottom_right)) return Rectangle(vs.LNewObj())
def create(point1: tuple, point2: tuple): """ :type point1: (float | str, float | str) :type point2: (float | str, float | str) :rtype: Line """ vs.MoveTo(Units.resolve_length_units(point1)) vs.LineTo(Units.resolve_length_units(point2)) return Line(vs.LNewObj())
def create(origin: tuple, direction: tuple, width, height): """ :type origin: (float | str, float | str) :type direction: (float | str, float | str) :type width: float | str :type height: float | str :rtype: Rectangle """ vs.RectangleN(Units.resolve_length_units(origin), Units.resolve_length_units(direction), Units.resolve_length_units(width), Units.resolve_length_units(height)) return Rectangle(vs.LNewObj())
def create(origin: tuple): """ :type origin: (float | str, float | str) :rtype: Locus """ vs.Locus(Units.resolve_length_units(origin)) return Locus(vs.LNewObj())
def create(definition: SymbolDefinition, insertion_point: tuple, rotation: float): """ :type insertion_point: (float | str, float | str) :rtype: Symbol """ vs.Symbol(definition.name, Units.resolve_length_units(insertion_point), rotation) return Symbol(vs.LNewObj())
def create(vertices: tuple, closed: bool = True): """ :type vertices: tuple[tuple[x: float|str, y: float|str]] """ vs.ClosePoly() if closed else vs.OpenPoly() vs.Poly(*[ Units.to_length_units(c) if isinstance(c, str) else c for vertex in vertices for c in vertex ]) return Polygon(vs.LNewObj())
def create(text: str, origin: tuple, horizontal_alignment: int = None, vertical_alignment: int = None): """ :type origin: (float | str, float | str) :type horizontal_alignment: TextHorizontalAlignmentEnum :type vertical_alignment: TextVerticalAlignmentEnum :rtype: Text """ vs.TextOrigin(Units.resolve_length_units(origin)) vs.TextJust(horizontal_alignment) if horizontal_alignment else None vs.TextVerticalAlign( vertical_alignment) if vertical_alignment else None vs.CreateText(text) return Text(vs.LNewObj())
def height(self, value): """:type value: float | str""" vs.SetHeight(self.handle, Units.resolve_length_units(value)) vs.ResetBBox( self.handle) # Needed, or the object doesn't reflect the change!