2
$\begingroup$

I'm experiencing some strange behavior when using Export and Printout3D on the entire object created below. Exporting each part individually or using Printout3D work just fine. Also, for some reason it appears that the initial cylinder has a flaw of some kind since I get an error saying the model needs repaired and automatic repairing deletes just those two initial cylinders. The annulus code was taken from Thick annulus (ring) in 3D.

Here's the code:

r = .1;(* cylinder diameter *)
\[Phi] = 30; (* angle of cylinders to xy-plane *)
S = 4; (* 1/2 length of dynamic line *)
Subscript[x, o] = .5;(* x translation *)
Subscript[y, o] = .5;(* y translation *)
a = Sqrt[Subscript[x, o]^2  + Subscript[y, o]^2]; (* vertices *)
numsticks = 10; (* half the number of cylinders *)

(* this makes the ruled surface of the hyperboloid *)
frameL = {Blue, Cylinder[{{0, 0 , -S}, {0 , 0 , S}}, r]};
frameR = {Red, Cylinder[{{0, 0 , S}, {0 , 0 , -S}}, r]};
frameRT = Table[Rotate[Rotate[
     Translate[frameR, {Subscript[x, o], Subscript[y, o], 
       0}], (180 - \[Phi]) Degree, {1, 1, 0}], (180 - ra) Degree , {0,
      0, 1} , {0, 0, 0}], {ra, 0, 360, 360/numsticks}];
frameLT = Table[Rotate[Rotate[
     Translate[frameL, {Subscript[x, o], Subscript[y, o], 
       0}], \[Phi] Degree, {1, 1, 0}], 
    ra Degree , {0, 0, 1} , {0, 0, 0}], {ra, 0, 360, 360/numsticks}];

(* this generates the top and bottom annulus *)
tup = TranslationTransform[{0, 0, .98 S*Cos[\[Phi] Degree]}];
tdwn = TranslationTransform[{0, 0, -1.02 S*Cos[\[Phi] Degree]}];
annulus = 
  With[{c = {0, 0}, r1 = 1.9, r2 = 2.25, h = 0.2}, 
   RegionProduct[BoundaryDiscretizeRegion[Annulus[c, {r1, r2}]], 
    MeshRegion[{{0}, {h}}, Line[{1, 2}]]]];
annulus1 = tdwn[annulus];
annulus2 = tup[annulus];

(* final outputs *)
sticks = Graphics3D[{frameRT, frameLT}];
output = Show[sticks, annulus1, annulus2]

Both of the following result in an STL file containing only the cylinders (with a model error that deletes the initial cylinders upon success). If I ignore the errors, the STL file slices properly.

Export["output.stl",output]
Printout3D[output]

However, this is successful (also with the model error).

Map[Printout3D,{sticks,annulus1,annulus2}]

Perhaps there is a more efficient way to get the same object.

Why can't I get the entire model out at the same time? How can I fix the model error?

$\endgroup$
3
  • $\begingroup$ The errors appear due to the stupid realization of the BooleanRegion which is inside any RegionProduct and similar functions. You can also make annulus as RegionDifference[Cylinder[{{x,y,z},{X,Y,Z}},R1],Cylinder[{{x,y,z},{X,Y,Z}},R2]], where R2<R1. $\endgroup$ – Rom38 Feb 26 '20 at 11:38
  • $\begingroup$ Using your suggestion, Mathematica gives BooleanRegion[#1 && ! #2 &, {Cylinder[{{0, 0, 3.4516}, {0, 0, 3.4766}}, 2.25], Cylinder[{{0, 0, 3.4516}, {0, 0, 3.4766}}, 2]}] which I cannot figure out how to display (along with the sticks). It also takes forever to export the stl using Export or Printout3D. The stl given by Export fails to load in the slicer, but the Printout3D works, just exporting from Mathematica is very slow (and it removes some (many?) degenerate cells). $\endgroup$ – ryan.axiom Feb 26 '20 at 14:17
  • $\begingroup$ @rian.axiom, you can visualize the regions by Region[...] or the same as you did by Show[...] $\endgroup$ – Rom38 Feb 27 '20 at 5:10

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.