2
$\begingroup$

How do you export a Pyramid to vrml format in Mathematica ? I have been trying to do this the following way

graph = Graphics3D[Pyramid[{{1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {0, 0, 1}}]];
Export["test.wrl", graph]

But I get an error:

Export::nodta: Graphics3D contains no data that can be exported to the VRML format.

Any suggestions ?

$\endgroup$
  • $\begingroup$ I would say an issue for support@wolfram.com. Pyramids should not be impossible to export to vrml. $\endgroup$ – Sjoerd C. de Vries Feb 19 '15 at 7:40
2
$\begingroup$

Not entirely straightforward, but as it turns out you can use MeshCells together with DiscretizeGraphics:

MeshPrimitives[DiscretizeGraphics[Pyramid[]], 2]

(*{Polygon[{{-1., -1., 0.}, {1., -1., 0.}, {0., 0., 1.}}], 
 Polygon[{{-1., -1., 0.}, {0., 0., 1.}, {-1., 1., 0.}}], 
 Polygon[{{1., -1., 0.}, {1., 1., 0.}, {0., 0., 1.}}], 
 Polygon[{{1., 1., 0.}, {-1., 1., 0.}, {0., 0., 1.}}], 
 Polygon[{{-1., -1., 0.}, {-1., 1., 0.}, {1., 1., 0.}, {1., -1., 0.}}]}*)

This should export just fine.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.