mikedh / trimesh

Python library for loading and using triangular meshes.
https://trimesh.org
MIT License
3k stars 580 forks source link

load dxf and show if but image some lines missing #987

Open yingma111 opened 4 years ago

yingma111 commented 4 years ago

I load a dxf file and then show it. Code as follow:

import trimesh

model = trimesh.load("images_dxf_with_problems/B(82).dxf")
model.show()

dxf file : B(82).dxf.tar.gz

but show me with follow image: Figure_1

there are two lines missing. Please help me soon. Super thank you.

mikedh commented 4 years ago

Thanks for the report! If you look at the debug log trimesh.util.attach_to_log():

DEBUG               dxf.py:552   Entity type ELLIPSE not supported
DEBUG               dxf.py:552   Entity type ELLIPSE not supported

Those two entities are ellipses which aren't currently implemented although I'll look into it.

mikedh commented 4 years ago

Actually this isn't so easy haha. The DXF parsing itself is pretty easy. After that we'd have to add an Ellipse entity which doesn't fit super well with the trimesh data model (which is every entity has control points referenced by index, which works in both 2D and 3D). I think the easiest way to implement this actually might be a "convert ellipse to BSpline" entity which is itself a bit rough.

Happy to take PR's! I don't think I'll be able to do this in the near term however.

yingma111 commented 4 years ago

Thanks anyway! Expect it.

mikedh commented 4 years ago

Cool! Not sure if this is the best way, but OpenCASCADE implemented an "ellipse to b-spline" function which might be a good reference.