Import
Import mesh from a file, from another meshing sequence, from a geometry sequence, or from a Filter (Dataset) or Partition dataset. You can import a mesh from a COMSOL Multiphysics file and Sectionwise file. In 3D, you can also import meshes from 3MF, NASTRAN, PLY, STL, and VRML files. In 2D, you can also import meshes from NASTRAN (the third coordinate must then be the same for all mesh points) and COMSOL’s native formats.
Use a Transform attribute to position, rotate, or scale an imported mesh.
Syntax
model.component(<ctag>).mesh(<tag>).create(<ftag>,"Import");
model.component(<ctag>).mesh(<tag>).feature(<ftag>).set(property,<value>);
model.component(<ctag>).mesh(<tag>).feature(<ftag>).getType(property);
model.component(<ctag>).mesh(<tag>).feature(<ftag>).importData();
Description
Use model.component(<ctag>).mesh(<tag>).create(<ftag>,"Import") to import a mesh into a meshing sequence that defines its own geometrical model. See the section Geometric Model for more information. If the sequence already contains a mesh, the imported mesh is added to the existing mesh.
Use model.component(<ctag>).mesh(<tag>).feature(<ftag>).importData() to import the file again.
The following mesh formats are supported:
.nas | .bdf | .dat
.wrl | .vrml
The available properties are listed in the tables below. Table 4-2 lists properties common for many of the import sources:
3mf | file | geom | sequence | dataset | nastran | native | ply | stl | vrml | sectionwise
Source for the import. The value file specifies any supported file type. The value native specifies COMSOL Multiphysics file import.
auto | minimal | detectfaces | manual
Boundary partitioning algorithm. detectfaces is only available in 3D, and manual is only available in 2D. Available when source is native, nastran, stl, sectionwise, ply, 3mf, vrml, and dataset.
Specify the filename when source is file, native, nastran, stl, sectionwise, ply, or 3mf.
The following tables list additional properties depending on which source property is used.
on | off
all | mesh
on | off
on | off
on | off
on | off
on | off
on | off
Absolute tolerance for STL import, when stltoltype is set to absolute.
Positive scalar, 1.0 or smaller
Relative tolerance for STL import, when stltoltype is set to relative.
auto | relative | absolute
on | off
on | off
on | off
on | off
on | off
Import mesh selections when source is native or dataset.
on | off
Specifies if source mesh is automatically rebuilt and imported when source is sequence. Default is on when sequence specifies a mesh part and off for other meshing sequences.
on | off
on | off
fine | normal | coarse
none | String
freetri | visualization
Specifies the predefined element size to use when meshtype is freetri. 1 is the finest and 9 is the coarsest predefined size setting.
on | off
Properties for STL File Import
The properties stltolabs, stltolrel, stltoltype, and selectionstl are only used for import of STL files. If selectionstl is active, the following tags are assigned to the created selections:
If it is unnamed, it gets the tag sel + the number of the unnamed selection (started with 1). If there is only one selection and it is unnamed, the tag is just sel.
The tags of the imported selections can also be obtained by calling the outputSelection() function on the mesh import feature.
The tag of the model selection becomes <meshing sequence tag>_<import node tag>_<selection tag>, such as mesh1_imp1_sel.
Properties for Meshing Sequence Import
The property buildsource is only used when source is sequence. If buildsource is active, the source sequence is always built and the current version of the source mesh is imported. This is required when running a parametric sweep that influences the source meshing sequence. If the property is deactivated, run the method importData() to manually build and reimport the source mesh sequence.
Properties for NASTRAN File Import
The properties linearelem, materialsplit, and data are only used for import of NASTRAN files. The properties selcreation and allowshellpartition are only used when materialsplit is on.
Additional Properties
linearelem specifies if the elements in the NASTRAN or COMSOL Multiphysics file are imported as linear elements. If the value is on all imported elements are linear. Otherwise, the order of the imported elements is determined from the order of the elements in the file. The default value is off.
materialsplit determines if material data in the file is used (if available) to determine the domain partitioning of the domain elements. If the value is off all domain elements in the imported mesh belongs to the same domain if possible. The default value is off.
If you set facepartition to minimal, the operation keeps the original partition from the file (if any), adding minimal partitioning in order to satisfy topological requirements.
If you set facepartition to manual, you can use the following properties. If you set any of these properties without setting facepartition to manual, the operation automatically switches facepartition to manual.
on | off
The following properties are available in 3D when facepartition is set to detectfaces:
on | off
on | off
on | off
on | off
auto | relative | absolute
Minimum absolute edge length, if minlengthtype = absolute.
The table below specifies the properties for selections imported when source is file, stl, or dataset.
Default values in the arrays are based on the names of the selections in the source. The length of the array can be determined by using
model.component(<ctag>).mesh(<tag>).feature(<ftag>).getStringArray(property).length;
If no selection of a certain dimension is imported, the length of the corresponding array is 0.
The values of the selection properties can be set using individual names accompanied by an index between 0 and length-1
model.component(<ctag>).mesh(<tag>).feature(<ftag>).setIndex(property,<nname>,<index>);
where <nname> is the new name for the selection on place <index> in the property array. An alternative is to set the entire string array at once
model.component(<ctag>).mesh(<tag>).feature(<ftag>).set(property,<narray>);
where <narray> is a new array of strings of correct length.
Values in each of the string arrays must be unique, while different string arrays may contain the same value. Values in the string arrays must be nonempty.
The table below specifies the supported NASTRAN bulk data entries.
The RBE entries (RBE2 and RBE3) define a fixed point and one or several dependent points (For RBE3, only the first set of dependent points is taken). Dependent points that are second-order points are ignored. A point selection is created for the fixed points of each RBE entry. In addition, a selection of each entity level may be created for each RBE entry in such a way that each mesh element, whose all first-order vertices are dependent points for the RBE entry, is part of the selection. If a dependent point selection associated with a RBE entry is not empty, the fixed point is also added to the selection.
The NASTRAN bulk data format uses reduced second-order elements; that is, the center node on quadrilateral mesh faces (quadNode) and the center node of hexahedral elements (hexNode) are missing. Importing a NASTRAN mesh with second-order elements, COMSOL Multiphysics interpolates the coordinates of these missing node points from the surrounding node points using the following formulas: quadNode = 0.5*quadEdgeNodes - 0.25*quadCornerNodes, where quadEdgeNodes is the sum of the coordinates of the surrounding 4 edge nodes and quadCornerNodes is the sum of the coordinates of the surrounding 4 corner nodes, and hexNode = 0.25*hexEdgeNodes-0.25*hexCornerNodes, where hexEdgeNodes is the sum of the coordinates of the surrounding 12 edge nodes and hexCornerNodes is the sum of the coordinates of the surrounding 8 corner nodes.
The Import feature does not handle NASTRAN files in free field format where the data fields are separated by blanks.
Compatibility
The source property value stlvrml has been replaced by separate stl and vrml values in version 5.5. The value stlvrml is also accepted for backward compatibility. If a filename is given and it ends with .vrml, source is then set to vrml. Otherwise, source is set to stl.
The elemsplit property from earlier versions is no longer available from version 5.3.
For 3D meshing sequences, the setting manual of the property facepartition in the mesh Import feature, as well as all the properties associated with this setting, are deprecated as of COMSOL 5.1 and may be removed in a future version. In COMSOL 5.1, these properties are still available with unchanged behavior for backward compatibility.
See Also
Transform, Ball, Box, CreateVertices, DeleteEntities, DetectFaces, JoinEntities, LogicalExpression, Filter (Dataset), Partition