General Commands > About General Commands > model.view()

model.view()
Create and manage views.
Syntax
model.view().create(<vtag>,<gtag>)
model.view().create(<vtag>,<viewdim>)
model.view().create(<vtag>,<gtag>,<workplane>)
model.view(<vtag>).set(<pname>,<pvalue>)
model.view(<vtag>).getType(<pname>)
 
model.view(<vtag>).axis().set(<pname>, <pvalue>)
model.view(<vtag>).axis().getType(<pname>)
model.view(<vtag>).camera().set(<pname>, <pvalue>)
model.view(<vtag>).camera().getType(<pname>)
model.view(<vtag>).light().create(<ltag>, <ltype>)
model.view(<vtag>).light(<ltag>).set(<pname>, <pvalue>)
model.view(<vtag>).light(<ltag>).getType(<pname>)
model.view(<vtag>).hideObjects().create(<htag>)
model.view(<vtag>).hideObjects(<htag>).set(<pname>, <pvalue>)
model.view(<vtag>).hideObjects(<htag>).getType(<pname>)
model.view(<vtag>).hideEntities().create(<htag>)
model.view(<vtag>).hideEntities(<htag>).set(<pname>, <pvalue>)
model.view(<vtag>).hideEntities(<htag>).getType(<pname>)
model.view(<vtag>).hideMesh().create(<htag>)
model.view(<vtag>).hideMesh(<htag>).set(<pname>, <pvalue>)
model.view(<vtag>).hideMesh(<htag>).getType(<pname>)
Description
View Settings
model.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.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.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.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.view(<vtag>).set(<pname>,<pvalue>) sets the given property to the given value.
model.view(<vtag>).getType(<pname>) returns the property with the given name of type Type.
Table 2-80: view properties
Axis Settings
The axis settings apply to 2D views with an x- and a y-axis.
model.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.view(<vtag>).axis().getType(<pname>) returns the axis property with the given name.
Table 2-81: 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.view(<vtag>).camera().set(<pname>, <pvalue>) sets the given camera property to the given value.
model.view(<vtag>).camera().getType(<pname>) returns the camera property with the given name.
Table 2-82: Camera properties
Light Settings
These settings control the different types of lighting — direction light, spotlight, head light, and point light — that you can add to a 3D view.
model.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.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.view(<vtag>).light(<ltag>).getType(<pname>) returns the light property with the given name.
Table 2-83: light properties
Hiding Geometry Objects, Geometric Entities, and Imported Meshes
model.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.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.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.view("view1").hideMesh().create("hide1");
// Select mesh1
model.view("view1").hideMesh("hide1").mesh("mesh1");
// Hide boundary 4 (3D is assumed)
model.view("view1").hideMesh("hide1").geom(2).set(4);
See Also
model.result()