[x3d-public] How should CAD -shape containerField be expressed in X3DJSAIL

Roy Walmsley roy.walmsley at ntlworld.com
Tue Feb 21 05:22:32 PST 2017


John,

 

JSON, just like the VRML encoding, does not need containerField. This is because the child content is listed below the specific field that contains it. So, for example, consider a CADFace listing from the JSON file you attached:

 

{ "CADFace":

  {

    "@name":"outerSurface",

    "-shape":

      { "Shape":

        {

          "-children":[

            { "#comment":"note solid='true' and so one-sided external rendering only"

            }

          ],

          "-geometry":

            { "Cylinder":

              {

                "@bottom":false,

                "@height":3,

                "@radius":2,

                "@top":false

              }

            },

          "-appearance":

            { "Appearance":

              {

                "@DEF":"AppearanceGrey",

                "-material":

                  { "Material":

                    {

                    }

                  }

              }

            }

        }

      }

  }

}

 

The CADFace node has the value of two fields specified. The first is the “name” field, with the value “outerSurface”. The second is the “shape” field, with the value being the “Shape” node.

 

How does this appear in the XML encoding? It is :

 

<CADFace name="outerSurface">

  <Shape containerField="shape"><!--note solid='true' and so one-sided external rendering only-->

    <Cylinder containerField="geometry" bottom="false" height="3" radius="2" top="false"></Cylinder>

    <Appearance containerField="appearance" DEF="AppearanceGrey">

      <Material containerField="material"></Material>

    </Appearance>

  </Shape>

</CADFace> 

 

So could have been written as follows:

 

<CADFace name="outerSurface">

  <Shape><!--note solid='true' and so one-sided external rendering only-->

    <Cylinder bottom="false" height="3" radius="2" top="false"></Cylinder>

    <Appearance DEF="AppearanceGrey">

      <Material></Material>

    </Appearance>

  </Shape>

</CADFace> 

 

Notice that the “containerField” attributes have all been deleted. This might well fail to load. Why? Because, reference to the XML schema shows that the default value of “containerField” for the “Shape” node is “children”. However, CADFace does not have a “children” field. So, it is necessary to specify somehow which field the “Shape” node should be assigned to. Hence the “containerField” attribute.

 

In summary, in the X3D standard 19775-1 there is no “containerField”. In the ClassicVRML encoding 19776-2 there is no “containerField”. In the JSON encoding 19776-5 there is no “containerField”. It is, however, in the XML encoding 19776-1. This is the only text encoding that it appears in. Note that it would not be expected to be included in an implementation.  That is because, on loading into memory, and having created an instance of the “CADFace” node, the reading of the “Shape” node would create that instance, and then store the reference to it in the “shape” field of the “CADFace” node. So it is only required by the XML loader to determine which node field to add the child node reference to.

 

All the best,

 

Roy

 

 

From: yottzumm at gmail.com [mailto:yottzumm at gmail.com] 
Sent: 21 February 2017 06:38
To: Don Brutzman <brutzman at nps.edu>; Roy Walmsley <roy.walmsley at ntlworld.com>; X3D Graphics public mailing list <x3d-public at web3d.org>
Subject: How should CAD -shape containerField be expressed in X3DJSAIL

 

Attached input JSON and converted Java.  The Java does not produce -shape in the output JSON.json file [ not provided—compile and run the Java ].  Is this OK?  I am currently using setShape in the Java.  Why doesn’t the JSON.json have the containerField?  Thanks!

 

John

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170221/acf2bd2f/attachment-0001.html>


More information about the x3d-public mailing list