-
Thank you for your work. I've recently started exploring ezdxf, and it's really amazing. My question is: Is there any method to divide an Entity (LINE, POLYLINE, LWPOLYLINE etc.) similarly like in AutoCad's DIVIDE command? I mean, putting N (~200) points along the curve at equal distances. I'm sorry if I'm repeating someone's question, but I really looked through the forum and couldn't find anything similar. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I think this question is what you are looking for: #527 |
Beta Was this translation helpful? Give feedback.
-
Added a new tool ezdxf.math.ConstructionPolyline for such tasks. It can be tested in v0.17.1b3 and later but the API may change until the official release in v0.18. import ezdxf
from ezdxf import path
from ezdxf.math import ConstructionPolyline
doc = ezdxf.readfile("your.dxf")
msp = doc.modelspace()
lwpolyline = msp.query("LWPOLYLINE").first
if lwpolyline is not None:
p = path.make_path(lwpolyline)
polyline = ConstructionPolyline(p.flattening(0.01))
# this also works for polylines including bulges (arcs)
points = list(polyline.divide(200)) |
Beta Was this translation helpful? Give feedback.
I think this question is what you are looking for: #527