[X3D-Public] CAD examples errors

Don Brutzman brutzman at nps.edu
Sun Apr 28 13:07:38 PDT 2013

summary: resolution of comments/corrections in example scenes complete. 
one significant TODO action emerged regard X3D v3.3 Disposition of Comments.

On 4/24/2013 11:33 AM, Michalis Kamburelis wrote:
> Hi,
> I noticed a link to CAD component examples on
> http://www.web3d.org/x3d/content/examples/Basic/CAD/ . It seems there
> are a couple of errors in the test files, i.e. they do not conform to
> the X3D specification (they declare in header X3D 3.0 or 3.1 spec
> versions).
> 1. "Cad Design Pattern Examples": contains Transform node inside
> CADFace. This is invalid, X3D spec (checked 3.1 and 3.3 versions) says
> that CADFace can only contain (inside "shape" field) the [X3DShapeNode,
> LOD] nodes. So, Transform is not allowed there.

Following the earlier fixes to scene, DOCTYPE Schema and tooltips:
- added further Schematron rules about allowed parents/children and also 
correct containerField
- I renamed the scene (and corresponding set of screen-snapshot image 
files) to

> 2. "Cad Geometry Extern Prototypes": it indirectly (though
> http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.wrl
> ) links to
> http://www.web3d.org/x3d/content/examples/Basic/development/MetadataPrototypes.wrl
> , and MetadataPrototypes.wrl is invalid: the manner in which it uses
> DEF/USE of "HideWarnings" is invalid. It makes "DEF HideWarnings" inside
> a PROTO MetadataDouble, and then inside another PROTO MetadataFloat it
> does "USE HideWarnings".
> This is incorrect, as each PROTO has a separate namespace for DEF/USE
> names. See X3D 3.3 spec:
> http://www.web3d.org/files/specifications/19775-1/V3.3/Part01/concepts.html#PROTOdefinitionsemantics
> : "Nodes given a name by a DEF construct inside the prototype may not be
> referenced in a USE construct outside of the prototype's scope.".
> The simplest fix would be to update MetadataPrototypes.wrl to always do
> "DEF HideWarnings ... { }" instead of trying to reUSE the HideWarnings
> name.

You are correct, thanks.

I was happy to find that we already have a rule in X3D Schematron to 
detect this kind of error.  Just hadn't cleaned up this example before.

<Appearance USE='HideWarnings'/> DEF and USE must both be outside 
ProtoDeclare or within same ProtoDeclare scope 
($USEparentProtoName=MetadataFloat, $DEFparentProtoName=MetadataDouble) 
[/X3D/Scene/ProtoDeclare[2]/ProtoBody/Group/Shape/Appearance, error]
<Appearance USE='HideWarnings'/> DEF and USE must both be outside 
ProtoDeclare or within same ProtoDeclare scope 
[/X3D/Scene/ProtoDeclare[3]/ProtoBody/Group/Shape/Appearance, error]
<Appearance USE='HideWarnings'/> DEF and USE must both be outside 
ProtoDeclare or within same ProtoDeclare scope 
($USEparentProtoName=MetadataString, $DEFparentProtoName=MetadataDouble) 
[/X3D/Scene/ProtoDeclare[5]/ProtoBody/Group/Shape/Appearance, error]

Now fixed by using independent names within each individual ProtoDeclare 

FWIW tho I did not find a reference from CadGeometryPrototypes to 
MetadataPrototypes; perhaps you are using it internal to your X3D engine.

> 3. "Cad Geometry Prototypes": the example in classic encoding
> (CadGeometryPrototypes.x3dv) has a parsing error: on line 110, within a
> url with ecmascript: contents, the double quotes should be escaped.
> There is:
> //colorPerVertex ignored in IndexedQuadSet, and always treated as "true"
> but it should be
> //colorPerVertex ignored in IndexedQuadSet, and always treated as \"true\"
> The version in XML encoding seems Ok, so it's probably some bug in
> (probably automatic) generation of the classic version.

Wow, good catch.  Again correct, thanks.

I have modified X3dToVrml97.xslt (which also supports 
X3dToClassicVrml.xslt) to handle this situation.

I've also begun updating the Excel spreadsheet where I keep track of 
node coverage for Schema, DOCTYPE, Tooltips, X3D-Edit, X3DOM, 
X3dToVrml97.xslt and Schematron coverage.

> 4. "CADPart Child Transformation Alternative A": same problem as 1.,
> Transform node is used inside CADFace. The comments inside say
>    "Developer scene to explore Mantis Issue 528 Alternative A for
> transformation of CADFace children: allow Transform node as child of
> CADFace."
> and links to member-only
> http://www.web3d.org/membership/login/mantis/view.php?id=528 . I guess
> you guys are working on it :) Either the testcase should be fixed, or
> the spec should be updated to allow Transform as child of CADFace in
> next X3D version. This example declares X3D 3.1 in the header.

Alternative A should work, it is the agreed-upon solution and is 
supported by DOCTYPE and DTD.

Actually I see that there is a problem with the draft X3D v3.3 
disposition document:  it does not include the update to allow Transform 
as child of CADFace, as specified in the Mantis bug 528.

*** Dick and Len, we need to address this, the change in Mantis appears 
to be omitted in the draft disposition document.

> I see that "CADPart Child Transformation Alternative B" and "CADPart
> Child Transformation Alternative C" are exploring other ideas for
> putting transformations inside.

Correct.  I made the warning/information meta tags more explicit that 
Alternative A is expected to work and validate, while the others are not.


> Everything else seems working perfectly :) I tested with view3dscene,
> simply opening the files in XML and classic encoding with view3dscene
> (from snapshots http://michalis.ii.uni.wroc.pl/castle-engine-snapshots/
> , since the CAD level 2 support in view3dscene is new).
> See X3D specification "CAD geometry component": for X3D 3.1:
> http://www.web3d.org/files/specifications/19775-1/V3.1/Part01/components/CADGeometry.html
> , for latest X3D 3.3:
> http://www.web3d.org/files/specifications/19775-1/V3.3/Part01/components/CADGeometry.html
> . I think that my comments above are true regardless of X3D spec version.


so I think that should resolve all of these comments.  your 
contributions are appreciated.

all the best, Don
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman

More information about the X3D-Public mailing list