# Style of ClipPlanes and Opacity of figures

I have 2 Manipulate. In first Manipulate I can change size, position and opacity for every figure, I have 4 figure (Cuboid, Ellipsoid, Pyramid, Cylinder).

globalState = {};
Manipulate[
saveState = {f, a1, a2, a3, a4, a5, a6, x1, x2, x3, x4, x5, x6, h2,
r2, z1, z2, z3, h1, r1, c1, c2, c3, o1, o2, o3, o4};
Show[{
Graphics3D[{Red, Opacity[o1],
Cuboid[{-5 + a4, -5 + a5, a6}, {-5 + a1 + a4, -5 + a2 + a5,
a3 + a6}], Green, Opacity[o2],
Ellipsoid[{0 + x4, 0 + x5, 10 + x6}, {x1, x2, x3}], Blue,
Opacity[o3],
Pyramid[{{r2 + z1, -r2 + z2, 0 + z3}, {-r2 + z1, -r2 + z2,
0 + z3}, {-r2 + z1, r2 + z2, 0 + z3}, {r2 + z1, r2 + z2,
0 + z3}, {0 + z1, 0 + z2, h2 + z3}}], Black, Opacity[o4],
Cylinder[{{c1, c2, c3}, {c1, c2, c3 + h1}}, r1]
}, PlotRange -> {{-5, 5}, {-5, 5}, {0, 20}},
Boxed -> True, ImageSize -> {300, 300}
]}],
"Cuboid",
Control[{{o1, 0.5, "Opacity"}, 0, 1, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{a1, 1, "X"}, 1, 10, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{a2, 1, "Y"}, 1, 10, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{a3, 1, "H"}, 1, 20, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{a4, 0, "delta X"}, 0, 10, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{a5, 0, "delta Y"}, 0, 10, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{a6, 0, "delta H"}, 0, 20, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
"Ellipsoid",
Control[{{o2, 0.5, "Opacity"}, 0, 1, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{x1, 1, "X"}, 1, 5, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{x2, 1, "Y"}, 1, 5, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{x3, 1, "H"}, 1, 10, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{x4, 0, "delta X"}, -5, 5, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{x5, 0, "delta Y"}, -5, 5, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{x6, 0, "delta H"}, -10, 10, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
"Pyramid",
Control[{{o3, 0.5, "Opacity"}, 0, 1, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{h2, 1, "H"}, 1, 20, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{r2, 1, "R"}, 1, 5, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{z1, 0, "delta X"}, -5, 5, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{z2, 0, "delta Y"}, -5, 5, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{z3, 0, "delta H"}, 0, 20, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
"Cylinder",
Control[{{o4, 0.5, "Opacity"}, 0, 1, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{h1, 1, "H"}, 1, 20, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{r1, 1, "R"}, 1, 5, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{c1, 0, "delta X"}, -5, 5, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{c2, 0, "delta Y"}, -5, 5, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
Control[{{c3, 5, "delta H"}, 0, 20, .01, ImageSize -> Small,
Appearance -> "Labeled"}],
ControlPlacement -> Left]


Then I click on the button, and figures and their size, position and opacity move to 2 Manipulate.

Button["Add", {
temp = {Red, Opacity[saveState[[24]]],
Cuboid[{-5 + saveState[[5]], -5 + saveState[[6]],
saveState[[7]]}, {-5 + saveState[[2]] + saveState[[5]], -5 +
saveState[[3]] + saveState[[6]],
saveState[[4]] + saveState[[7]]}]},
AppendTo[globalState, temp],
temp = {Green, Opacity[saveState[[25]]],
Ellipsoid[{saveState[[11]], saveState[[12]],
10 + saveState[[13]]}, {saveState[[8]], saveState[[9]],
saveState[[10]]}]},
AppendTo[globalState, temp],
temp = {Blue, Opacity[saveState[[26]]],
Pyramid[{{saveState[[15]] + saveState[[16]], -saveState[[15]] +
saveState[[17]], saveState[[18]]},
{-saveState[[15]] + saveState[[16]], -saveState[[15]] +
saveState[[17]],
saveState[[18]]}, {-saveState[[15]] + saveState[[16]],
saveState[[15]] + saveState[[17]],
saveState[[18]]}, {saveState[[15]] + saveState[[16]],
saveState[[15]] + saveState[[17]],
saveState[[18]]}, {saveState[[16]], saveState[[17]],
saveState[[14]] + saveState[[18]]}}]},
AppendTo[globalState, temp],
temp = {Black, Opacity[saveState[[27]]],
Cylinder[{{saveState[[21]], saveState[[22]],
saveState[[23]]}, {saveState[[21]], saveState[[22]],
saveState[[23]] + saveState[[19]]}}, saveState[[20]]]},
AppendTo[globalState, temp];
}]


In 2 Manipulate I show all figures, which user set in 1 Manipulate, and use ClipPlanes on figures to obtain a cross section

Manipulate[
Show[{
Graphics3D[{globalState}, PlotRange -> {{-5, 5}, {-5, 5}, {0, 20}},
Boxed -> True, ImageSize -> {300, 300},
ClipPlanes -> {i, j, 1, -k + 0.01}],
ContourPlot3D[
i x + j y + z == k, {x, -5, 5}, {y, -5, 5}, {z, 0, 20.01},
Mesh -> None, ContourStyle -> Directive[Blue, Opacity[0.3]]]}],
"Plane",
{{i, 0, "X"}, 0, 2, .01, ImageSize -> Small, Appearance -> "Labeled"},
{{j, 0, "Y"}, 0, 2, .01, ImageSize -> Small, Appearance -> "Labeled"},
{{k, 0, "Z"}, 0, 20, .01, ImageSize -> Small,
Appearance -> "Labeled"},
ControlPlacement -> Left]


And now I want set style to cross-section (color, thickness), and add possibility hide all figures and show only cross-section. I don't know how I can do it, FaceForm and Opacity[0] could help me, but I don't know how apply it to list

• Is the full code really needed for showing the problem? Could you reduce it to one Graphics3D with simple primitives and static ClipPlanes? The more compact and clear example you provide the more likely it will get attention. Unless I missed the point and all of that is needed.
– Kuba
Apr 25, 2018 at 8:20