MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Exporting to a 3D file...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80169] Re: Exporting to a 3D file...
  • From: Albert <awnl at arcor.net>
  • Date: Tue, 14 Aug 2007 07:00:50 -0400 (EDT)
  • References: <f9p4j3$qgq$1@smc.vnet.net>

Hi,

> Manipulate[
>  Graphics3D[{Cuboid /@ 
>     Position[
>      CellularAutomaton[{rn, {2, 1}, {1, 1, 1}}, 
>       If[pr, Normal[
>         SparseArray[
>          Flatten[Table[{16, 16, Floor[(53 - init)/2] + i} -> 1, {i, 
>             init}], 1], {33, 33, 53}]],
>        {{{Table[1, {init}]}}, 0}], {{{t}}}], 1]}, Boxed -> False, 
>   PlotRange -> If[pr, {{0, 33}, {0, 33}, {0, 53}}, All],
>   PlotRangePadding -> 1, ImageSize -> {400, 300}, 
>   SphericalRegion -> True],
>  {{rn, 14, "rule number"}, 2, 200, 4, Appearance -> "Labeled"},
>  {{t, 5, "steps"}, 0, 15, 1, Appearance -> "Labeled"},
>  {{init, 1, "initial height"}, 1, 10, 1, 
>   Appearance -> "Labeled"}, Delimiter,
>  {{pr, False, ""}, {True -> "fixed view", False -> "zoom to fit"}},
>  AutorunSequencing -> {{1, 20}, {2, 15}, {3, 10}, {4, 5}}]
> 
> 
> Copy and paste should run fine as is.

If you run this you will see a small icon showing a Plus-sign within a 
circle in the upper right corner. If you click on that, a menu comes up 
from which you can select Paste Snapshot. This will generate some Code 
beginning with DynamicModule. Replacing DynamicModule with just Module 
will give code which evaluates to a normal Graphics3D-Object, which you 
can export as usual, e.g.:

res=Module[{init=1,pr=False,rn=14,t=5},Graphics3D[{Cuboid/@Position[
CellularAutomaton[{rn,{2,1},{1,1,1}},If[pr,Normal[SparseArray[Flatten[
Table[{16,16,Floor[(53-init)/2]+i}->1,{i,init}],1],{33,33,53}]],
{{{Table[1,{init}]}},0}],{{{t}}}],1]},Boxed->False,PlotRange->If[pr,
{{0,33},{0,33},{0,53}},All],PlotRangePadding->1,ImageSize->{400,300},
SphericalRegion->True]]

Export["file.stl",res]

Having written this, I really wonder whether there is no simpler way to 
do this....

hth,

albert



  • Prev by Date: Re: Re: RandomComplex documentation
  • Next by Date: Re: Re: Reading Coordinates from Plot
  • Previous by thread: Exporting to a 3D file...
  • Next by thread: Re: Exporting to a 3D file...