A viewport defines a rectangular frame (or canvas) which is used to display objects in 3D space. Viewport is platform-dependent and thus specific to each front-end. There is also a special type of viewport – ModelPrs_OffscreenViewPort which can be used for offscreen rendering.
The following table describes interactive operations, supported "out of the box" and corresponding default controls:
Action | Mouse + Keyboard combination | Touch combination |
---|---|---|
Selection | Left Mouse Button | Tap |
Batch selection | Ctrl + Left Mouse Button | Not supported |
Rotation | Left Mouse Button and drag | Touch and drag |
Zoom | Wheel +/- | Pinch open and closed |
Pan | Ctrl + Left Mouse Button and drag | Double touch and drag |
Creating and initializing viewport is platform-specific. A scene may own a single viewport only.
The following code snippets demonstrate creating various supported viewport types. Note that any viewport object must be attached to a scene using AttachToScene() method available for each viewport type.
The following example demonstrates usage of QML component:
The following code snippet demonstrates how to do it:
This code example demonstrates how to attach QML Viewport item to Scene:
Where viewPort is a name of ModelPrsQtQuick_ViewPort item in your QML code.
Refer to Basic Viewer Example.
Here you can see how you can use ModelPrsWPF_ViewPort in your Xaml file:
Don't forget to attach it to the scene in your cs file:
Where myViewPort is a name of the ModelPrsWPF_ViewPort item in your Xaml code.
Refer to Basic Viewer Example.
You can go the alternative way with .NET Framework. This example demonstrates how to use the Windows Forms component.
Create ModelPrsWinForms_ViewPort in your Designer.cs file (or in simple .cs file):
The same code to attach to the scene:
Where myViewPort is a name of the ModelPrsWinForms_ViewPort item in your Designer.cs file (or in simple .cs file).
Refer to Basic Viewer Example.
The C++ ModelPrs_OffscreenViewPort class provides a viewport that can be used for offscreen rendering.
Refer to Offscreen Rendering Example.
A 3D view provides the following settings that can be customized:
Refer to Customized Viewer Example for demonstration of applying user-defined settings.
A viewcube is an interactive control that allows to switch between standard view camera positions (front, left, top, etc).
The viewcube provides 26 sensitive areas: 6 faces, 12 edges, 8 corners. Selecting each area activates smooth transition of the camera to its new position:
The viewcube appearance can be customized:
Refer to Customized Viewer Example.
A manipulator is an interactive control that allows to move and rotate scene nodes using a mouse.
The manipulator provides two supported types of transformations: rotation and translation. There are 3 axes to rotate around and 3 axes to translate along. In total, there are 6 sensitive areas for this control.
The manipulator has two non-interactive auxiliary objects: the ruler and protractor. They appear when a transformation is active. Their purpose is to designate the starting position and to measure the current displacement of the scene node with respect to that starting position.
Refer to Manipulator Example for demonstration manipulator usage.
CAD Exchanger SDK provides an ability to display graphical PMI elements (see Product and Manufacturing Information (PMI)).
Refer to PMI Viewer Example
For measurement purposes, you can use ModelPrs_MeasurementFactory.
There are 5 supported types of measurements:
All of the above can be displayed in a viewport. Besides, you can customize units, footnote size, color.
Refer to Measurements Example
The exploded view helps you to explore complex multi-component assemblies. You need just set explosion value and visual objects will change their position so that you can to see a model parts separated by distance.
Refer to Exploder Example
To be added.