How does Text2Path set the coordinates #703
Answered
by
mozman
shine-flower
asked this question in
Q&A
-
How to change the coordinates of path, currently the default is (0,0). |
Beta Was this translation helpful? Give feedback.
Answered by
mozman
Jul 7, 2022
Replies: 1 comment
-
The render base point is always (0, 0) but the functions of the The transformation matrix can be composed from multiple from ezdxf.math import Matrix44, basic_transformation
from ezdxf.addons import text2path
from ezdxf import path
# create transformation matrix m
m = Matrix44.chain(Matrix44.scale(...), Matrix44.z_rotate(...), Matrix44.translate(...))
# helper function to create a transformation matrix:
m = basic_transformation(move=..., scale=..., z-rotate=...)
# transform a single-path object
p1 = text2path.make_path_from_string(...) # returns a multi-path object
p1 = p1.transform(m) # creates a new Path object!
# transform multiple single-path objects
paths = text2path.make_paths_from_string(...) # returns a list of single-path objects
paths = path.transform_paths(paths, m) Documentation: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
shine-flower
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The render base point is always (0, 0) but the functions of the
text2path
add-on returnPath
objects, which have atransform()
method.The transformation matrix can be composed from multiple
Matrix44
instances by multiplying them or use theMatrix.chain()
class-method or the helper functionezdxf.math.basic_transformation()
. Always follow the order: scale, rotate, move.