Method-1
- We build several circles along the helix curve with normal be the tangent of the curve, and then using
OpenCascadeShapeLoft
to thread the circles to get the solid.
Clear["Global`*"];
Needs["NDSolve`FEM`"];
Needs["OpenCascadeLink`"];
ω = 10;
r = .5;
thickness = .05;
f[t_] := {r*Cos[ω*t], r*Sin[ω*t], t/4};
circles =
Table[OpenCascadeCircle[{f[t], f'[t]}, thickness], {t,
Subdivide[0, 2 π, 61]}];
s = OpenCascadeShape /@ circles;
loft = OpenCascadeShapeLoft[s, "BuildSolid" -> True];
bmesh = OpenCascadeShapeSurfaceMeshToBoundaryMesh[loft,
"ShapeSurfaceMeshOptions" -> {"AngularDeflection" -> 0.15}];
reg = BoundaryMeshRegion[bmesh];
Volume[reg]
Graphics3D[{MaterialShading["Aluminum"], reg},
Lighting -> "ThreePoint", Boxed -> False]
0.245232
Method-2
- Another way is directly construct a
BoundaryMeshRegion
from the data of the plot.
- In the plot, we set
MaxRecursion -> 0
.
- In the plot,we set two meshs to as the the boundary of such tube and construct two polygons to seal the two openings of the tube.
ω = 10;
r = .5;
thickness = .05;
f[t_] := {r*Cos[ω*t], r*Sin[ω*t], t/4};
{tangent, normal, binormal} =
Last[FrenetSerretSystem[f[t], t]] // Simplify;
F[t_, θ_] :=
f[t] + thickness*{Cos[θ], Sin[θ]} . {normal, binormal};
plot = ParametricPlot3D[
F[t, θ], {θ, 0, 2 π}, {t, 0, 2 π},
MaxRecursion -> 0, PlotPoints -> {40, 800},
MeshFunctions -> {#5 &}, Mesh -> {{0, 2 π}},
MeshStyle -> Directive@{Thick, Red}, Boxed -> False, Axes -> False,
Method -> {"BoundaryOffset" -> False}];
pts = Cases[plot, GraphicsComplex[pts_, rest__] :> pts, -1][[1]];
polys = Cases[plot, GraphicsGroup[data_] :> data, -1][[1, 1]];
lines = Cases[plot, _Line, -1];
reg = BoundaryMeshRegion[pts,
Polygon[Join[lines /. Line[pts_] :> Rest@pts, First@First@polys]]]
Volume[reg]
0.245702
soild instead of a surface
. $\endgroup$Graphics3D
? For instance,Export["/tmp/foo.stl", ParametricPlot3D[{Sin[u] Cos[v], Sin[u] Sin[v], Cos[u]}, {u, 0, Pi}, {v, -Pi, Pi + 3 Pi/4}]]
In other words, I don't see the significant distinction between a solid and the boundary of a solid for the use-case`at hand. An STL file specifies only the surface of the solid. $\endgroup$Volume
, that is why I deliberate seal the two end to get a real solid. $\endgroup$Closed
instead of onlyShow
the pieces of surfaces (BoundaryDiscreteGraphics
not always work for suchShow
) $\endgroup$