3
$\begingroup$

I am trying to plot a function with ParametricPlot3D with a specified plot range to export as an stl file, however when exporting the graphic mathematica ignores the PlotRange and exports the whole function, is there a way to make this work or some sort of intersection command to work around this? Mathematica Function

Resulting Export

$\endgroup$
3
  • 1
    $\begingroup$ Could you include the code you used for exporting to STL? $\endgroup$
    – MarcoB
    Apr 18, 2016 at 4:00
  • $\begingroup$ I have the same problem when you cannot simply replace the PlotRange by restricting the parameter domain. $\endgroup$
    – user39553
    Apr 19, 2016 at 5:54
  • $\begingroup$ This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review $\endgroup$
    – Yves Klett
    Apr 19, 2016 at 6:57

3 Answers 3

3
$\begingroup$

As pointed out by Ivan Sterling, you cannot simply restrict the PlotRange, as this will not be respected when exporting to "STL". Take Louis's example,

ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], 
   Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}, 
  PlotRange -> {{0, π}, {0, π}, All}]
Export["test.stl", %] // Import

enter image description here

One method to make sure that you only get the plot you want is to restrict the parameter values, only plotting over the relevant values of u and v. But another option is to supply a RegionFunction

pp1 = ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], 
   Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}, 
  RegionFunction -> 
   Function[{x, y, z, u, v}, 0 <= x <= π && 0 <= y <= π]]
Export["test.stl", %] // Import

enter image description here

$\endgroup$
1
  • $\begingroup$ Nice example +1 $\endgroup$
    – user9660
    Apr 19, 2016 at 10:49
0
$\begingroup$

Works as intended on 10.0 for Mac OS X x86 (64-bit) (December 4, 2014), see also STL (.stl)

pp1 = ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], 
Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}]

Export["MathematicaParametricSurface.stl", pp1]

enter image description here

enter image description here

pp1 = ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], 
Sin[v]}, {u, 0, 1 Pi}, {v, 0, 1 Pi}]

Export["MathematicaParametricSurface.stl", pp1]

enter image description here

enter image description here

Import["MathematicaParametricSurface.stl"]

enter image description here

$\endgroup$
0
$\begingroup$

Yes there is. Your problem is your looking at the "true points" not the adjusted points.

See Mathematica BoxRatios[{1,1,1}]. I think that will do it.

If it doesn't all I can say is see the following which will (can) do it. (you can adjust the rayshade.m if needed to suite the need of your renderer, by default rayshade` uses plain text scaling for BoxRatio - your renderer may or may not like that. it also contains ability that can be utilized (not automatically) to scale the actual points). That being said: you can just scale the points using Mathematica yourself BEFORE you export! It's easy just multiply all the vertex by a scaling vertex.

see:

https://sourceforge.net/projects/rayshade-math/

How to Render, raytrace, Export Graphics3D in Mathematica 11.0

$\endgroup$
1
  • $\begingroup$ " I think that will do it." - have you tried? $\endgroup$
    – Kuba
    May 20, 2017 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.