Is Matplotlib the right tool for this job?

Hi all,
Total newbie to graphics rendering, so please forgive any missteps or mis-nameing of things.

I’ve looked at Panda3D, but it appears to be (at least for my purposes) like using an elephant to swat a fly. Great for creating a sophisticated game, not so much for a humble engineering app like mine.

I’m working on a program that modifies and renders the results of a CNC GCode file. What I need to be able to do:

  • Render a piece of material, for example a piece of wood, in 3D.
  • Render the tool path the file will generate for the tool (router bit). Just a line that follows the path has taken.
  • Render the tool in it’s position based on where the tool is in the CNC program.
  • Render the resulting material shape after the router bit has passed.
  • All of the above while allowing the end user to rotate, pan and zoom the image.
  • I would like to be able to simulate the tool moving along it’s path (optional).

From what I’ve seen in the examples, Matplotlib seems to be the right tool for the job, but most of the examples I’ve seen focus on plotting and charting, not more general uses.

Matplotlib is primarily a 2D plotting tool. While we have some 3D functionality it is not “proper” 3D (in that we do the projection from 3D -> in Python and then do 2D rendering). In particular if you have intersecting surfaces, we do not do anything to compute where they intersect which frequently generates “esher-effects”.

I think you can technically make what you want work, but it will not be easy and you would have to all of the computational geometry yourself.

It sounds like you want a CAD program?

Thanks tacaswell for the info.

The program I’m writing takes the output from a CAD program to make some adjustments and hopefully allow me to visualize the results. Kind of tweaking the heights and feed speeds beyond the abilities of the CAD program I’m using. It makes global changes vs design changes.
I’ll keep plugging away at learning about Panda3d

Sounds like you might be looking for mayavi?

1 Like