4
$\begingroup$

Bug introduced in v12.0 (?) and fixed as of 12.3.1

While attempting to export a symbol with head Region (or Graphics3D) as an OBJ file, I run in to problems using Cube[] that are not readily apparent with Cuboid[].

c1 = Region[Cube[]];
c2 = Region[Cube[100]];
c3 = Region[Cuboid[]];
c4 = Region[Cuboid[{100, 100, 100}]];
Export["c1.obj", c1];
Export["c2.obj", c2];
Export["c3.obj", c3];
Export["c4.obj", c4];
Export["c1a.obj", 
  TransformedRegion[c1, ScalingTransform[100 {1, 1, 1}]]];
Export["c3a.obj", 
  TransformedRegion[c3, ScalingTransform[100 {1, 1, 1}]]];

In this example, file c1a.obj doe not get generated with two errors being thrown: Region cannot be exported to the OBJ format and RuleDelayed cannot be exported to the OBJ format. The same behavior is observed if Graphics3D symbols are used.

Is this behavior working as intended? I believe this to be a bug - I am using Version 12.0.0 at the moment.

$\endgroup$
4
  • $\begingroup$ Internally from tracing I've found Cube[] is really a Polyhedron or gets converted to one, while Cuboid[] is a Parallelepiped. It seems any of the Polyhedron objects also fail to export, but only if they've undergone some sort of transformation to the region. Consider this failing case too: Export["dodeca.obj", TransformedRegion[Region[Dodecahedron[]], RotationTransform[\[Pi]/4, {0, 0, 1}]]] - I'm using Windows v12.1.1 $\endgroup$
    – flinty
    Jul 4, 2020 at 0:25
  • $\begingroup$ If you replace Region[Cube[]] with MeshRegion[Cube[]] you should have no trouble transforming and exporting it and it works for me in v12.1.1. You could also use MeshRegion only when you export, if you don't want the mesh elsewhere. $\endgroup$
    – flinty
    Jul 4, 2020 at 0:29
  • $\begingroup$ @flinty so it does look like a bug of some sort, although there are a number of workarounds like you suggest. $\endgroup$ Jul 4, 2020 at 1:57
  • $\begingroup$ Yes, you should report it. Even if the Region[Cube[]] is somehow wrong , it certainly shouldn't fail in that way. $\endgroup$
    – flinty
    Jul 4, 2020 at 2:00

1 Answer 1

2
$\begingroup$

Bug found in v12.0 and fixed as of 12.3.1.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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