Message Boards Message Boards


Help exporting to Autocad.

Posted 8 years ago
9 Replies
0 Total Likes


I will wave the novice flag first and admit I am new to the use of Mathematica. I have the code of a shape I want to export as a *.dxf file , but after seeing some youtube tutorials and seeing some threads over here, i haven't managed to get it right.

 Show[calabi[0, 0, 0, alpha, 0, clr], ViewPoint -> {-1.4, 0, 1.4}, 
  Lighting -> 
   If[clr, {{"Ambient", GrayLevel[.5]}, {"Directional", White, 
      ImageScaled@{0, 0, 2}}}, {{"Ambient", 
      GrayLevel[.25]}, {"Directional", RGBColor[0.5, .5, 1], 
      ImageScaled@{0, 1, 0}}, 
          {"Directional", RGBColor[1, 0.5, 0.5], 
      ImageScaled@{1, -1, 0}}, {"Directional", RGBColor[0.5, 1, .5], 
      ImageScaled@{-1, -1, 0}}}], PlotRange -> 1.2, Boxed -> False, 
  Axes -> False, SphericalRegion -> True, ImageSize -> {450, 450}, 
  ViewAngle -> \[Pi]/4.5],
 {{alpha, \[Pi]/4, "projection angle"}, 0, 2 Pi},
 {{clr, False, "color code surface"}, {True, False}},
 Initialization :> {
   u1[a_, b_] := .5 (E^(a + I*b) + E^(-a - I*b));
   u2[a_, b_] := .5 (E^(a + I*b) - E^(-a - I*b));
   z1k[a_, b_, n_, k_] := E^(k*2*Pi*I/n)*u1[a, b]^(2.0/n);
   z2k[a_, b_, n_, k_] := E^(k*2*Pi*I/n)*u2[a, b]^(2.0/n);
   n = 5;
   calabi[x_, y_, z_, \[Alpha]_, t_, c_] := 
     With[{alpha = \[Alpha] - t}, 
       Evaluate@{Re[z1k[a, b, n, k1]] + x, Re[z2k[a, b, n, k2]] + y, 
         Cos[alpha]*Im[z1k[a, b, n, k1]] + 
          Sin[alpha]*Im[z2k[a, b, n, k2]] + z}, {a, -1, 1}, {b, 
        0, \[Pi]/2}, Boxed -> False, Axes -> False, PlotPoints -> 15, 
       PlotStyle -> 
        If[c, RGBColor@{If[k1 == 0 && k2 == 0, 0, 
            Rescale[k1, {0, n - 1}]], 
           If[k1 == 0 && k2 == 0, 0, Rescale[k2, {0, n - 1}]], 
           If[k1 == 0 && k2 == 0, 1, 0]}, {RGBColor[.5, .5, 1], 
          Specularity[White, 128]}], MaxRecursion -> 0, 
       PerformanceGoal -> "Speed", Mesh -> None]], {k1, 0, 
      n - 1}, {k2, 0, n - 1}];
   }, SynchronousInitialization -> False]

A screencap of the desired figure

I understand how ungrateful it is to use a first post asking for help but I've hit a dead end with this. Any help would be much appreciated.

Best, Carlos

POSTED BY: Carlos Ortega
9 Replies

i've been playing around with the figure's code now that i know how to Evaluate...

POSTED BY: Carlos Ortega

to make it look something like thisenter image description here

POSTED BY: Carlos Ortega

boy. i haven't feel this newbie in some time. thanks for the patience. What i really want to do is to see of there's a way to make the figure more graphically comprehensible, if you can think of a way of how i could accentuate the curves , i'd be extremely grateful.

POSTED BY: Carlos Ortega

Please first go through some introductory material or a video on Mathematica:

It's important to understand some of the basics before trying any of this.

Evaluating a command in Mathematica requires that you use both Shift and Enter together.

POSTED BY: Sean Clarke

apparently not. nothing happens after the enter.

POSTED BY: Carlos Ortega

Can you get Mathematica to evaluate "2+2"?

It should of course respond with "4"

POSTED BY: Sean Clarke

Thanks Sean.

i'm sorry, but nothing happens when i hit Enter after the closing the bracket...

stl works fine, since i just want to manipulate the variety in a CAD program.

POSTED BY: Carlos Ortega

As a warning, this is a somewhat difficult of an area.

3D image/graphics formats are much harder than 2D image formats. 2D image formats "Just work". You don't need to know anything about them to work with them. If you have a JPG image and you want it to be a PNG image. That's basically no problem. With 3D graphics, it's not the same. You often need to understand how the format stores images. You have to look up how the format works and understand the basics of it.

So, the first thing you would do is to click on the image and Copy or Cut it. Then you can Paste it somewhere in the notebook and run export on it:

enter image description here

This will produce a ton of error messages. The first is about PlotRange, which is probably some fluke. Change "PlotRange-> 1.2" to "PlotRange->All". This removes the PlotRange error messages. Now there's only one error message left:

Export::nodta: Graphics3D contains no data that can be exported to the DXF format. >>

Your object is a 3DParametricPlot. it's a surface. The examples I see in the documentation for DXF are regions. These aren't compatible. STL works as a format.

You can often make a surface object into a region like object using PlotStyle->Thickness[1]. That is, by giving the PlotStyle a certain thickness. This doesn't seem to be working in your case however.

Will STL work for your purposes? If not, we have to understand the DXF format and why it won't accept the ParametricPlot.

POSTED BY: Sean Clarke

shameless bump

POSTED BY: Carlos Ortega
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract