0

The file I'm trying to import this VRML file on Meshlab:

#VRML 2.0 utf-8
PROTO my_sphere [ exposedField SFFVec3f xyz 0 0 0 ] {
    Transform {
        translation IS xyz
        children [
            Shape {
                appearance Appearance { material Material { 
diffuseColor 1.0 0.05 0.05 } }
                geometry Sphere { radius 0.66 }
            }
        ]
    }
}
my_sphere { xyz 0.0 0.0 0.119 } # 0
my_sphere { xyz 0.0 0.0 0.119 } # 1

I'm getting the error:

Error encountered while loading file:
"/my_path/test.wrl"

File: /my_path/test.wrl
Error details: -- line 2 col 32: invalid FieldType
-- line 4 col 42: "{" expected

How can I import this type of file? I can easily do it on Blender.

izxle
  • 386
  • 1
  • 3
  • 19
  • The type of the xyz field is misspelled in your list, it should be SFVec3f. However, even with this change Meshlab 2016 will not import. Meshlab X3D/VRML import may not support the PROTO statement. – Vincent Marchetti Sep 21 '17 at 14:56
  • Further experiments with the X3D examples at http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/RedSphereBlueBoxIndex.html -- downloaded as VRML97 -- show that Meshlab does not support the primitive shapes of Sphere and Box. It appears that only mesh nodes such as IndexedTriangleSet are supported – Vincent Marchetti Sep 21 '17 at 15:22
  • @VincentMarchetti Oh, then, if it's misspelled why does it work on Blender? is it interpreted as something else? – izxle Oct 05 '17 at 09:53

1 Answers1

1

Apart from the misspelling in the original example (it should be SFVec3f, not SFFVec3f), Meshlab, at version 2016.12, does not support the primitive Sphere geometry. Meshlab does support using the PROTO statement that 'returns' Shape with IndexedFaceSet geometry. Here is an example VRML97 scene generating two tetrahedra instances as mesh-defined shapes:

#VRML 2.0 utf-8
 PROTO my_tetrahedron [ exposedField SFVec3f xyz 0 0 0 ] {
     Transform {
         translation IS xyz
         children [
      Shape {
        appearance Appearance {
          material Material {
            diffuseColor 0.0 1.0 0.0
          }
        }
        geometry IndexedFaceSet {
          coordIndex [ 3 1 0 -1  3 2 1 -1  3 0 2 -1  0 1 2 -1]
          coord Coordinate {
            point [0.29 0.50 -0.20 0.29 -0.50 -0.20 -0.58 0.00 -0.20 0.00 0.00 0.61]
          }
        }
      }
         ]
     }
 }


# [Scene] ========== ========== ==========


my_tetrahedron { xyz 0.0 0.0 0.0 } 
my_tetrahedron { xyz -1.0 -1.0 -1.0 }

Meshlab 2016 does import this as two meshes.

Suggest solution to original question: replace the Sphere geometry in the VMRL scene with geometry defined by an IndexedFaceSet

Vincent Marchetti
  • 4,768
  • 3
  • 18
  • 8