How to convert LINE WITH ARC TO POLYLINE ? #1243
Unanswered
LaimisMasaitis
asked this question in
Q&A
Replies: 1 comment 6 replies
-
Look at the new Tutorial: https://ezdxf.mozman.at/docs/tutorials/edges.html import ezdxf
from ezdxf import edgeminer as em
from ezdxf import edgesmith as es
def main():
doc = ezdxf.readfile("rounded_rectangle.dxf") # see attached zip archive
msp = doc.modelspace()
# create edges and deposit
entities = msp.query("LINE ARC")
edges = list(es.edges_from_entities_2d(entities))
deposit = em.Deposit(edges)
# find first closed loop
loop = em.find_loop(deposit)
if len(loop):
# build LWPOLYLINE
polyline = es.lwpolyline_from_chain(loop, dxfattribs={"color": 1})
# export new DXF file
doc_out = ezdxf.new()
msp_out = doc_out.modelspace()
msp_out.add_entity(polyline)
doc_out.saveas("lwpolyline.dxf")
else:
print("polyline not found")
if __name__ == "__main__":
main() |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hi i want to convert rectangle with fillets on the corners(from lines and arcs) to polyline.
Well task is not very simple. Because at first need to find lines, arcs, points, calculate arcs bulges, insert points and bulge data to draw polyline, delete old lines, arcs, save everything in the new file . But I cant to find 100% working example. Help me please.
this code draws nonsenses:
Beta Was this translation helpful? Give feedback.
All reactions