30
5.2.2. Wrapping Shape Objects with Transforms
CAD tools export parts into VRML as individual shapes using various VRML
object types. It is for instance possible to use a VRML Shape node or Inline
mechanism. In order to be able to control part positions / orientations, we
need to wrap each such Shape or Inline node by a node that allows changing
these properties. It is a Transform node, whose purpose is to transform
coordinates of its children. For instance, after wrapping by a Transform node,
such Inline node will look like this:
Transform {
children [
Inline {
url ["robot_arm1.wrl"]
}
]
}
In order to be able to place the whole assembly to the right initial position in
the virtual scene, it is always good to wrap all parts of the assembly by an
additional Transform node.
5.2.3. Adding DEF Names
CAD export filters often export objects with no names, or with synthetic, non-
descriptive names. In order to be accessible from MATLAB, each VRML object
needs to be given a unique name in the VRML file. This is achieved by adding a
“DEF Object_Name” statement to the Transform line. After adding the DEF
name, robot arm1 definition in the main VRML file looks like this:
DEF Robot_Arm1 Transform {
children [
Inline {
url ["robot_arm1.wrl"]
}
]
}
These object names are used in Simulink 3D Animation functions and user
interface. For instance, they appear as descriptions of inputs to VR Sink block.
Therefore, it is good to give the parts descriptive names that help us with
orientation in the object hierarchy.
Kommentare zu diesen Handbüchern