Add virtual reality visualization framework to block diagrams


vrphysmod(vrmlfile, model)
vrphysmod(vrmlfile, subsystem)


vrphysmod(vrmlfile, model) or vrphysmod(vrmlfile, subsystem) updates the model or subsystem that the SimMechanics™ mech_import function generates.

The model must be on the MATLAB® path or already open prior to calling the vrphysmod function.

As necessary, vrphysmod adds additional blocks to visualize the mechanical system in virtual reality. You can then save, rename, modify, and run the model. The .wrl extension for vrmlfile is optional. The association between mechanical system bodies and corresponding VRML nodes found in the VRML file is based on the name correspondence.

If your model contains several VR Sink blocks that refer to the same vrmlfile, this function attempts to consolidate the animation signals of that virtual scene into one VR Sink block.

    Note:   The SolidWorks® VRML export filter does not preserve part instance names and the part order in the resulting VRML file. Therefore, the association between such parts and the corresponding bodies in the block diagram is not always an exact match. In such cases, the function identifies nodes with partial matches and issues warnings. To prevent these warnings, ensure that node DEF names in the VRML file are identical to their corresponding bodies in the Simulink® model before running this function.

    If you receive this warning and the set of VRML files does not originate in the SolidWorks product, ignore the message. Other supported CAD tools also generate part names with similar names, but preserve them across different export formats.


To update the model four_link using the VRML file four_link.wrl:

vrphysmod('four_link.wrl', 'four_link');

To update the subsystem four_link/FOURLINK_ASM using the VRML file four_link.wrl, ensure that the model that contains the subsystem is open, then:

vrphysmod('four_link.wrl', 'four_link/FOURLINK_ASM');

To update the current system using the VRML file four_link.wrl:

vrphysmod('four_link.wrl', gcs);
Was this topic helpful?