def test_rotate(): p = [(1, 0, 3), (0, 1, 6)] r = list(rotate(p, 90, deg=True)) assert is_close_points(r[0], (0, 1, 3)) assert is_close_points(r[1], (-1, 0, 6))
def test_rotate(): p = [(1, 0, 3), (0, 1, 6)] r = list(rotate(p, 90, deg=True)) assert r[0].isclose((0, 1, 3)) assert r[1].isclose((-1, 0, 6))
import ezdxf from ezdxf.render import forms DIR = Path("~/Desktop/Outbox").expanduser() doc = ezdxf.new(setup=True) msp = doc.modelspace() # Create a special DIMSTYLE for "vertical" centered measurement text: dimstyle = doc.dimstyles.duplicate_entry("EZDXF", "ORD_CENTER") dimstyle.dxf.dimtad = 0 # "vertical" centered measurement text # Add a rectangle: width=4, height = 2.5, lower left corner is WCS(x=2, y=3), # rotated about 30 degrees: origin = Vec3(2, 3) msp.add_lwpolyline(forms.translate(forms.rotate(forms.box(4, 2.5), 30), origin), close=True) # Define the rotated local render UCS. # The origin is the lower-left corner of the rectangle and the axis are # aligned to the rectangle edges: # The y-axis "uy" is calculated automatically by the right-hand rule. ucs = UCS(origin, ux=Vec3.from_deg_angle(30), uz=(0, 0, 1)) # Add a x-type ordinate DIMENSION with local feature locations: # the origin is now the origin of the UCS, which is (0, 0) the default value of # "origin" and the feature coordinates are located in the UCS: msp.add_ordinate_x_dim( # lower left corner feature_location=(0, 0), # feature location in the UCS