Documentation

修改CAD模型虚拟世界

To modify the results of CAD tool export filters manually, you can use the 3D World Editor or other editor. For example, you can compose the converted model into an urban or manufacturing environment, or add objects such as viewpoints, backgrounds, and lights before using them in金宝app®3D Animation™virtual worlds. Typically, adjusting exported files manually in an editor involves several modifications.

Wrap Shape Objects with Transforms

CAD tools export parts into VRML or X3D as individual shapes using various object types such asShape要么Inline节点。控制部分位置和方向,包装Shape要么Inlinenode with a node that allows for the changing of these properties. This wrapping node is the转变节点,它将孩子的坐标转换。例如,用a包装后转变节点,anInlinenode has syntax similar to this syntax:

转变{ children [ Inline { url ["robot_arm1.wrl"] } ] }

To set the initial location of the entire assembly in the virtual world, consider wrapping all parts of the assembly with an additional转变node.

Add DEF Names

CAD export filters often export objects with no names or with synthetic nondescriptive names. To make export objects accessible in MATLAB®,将每个虚拟世界对象在虚拟世界3D文件中获取唯一名称。例如,通过添加一个来命名对象def object_name.statement to the转变line. After adding thedef object_name.,Robot_Arm1definition in the main virtual world 3D file has the syntax similar to this syntax:

DEF Robot_Arm1 Transform { children [ Inline { url ["robot_arm1.wrl"] } ] }

The金宝appSimulink 3D动画functions and in the user interface (such as the descriptions of inputs to theVR Sink块)使用这些对象名称。为了帮助管理对象层次结构中的方向,请给出零件描述性名称。

Note

有时,有必要通过CAD工具导出筛选器纠正文件中引入的错误。由于VRML和X3D格式是由ISO编码的基于文本的格式®标准,这些错误相对容易识别和正确。如果在使用导出的VRML或X3D文件时出现问题金宝appSimulink 3D动画software, consultMathWorks technical support.

Additional Virtual World Modifications

To work with the virtual world effectively, you can make additional modifications to the scene file using a virtual world editor. Make these changes on an ongoing basis, in parallel with developing and using the dynamic model.

  • 通过添加一个场景标题WorldInfo具有场景标题的节点。金宝appSimulink 3D动画software uses the title as the virtual world description.

  • Enhance the scene.

    • Add theBackground定义彩色背景的节点模拟地面和天空,以及可选的背景纹理,例如场景的Panoramas。

    • 添加场景环境。该步骤对机器组件中的部件之间的相互作用的可视化来说并不至关重要,但对于模拟的可视化是重要的。例如,对于飞机和车辆动态,一个物体相对于其操作的场景的位置很重要。添加场景周围环境提供上下文。

      例如,为了可视化车辆动态,将虚拟汽车放在虚拟道路上。使对象缩放(汽车和道路模型中的长度单位必须匹配)。将汽车相对于道路放置在适当的位置。通过定义相应的字段,在场景中设置适当的汽车缩放,放置和方向转变节点主对象(见Wrap Shape Objects with Transforms).

  • Configure scene display and navigation.

    • Add several viewpoints to be able to observe the object conveniently from different positions. The viewpoints can be static or moving. Define a static viewpoint as an independent object at the top level of the scene hierarchy. To create a moving viewpoint, attached a viewpoint to objects that move in the scene during simulation. Such viewpoints are defined as siblings of moving objects in the scene hierarchy. For an example of a viewpoint moving with the object, see the viewpointRide on the Plane在里面金宝appSimulink 3D动画vrtkoff.wrl.例子。

    • Illuminate a scene by adding lights to it. Although virtual world viewers always have a headlight available, consider defining lights in the scene so that it looks the same for everyone. The most useful type of light to illuminate a whole scene is theDirectionalLightnode. To illuminate objects from several directions, consider using a combination of several such lights.

    • Add theNavigationInfo.node defining the scene default navigation speed and avatar size that ensures correct display of the object from near and far distances.

For an example of a complete scene definition, see theoctavia_scene.wrl文件的一部分金宝appSimulink 3D动画vr_octavia例子。

相关话题