pyvista / pyvista-support

[moved] Please head over to the Discussions tab of the PyVista repository
https://github.com/pyvista/pyvista/discussions
60 stars 4 forks source link

IGES Writer #385

Open adamgranthendry opened 3 years ago

adamgranthendry commented 3 years ago

Is there an IGES writer in pyvista? I would like to write a 3d spline to IGES.

adamgranthendry commented 3 years ago

@akaszynski Do you have any thoughts?

akaszynski commented 3 years ago

Hi @adamgranthendry,

Sadly, pyvista or any of the associated projects does not have support for the IGES format. If you're looking to just write a 3D spline, its will be difficult, but not impossible, to write that on your own. Each IGES entity has a format type that is described here: https://shocksolution.files.wordpress.com/2017/12/iges5-3_fordownload.pdf

Part of the problem is that it's a legacy format, officially replaced by the STEP format in STEP (ISO 10303), and it's hard to find modern and maintained packages that read/write IGES. My work on the pyvista IGES package was just to support reading in basic legacy formats, and it's quite limited.

adamgranthendry commented 3 years ago

Hi @akaszynski,

I completely understand. By chance, does pyvista have a way to write 3d splines to STEP? In summary, explained nicely here, different file types have different levels of accuracy and I'm in the boat where I need something that outputs with an accuracy of IGES or better.

image

akaszynski commented 3 years ago

Both pyvista and vtk are primarily suited for the visualization of tessellated geometry, and aren't well suited for CAD. Supporting CAD is quite difficult and its implementation in the Python ecosystem is still quite immature.

If you're looking to export splines into the STEP format, you may want to search for another python package or library that supports it. If you just want to save splines in a lossless manner, you could also just save the definition of the spline by pickling it. As far as I know from splines, if a spline is completely defined by the knots, weights, control points, etc, you can just encode all those values as a dictionary and save that. Depending on the spline, you should be able to save them in a lossless manner.

adamgranthendry commented 3 years ago

Yes, that is understandable. Would you be willing to review a pull request if I added this functionality? I will of course follow the contributing rules.

akaszynski commented 3 years ago

Sure! We always welcome pull requests, and don't worry about it being perfect, we'll iterate on it need be.

adamgranthendry commented 3 years ago

Excellent! And thank you! I can't promise timing, but I'm confident I can add the functionality and suitable tests cases 👍🏻