4

Following the reply by @user21 to this post on exporting a region to a step file, I tried to do the same for a Discretized ImplicitRegion, but OpenCascadeShape didn't appear to work. Is there a switch or a constraint I need to apply to Discretized regions to allow OpenCascadeShape to handle them?

imReg = ImplicitRegion[x^2 + y^2 - z < 0, {x, y, z}];
discReg = DiscretizeRegion[imReg, {{-2, 2}, {-2, 2}, {0, 5}}]

discReg

Needs["OpenCascadeLink`"]
shape = OpenCascadeShape[discReg]

output

OpenCascadeShapeExport["~/shape.step", shape]

export output

user21
  • 39,710
  • 8
  • 110
  • 167
DrBubbles
  • 1,391
  • 9
  • 17

1 Answers1

7

Try using ToBoundaryMesh like so:

Needs["NDSolve`FEM`"];
Needs["OpenCascadeLink`"]
imReg = ImplicitRegion[x^2 + y^2 - z < 0, {{x, -2, 2}, {y, -2, 2}, {z, 0, 5}}];
bmesh = ToBoundaryMesh[imReg];
bmesh["Wireframe"]
shape = OpenCascadeShape[bmesh]
OpenCascadeShapeExport["~/shape.stp", shape]

The shape can now be read in by external packages such as SolidWorks.

enter image description here

Tim Laska
  • 16,346
  • 1
  • 34
  • 58
  • Didn't realize you can specify the limits in ImplicitRegion along with the variables i.e. {{x,-2,2},{y,-2,2},{z,0,5}} rather than {x,y,z} (I don't see that in the manual, or maybe it is just Implicit :-) That saves me having to explicitly Discretize it too. – DrBubbles Oct 07 '20 at 18:37