model.view()
Create and manage views.
For views defined on the global level, under Results, omit component(<ctag>). from the syntax such as model.component(<ctag>).view().create(<vtag>,<gtag>) in the syntax examples below.
Syntax
model.component(<ctag>).view().create(<vtag>,<gtag>)
model.component(<ctag>).view().create(<vtag>,<viewdim>)
model.component(<ctag>).view().create(<vtag>,<gtag>,<workplane>)
model.component(<ctag>).view(<vtag>).set(<pname>,<pvalue>)
model.component(<ctag>).view(<vtag>).getType(<pname>)
 
model.component(<ctag>).view(<vtag>).axis().set(<pname>, <pvalue>)
model.component(<ctag>).view(<vtag>).axis().getType(<pname>)
model.component(<ctag>).view(<vtag>).camera().set(<pname>, <pvalue>)
model.component(<ctag>).view(<vtag>).camera().getType(<pname>)
model.component(<ctag>).view(<vtag>).copyToGeometry()
model.component(<ctag>).view(<vtag>).copyToWorkPlane()
model.component(<ctag>).view(<vtag>).geom()
model.component(<ctag>).view(<vtag>).getHiddenEntities()
model.component(<ctag>).view(<vtag>).getHiddenEntities(<mesh>)
model.component(<ctag>).view(<vtag>).getSDim()
model.component(<ctag>).view(<vtag>).isCurrent()
model.component(<ctag>).view(<vtag>).light().create(<ltag>, <ltype>)
model.component(<ctag>).view(<vtag>).light(<ltag>).set(<pname>, <pvalue>)
model.component(<ctag>).view(<vtag>).light(<ltag>).getType(<pname>)
model.component(<ctag>).view(<vtag>).hideObjects().create(<htag>)
model.component(<ctag>).view(<vtag>).hideObjects(<htag>).set(<pname>, <pvalue>)
model.component(<ctag>).view(<vtag>).hideObjects(<htag>).getType(<pname>)
model.component(<ctag>).view(<vtag>).hideEntities().create(<htag>)
model.component(<ctag>).view(<vtag>).hideEntities(<htag>).set(<pname>, <pvalue>)
model.component(<ctag>).view(<vtag>).hideEntities(<htag>).getType(<pname>)
model.component(<ctag>).view(<vtag>).hideEntities(<htag>).image()
model.component(<ctag>).view(<vtag>).hideMesh().create(<htag>)
model.component(<ctag>).view(<vtag>).hideMesh(<htag>).set(<pname>, <pvalue>)
model.component(<ctag>).view(<vtag>).hideMesh(<htag>).getType(<pname>)
model.component(<ctag>).view(<vtag>).hideMesh(<htag>).image()
Description
View Settings
model.component(<ctag>).view() returns a list of view that can be used when viewing geometry/mesh and plot groups. Each view has an axis and some properties on the top level. In 3D, a view also has a camera and a list of lights. All views also have a list of hide features.
model.component(<ctag>).view().create(<vtag>,<gtag>) creates a view tied to the geometry with the given tag. The dimension of the view is the same as the dimension for the geometry.
model.component(<ctag>).view().create(<vtag>,<viewdim>) creates a view with the given tag for the given dimension (1, 2, or 3). These views are not tied to any geometry and show up under the Views node under Results in the COMSOL Desktop.
model.component(<ctag>).view().create(<vtag>,<gtag>,<workplane>) creates a view tied to the work plane with the given tag in the geometry sequence with the given tag. The dimension of the view is 2.
model.component(<ctag>).view(<vtag>).set(<pname>,<pvalue>) sets the given property to the given value.
model.component(<ctag>).view(<vtag>).geom() returns the geometry sequence (or null for the views not associated with a geometry).
model.component(<ctag>).view(<vtag>).getSDim() returns the view’s space dimension.
model.component(<ctag>).view(<vtag>).getType(<pname>) returns the property with the given name of type Type.
Table 2-121: view properties
true | false
true | false
true | false
true | false
true | false
true | false
true | false
true | false
true | false
Axis Settings
The axis settings apply to 2D views with an x- and a y-axis.
model.component(<ctag>).view(<vtag>).axis().set(<pname>, <pvalue>) sets the given axis property to the given value. Which axis properties that are available in the different dimensions are given in the table below.
model.component(<ctag>).view(<vtag>).axis().getType(<pname>) returns the axis property with the given name.
Table 2-122: axis properties
The maximum x-coordinate.
The minimum y-coordinate.
The maximum y-coordinate.
The minimum z-coordinate.
The maximum z-coordinate.
Camera Settings
These settings apply to the camera for 3D views.
model.component(<ctag>).view(<vtag>).camera().set(<pname>, <pvalue>) sets the given camera property to the given value.
model.component(<ctag>).view(<vtag>).camera().getType(<pname>) returns the camera property with the given name.
Table 2-123: Camera properties
isotropic | anisotropic
true | false
Use automatic update of the view when viewscaletype is automatic.
Light Settings
These settings control the different types of lighting — direction light, spotlight, headlight, and point light — that you can add to a 3D view.
model.component(<ctag>).view(<vtag>).light().create(<ltag>,<ltype>) creates a light with the given tag and type. <ltype> can be any of 'DirectionalLight', 'PointLight', 'SpotLight', and 'HeadLight'.
model.component(<ctag>).view(<vtag>).light(<ltag>).set(<pname>,<pvalue>) sets the given light property to the given value. Different properties are available for the different types of lights according to the table below.
model.component(<ctag>).view(<vtag>).light(<ltag>).getType(<pname>) returns the light property with the given name.
Table 2-124: light properties
on | off
Hiding Geometry Objects, Geometric Entities, and Imported Meshes
model.component(<ctag>).view(<vtag>).hideObjects().create(<htag>) creates a hide feature of geometric objects in the geometry sequence. The API for controlling it is similar to the API for selection in the geometry sequence; see Geometry Object Selection Methods under model.geom().
model.component(<ctag>).view(<vtag>).hideEntities().create(<htag>) creates a hide feature of geometric entities in the analyzed geometry used, for example, for the physics. The API for controlling it is similar to the API for selections on the finalized geometry; see model.selection().
model.component(<ctag>).view(<vtag>).hideMesh().create(<htag>) creates a hide feature of geometric entities in the analyzed geometry from an imported mesh used, for example, for the physics. The API for controlling it is similar to the API for selections on the finalized geometry; see model.selection(). For example, the following code hides boundary 4 in the geometry based on the mesh in mesh1:
// Create mesh hide object in view 1
model.component("comp1").view("view1").hideMesh().create("hide1");
// Select mesh1
model.component("comp1").view("view1").hideMesh("hide1").mesh("mesh1");
// Hide boundary 4 (3D is assumed)
model.component("comp1").view("view1").hideMesh("hide1").geom(2).set(4);
model.component(<ctag>).view(<vtag>).getHiddenEntities() returns an integer array of hidden entities in each dimension. The entity numbers refer to the entities of the finalized geometry. model.component(<ctag>).view(<vtag>).getHiddenEntities(<mesh>) returns an integer array of hidden entities in each dimension. The entity numbers refer to the entities of specified meshing sequence with the tag <mesh> in its current state.
For plotting or exporting images of views with hidden objects, use the model.component(<ctag>).view(<vtag>).hideEntities(<htag>).image() and model.component(<ctag>).view(<vtag>).hideMesh(<htag>).image() methods. See Plotting and Exporting Images.
Copying Views
To copy a view to a geometry or work plane, you can use the copyToGeometry and copyToWorkPlane methods. For example,
model.component("comp1").view("view1").copyToWorkPlane();
copies the view view1 to a work plane.
Clipping Tool Settings
These settings control the different types of clipping tools — clip plane, clip box, clip sphere, and clip cylinder — that you can add to a 3D view.
model.component(<ctag>).view(<vtag>).clip().create(<ctag>,<ctype>) creates clipping tool with the given tag and type. <ctype> can be any of 'ClipPlane', 'ClipBox', 'ClipSphere', and 'ClipCylinder'.
model.component(<ctag>).view(<vtag>).clip(<ctag>).set(<pname>,<pvalue>) sets the given clipping tool property to the given value. Different properties are available for the different types of clipping tools according to the table below.
model.component(<ctag>).view(<vtag>).clip(<ctag>).getType(<pname>) returns the clipping tool property with the given name.
true | false
Set to false to disable the clipping action for the clipping tools.
true | false
true | false
true | false
true | false
custom | fromtheme | black | blue | cyan | gray | green | magenta | red | white | yellow | none
The coloring of the intersection highlight, if cliphighlightintersection is set to true.
true | false
true | false
true | false
The following table lists the properties available for the clipping tools. Properties that are not available for all clipping tools have a note about availability in the Description column.
true | false
Set to false to disable the clipping action for the clipping tools.
true | false
true | false
true | false
The radius of the clipping tool. For ClipSphere and ClipCylinder only.
true | false
true | false
Environment Mapping Settings
These settings control the environment mapping that can provide reflections on the model geometry and as a skybox to provide a background in the view. You add environment mapping by specifying one of the built- in environment maps (images), such as envmap_park2:
 model.component(<ctag>).view(<vtag>).set("environmentmap", "envmap_park2") adds an environment map that shows a city park. To see its reflection on a model geometry you need to clear any selections and also activate the setting for showing material color and texture: model.component(<ctag>).view(<vtag>).set("showmaterial", true);.
The environment map to use. Use none to turn off environment mapping.
low | medium | high | ultra
true | false
true | false
true | false
The blending of the skybox, if skybox is set to true. 1 means no blending.
The blurriness of the skybox, if skybox is set to true. 0 means no blurriness.
Skybox field of view, in degrees, if skyboxprojection is set to special.
special | fromcamera
The skybox projection, if skybox is set to true. With fromcamera. the camera’s projection is used.
positivex | negativex | positivey | negativey | positivez | negativez
skyrotationzero | skyrotationninety | skyrotationhundredeighty | skyrotationtwohundredseventy
See Also
model.result()