0
$\begingroup$

Hi I have imported a 3d model into Mathematica converting it from a PLY or STL format. This works fine. By using the procedure in Slice through Graphics3D and modifying it slightly for a mesh region rather than a Graphics3D image I can get nice 2D elevations, planes and sections. The problem comes when I want to export those views in 2D via dxf into a cad program. It only seems to export the whole 3d model not just the 2d view. Any guidance as to how to get just the 2d view into a dxf format?

Here is a simple example. I first draw a tetrahedron

t = MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 
2}}, {Tetrahedron[{1, 2, 3, 5}]}]

I then take a view of it. In this case the base

base = MeshRegion[t, ViewPoint -> {0, 0, -Infinity}]

I then export it as a dxf and reimport it.

Export["base.dxf", base]
Import["base.dxf"]

This gives me the whole model i.e. a 3d dxf file rather than just the 2d view which is what I want.

$\endgroup$
3
  • $\begingroup$ Can you post a minimal working example? Exporting a 2D mesh region as a DWF file seems to work, disk = DiscretizeGraphics@Disk[]; Export["disk.dxf", disk] gives no errors, and I'm able to reimport the resulting file just fine. $\endgroup$
    – Jason B.
    Sep 12 '16 at 13:41
  • $\begingroup$ The problem is that you aren't really making any changes to the MeshRegion when you specify a ViewPoint. After evaluateing the line base = ....., try using your mouse to manipulate the result and you'll find it is still a 3D object, not 2D. Also, evaluate RegionEmbeddingDimension@base $\endgroup$
    – Jason B.
    Sep 12 '16 at 19:49
  • $\begingroup$ I understand but how do I get an exportable 2D slice or view from a 3D model? Is there an equivalent to Image3Dslices for Mesh Regions? $\endgroup$
    – Malcolm
    Sep 12 '16 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.