# Demonstration site CDF error correction question

I use Mathematica ver11.

However, the following error is displayed when running Demonstration site.

http://demonstrations.wolfram.com/ThreeOrthogonalProjectionsOfPolyhedra/

px[r_] := {0, r[[2]], r[[3]]};
py[r_] := {r[[1]], 0, r[[3]]};
pz[r_] := {r[[1]], r[[2]], 0};
pxs[solid_] := {solid[[1]], Map[px, solid[[2]]], solid[[3]]};
pys[solid_] := {solid[[1]], Map[py, solid[[2]]], solid[[3]]};
pzs[solid_] := {solid[[1]], Map[pz, solid[[2]]], solid[[3]]};
show[poly_][solid_] := Map[poly, Map[solid[[2, #]] &, solid[[1]]]];
trans[vec_][r_] := r + vec
translate3[vec_, solid_] := {solid[[1]], Map[trans[vec], solid[[2]]],solid[[3]]};
translate23[vec_][solid_] := translate3[vec, solid];
ClosedLine[a_] := Line[Append[a, First[a]]];
visible[solid_, view_][edge_] := Module[{edges = solid[[3]], vert = solid[[2]], faces = solid[[1]], f = Length[solid[[1]]], fac, normals}, fac = Select[Range[f], Length[Intersection[faces[[#]], edge]] == 2 &];
normals = Table[Normalize[
Cross[vert[[faces[[fac[[i]], 2]]]] - vert[[faces[[fac[[i]], 1]]]],
vert[[faces[[fac[[i]], 3]]]] - vert[[faces[[fac[[i]], 1]]]]]], {i, 1, 2}]; view.normals[[1]] > 0.001 || view.normals[[2]] > 0.001 ]
visib2[solid_, viewp_, prsolid_] :=  Table[{If[! visible[solid, viewp][solid[[3, j]]], Dashed, Thin], Line[Map[prsolid[[2, #]] &, prsolid[[3, j]]]]}, {j, 1, Length[solid[[3]]]}];

Manipulate[ Module[{cc, cc1, py1, pyss},   cc1 = With[{cu = PolyhedronData[p, "Faces"],
cu1 = PolyhedronData[p, "Edges"]}, {cu[[2, 1]], cu[[1]] // N,
cu1[[2, 1]]}]; cc = translate23[{xx, yy, zz}][cc1];
pyss = pys[cc]; py1 = visib2[cc, {0, 100, 0}, pyss];
Column[{Graphics3D[{{GrayLevel[0.6],
Line[{{0, 0, 0}, {5 + xx, 0, 0}, {5 + xx, 0, 5 + zz}, {0, 0,
5 + zz}, {0, 0, 0}}]}, {GrayLevel[0.6],
Line[{{0, 0, 0}, {0, yy + 5, 0}, {0, yy + 5, 5 + zz}, {0, 0,
5 + zz}, {0, 0, 0}}]}, {GrayLevel[0.6],
Line[{{0, 0, 0}, {5 + xx, 0, 0}, {5 + xx, 5 + yy, 0}, {0,
5 + yy, 0}, {0, 0, 0}}]}, visib2[cc, {0, 0, 100}, pzs[cc]],
visib2[cc, {0, 100, 0}, pys[cc]],
visib2[cc, {100, 0, 0}, pxs[cc]],
If[shs, show[If[ef == 1, Polygon, ClosedLine]][cc], {}]},
ViewPoint -> {3, 3, 1}, ViewAngle -> 15 Degree, Boxed -> False,
ImageSize -> {400, 400}, Lighting -> "Neutral",
SphericalRegion -> True,
PlotRange -> {{-.5, 4.7}, {-.5, 4.7}, {-2, 4.7}}]}]], {{p,"SquashedDodecahedron", "polyhedron"},Intersection[PolyhedronData["Convex"], PolyhedronData[;; 14]]}, Row[{"translate   ", Column[{
Control@{{xx, 2, Style["x", Italic]}, 1, 3, .001,
ImageSize -> Tiny, Appearance -> "Labeled"},
Control@{{yy, 2, Style["y", Italic]}, 1, 3, .001,
ImageSize -> Tiny, Appearance -> "Labeled"},
Control@{{zz, 2, Style["z", Italic]}, 1, 3, .001,  ImageSize -> Tiny, Appearance -> "Labeled"}  }], Spacer[20],   Control@{{shs, True, "show solid"}, {True, False}}, Spacer[20],   Control@{{ef, 1, ""}, {1 -> "polygon", 2 -> "line"}, Enabled -> shs}   }], SaveDefinitions -> True]


However, I want to know why an error occurs.

• Execute PolyhedronData["Cube", "Faces"] and PolyhedronData["Cube", "Faces", "Polygon"] and see if you think they should be interchangeable. – Michael E2 May 24 '17 at 1:31
• @MichaelE2 the syntax in V11 has changed. in V10.4 PolyhedronData["Cube", "Faces"] returns GraphicsComplex. I noticed it earlier but didn't have time to investigate all details, maybe it is good place to ask about all changes in PolyhedronData? Giving as example PolyhedronData["Cube", "Faces"] instead of op's code. What do you think? – Kuba May 24 '17 at 6:47
• @Kuba Yeah, kinda funny they break their own code, in a sense. -- Your interpretation of the Q seems reasonable, and if so, I misinterpreted what was meant in the original Original Post. – Michael E2 May 24 '17 at 12:21
• Thanks to a friendly explanation, I solved it well. – user21427 May 25 '17 at 4:08

Syntax for PolyhedronData was changed in v11 you need to replace this line:

cc1 = With[
{ cu = PolyhedronData[p, "Faces"]
, cu1 = PolyhedronData[p, "Edges"]
}
, { cu[[2, 1]]
, cu[[1]] // N
, cu1[[2, 1]]
}
];


with:

cc1 = With[
{ cu = PolyhedronData[p, "GraphicsComplex"]
, cu1 = PolyhedronData[p, "Edges"]
}
, { cu[[2, 1]]
, cu[[1]] // N
, cu1
}
];


• Thanks to a friendly explanation, I solved it well. – user21427 May 25 '17 at 4:08