Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views104 pages

CADImport Module Users Guide

hhhh comsol

Uploaded by

hezongganggang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views104 pages

CADImport Module Users Guide

hhhh comsol

Uploaded by

hezongganggang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 104

CAD Import Module

User’s Guide
CAD Import Module User’s Guide
© 2005–2021 COMSOL
Protected by patents listed on www.comsol.com/patents, and U.S. Patents 7,519,518; 7,596,474;
7,623,991; 8,457,932;; 9,098,106; 9,146,652; 9,323,503; 9,372,673; 9,454,625, 10,019,544,
10,650,177; 10,776,541, and 11,030,365. Patents pending.
This Documentation and the Programs described herein are furnished under the COMSOL Software License
Agreement (www.comsol.com/comsol-license-agreement) and may be used or copied only under the terms
of the license agreement. Portions of this software are owned by Siemens Product Lifecycle Management
Software Inc. © 1986–2021. All Rights Reserved. Portions of this software are owned by Spatial Corp. ©
1989–2021. All Rights Reserved.
COMSOL, the COMSOL logo, COMSOL Multiphysics, COMSOL Desktop, COMSOL Compiler,
COMSOL Server, and LiveLink are either registered trademarks or trademarks of COMSOL AB. ACIS and
SAT are registered trademarks of Spatial Corporation. CATIA is a registered trademark of Dassault Systèmes
or its subsidiaries in the US and/or other countries. Parasolid is a trademark or registered trademark of
Siemens Product Lifecycle Management Software Inc. or its subsidiaries in the United States and in other
countries. All other trademarks are the property of their respective owners, and COMSOL AB and its
subsidiaries and products are not affiliated with, endorsed by, sponsored by, or supported by those or the
above non-COMSOL trademark owners. For a list of such trademark owners, see www.comsol.com/
trademarks.
Version: COMSOL 6.0

Contact Information
Visit the Contact COMSOL page at www.comsol.com/contact to submit general inquiries
or search for an address and phone number. You can also visit the Worldwide Sales Offices
page at www.comsol.com/contact/offices for address and contact information.

If you need to contact Support, an online request form is located at the COMSOL Access
page at www.comsol.com/support/case. Other useful links include:

• Support Center: www.comsol.com/support


• Product Download: www.comsol.com/product-download
• Product Updates: www.comsol.com/support/updates
• COMSOL Blog: www.comsol.com/blogs
• Discussion Forum: www.comsol.com/forum
• Events: www.comsol.com/events
• COMSOL Video Gallery: www.comsol.com/videos
• Support Knowledge Base: www.comsol.com/support/knowledgebase

Part number: CM020301


C o n t e n t s

Chapter 1: Introduction

About the CAD Import Module 8


Overview of the Included Geometry Tools and Features. . . . . . . . 8
Overview of the User’s Guide . . . . . . . . . . . . . . . . . . 10
Where Do I Access the Documentation and Application Libraries? . . . . 10

Chapter 2: Geometry Tools and Features

Geometry Representation 16
Working with the CAD Kernel . . . . . . . . . . . . . . . . . 16
Converting Objects to COMSOL Kernel Representation . . . . . . . 17
Converting Objects to CAD Kernel Representation . . . . . . . . . 18

Importing and Exporting CAD Files 20


Importing 3D CAD Files . . . . . . . . . . . . . . . . . . . . 20
Exporting Objects to 3D CAD Formats . . . . . . . . . . . . . . 25

Using the Defeaturing Tools 27


Finding and Deleting Small Details . . . . . . . . . . . . . . . . 27
Delete Faces . . . . . . . . . . . . . . . . . . . . . . . . 28
Detach Faces . . . . . . . . . . . . . . . . . . . . . . . . 28
Detect Interferences . . . . . . . . . . . . . . . . . . . . . 29

Geometry Features 32
Cap Faces . . . . . . . . . . . . . . . . . . . . . . . . . 32
Check . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Delete Faces . . . . . . . . . . . . . . . . . . . . . . . . 34
Delete Fillets . . . . . . . . . . . . . . . . . . . . . . . . 35
Delete Holes . . . . . . . . . . . . . . . . . . . . . . . . 37
Delete Short Edges . . . . . . . . . . . . . . . . . . . . . . 38
Delete Sliver Faces . . . . . . . . . . . . . . . . . . . . . . 39

CONTENTS |3
Delete Small Faces . . . . . . . . . . . . . . . . . . . . . . 40
Delete Spikes . . . . . . . . . . . . . . . . . . . . . . . . 41
Detach Faces . . . . . . . . . . . . . . . . . . . . . . . . 43
Knit to Solid . . . . . . . . . . . . . . . . . . . . . . . . 44
Projection . . . . . . . . . . . . . . . . . . . . . . . . . 45
Repair . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Chapter 3: Programming and Command Reference

Defeaturing Tools 52
Defeaturing Tools — Finding and Deleting Small Details . . . . . . . . 52
Defeaturing Tools — Delete Faces . . . . . . . . . . . . . . . . 55
Defeaturing Tools — Detach Faces . . . . . . . . . . . . . . . . 56
Defeaturing Tools — Detect Interferences . . . . . . . . . . . . . 56

Summary of Commands 58

Commands Grouped by Function 59

Commands in Alphabetical Order 61


CapFaces . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Check . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
ConvertToCOMSOL . . . . . . . . . . . . . . . . . . . . . 63
DeleteFaces . . . . . . . . . . . . . . . . . . . . . . . . . 64
DeleteFillets . . . . . . . . . . . . . . . . . . . . . . . . 66
DeleteHoles . . . . . . . . . . . . . . . . . . . . . . . . 68
DeleteShortEdges . . . . . . . . . . . . . . . . . . . . . . 71
DeleteSliverFaces. . . . . . . . . . . . . . . . . . . . . . . 74
DeleteSmallFaces . . . . . . . . . . . . . . . . . . . . . . . 77
DeleteSpikes . . . . . . . . . . . . . . . . . . . . . . . . 79
DetachFaces . . . . . . . . . . . . . . . . . . . . . . . . 82
DetectInterferences. . . . . . . . . . . . . . . . . . . . . . 85
Export, ExportFinal . . . . . . . . . . . . . . . . . . . . . . 85
Import 3D CAD . . . . . . . . . . . . . . . . . . . . . . . 87
Knit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Projection . . . . . . . . . . . . . . . . . . . . . . . . . 97

4 | CONTENTS
Repair . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

CONTENTS |5
6 | CONTENTS
1

Introduction

Welcome to the CAD Import Module User’s Guide. This guide details the
functionality of this optional package that extends the COMSOL Multiphysics®
modeling environment with additional tools and features to import, repair,
defeature, and export geometry using the most common 3D CAD file formats.

This introductory chapter contains an overview of the capabilities of the module,


including a summary of the included geometry features, an overview of this guide,
and a description of where to find documentation and model examples.

7
About the CAD Import Module
Overview of the Included Geometry Tools and Features
The CAD Import Module enables importing 3D designs from CAD files into your
simulations. The import capabilities cover the most common 3D CAD file formats: ACIS ®,
AutoCAD®, IGES, Inventor ®, NX ®, Parasolid ®, PTC® Creo® Parametric™, PTC®
Pro/ENGINEER®, SOLIDWORKS®, and STEP. In addition, support for CATIA® V5 is
available as a separate add-on. To exchange data with CAD packages, you can export your
geometry to the ACIS ®, IGES, Parasolid ®, and STEP file formats.

Finally, the product provides a wide range of tools for you to prepare an imported 3D design
for meshing and analysis. You can interactively search for and remove geometric features, for
example, fillets, holes, slivers, small faces, and short edges. You can also modify objects by
detaching a portion to form an additional computational domain, or by creating a fluid
domain for computation, in case the CAD design only includes the solid parts.

GEOMETRY FEATURE ICON DESCRIPTION

2D Geometry Features

Projection Project 3D objects and entities to a work plane

3D Geometry Features

Cap Faces Generate faces from edges to fill gaps and create
solid objects, or to partition solids

Check Check CAD objects for faults

Convert to COMSOL Convert to the COMSOL kernel representation

Delete Faces Delete and replace faces

Delete Fillets Find and delete fillets

Delete Holes Find and delete holes

Delete Short Edges Find and delete short edges

Delete Sliver Faces Find and delete sliver faces

Delete Small Faces Find and delete small faces

8 | CHAPTER 1: INTRODUCTION
GEOMETRY FEATURE ICON DESCRIPTION

Delete Spikes Find and delete spikes from faces

Detach Faces Detach faces and form a new object from them

Detect Interferences Find interferences, such as intersections, gaps,


touches and containments, between objects

Export Export geometry objects to 3D CAD file formats

Import Import geometry objects from 3D CAD file


formats

Knit to Solid Knit surface objects to form solid or surface


object

Repair Repair and removal of small details

ABOUT THE CAD IMPORT MODULE | 9


Overview of the User’s Guide
This documentation covers the CAD Import Module and the add-on for file import of
CATIA® V5 files. Instructions on how to use the geometry modeling tools in COMSOL
Multiphysics® in general are included with the COMSOL Multiphysics Reference Manual.
To help you get started with modeling this module is also accompanied by the quick-start
guide Introduction to CAD Import Module.

Where Do I Access the Documentation and Application Libraries?


A number of internet resources have more information about COMSOL, including licensing
and technical information. The electronic documentation, topic-based (or context-based)
help, and the application libraries are all accessed through the COMSOL Desktop.

If you are reading the documentation as a PDF file on your computer, the
blue links do not work to open an application or content referenced in a
different guide. However, if you are using the Help system in COMSOL
Multiphysics, these links work to other modules (as long as you have a
license), application examples, and documentation sets.

THE DOCUMENTATION AND ONLINE HELP


The COMSOL Multiphysics Reference Manual describes all core physics interfaces and
functionality included with the COMSOL Multiphysics license. This book also has
instructions about how to use COMSOL Multiphysics and how to access the electronic
Documentation and Help content.

Opening Topic-Based Help


The Help window is useful as it is connected to many of the features on the GUI. To learn
more about a node in the Model Builder, or a window on the Desktop, click to highlight a
node or window, then press F1 to open the Help window, which then displays information

10 | CHAPTER 1: INTRODUCTION
about that feature (or click a node in the Model Builder followed by the Help button ( ).
This is called topic-based (or context) help.

To open the Help window:

• In the Model Builder, Application Builder, or Physics Builder click a node or


window and then press F1.
• On any toolbar (for example, Home, Definitions, or Geometry), hover the
mouse over a button (for example, Add Physics or Build All) and then
press F1.
• From the File menu, click Help ( ).
• In the upper-right corner of the COMSOL Desktop, click the Help( )
button.

To open the Help window:

• In the Model Builder or Physics Builder click a node or window and then
press F1.
• On the main toolbar, click the Help ( ) button.
• From the main menu, select Help>Help.

ABOUT THE CAD IMPORT MODULE | 11


Opening the Documentation Window

To open the Documentation window:

• Press Ctrl+F1.
• From the File menu select Help>Documentation ( ).

To open the Documentation window:

• Press Ctrl+F1.
• On the main toolbar, click the Documentation ( ) button.
• From the main menu, select Help>Documentation.

THE APPLICATION LIBRARIES WINDOW


Each application includes documentation with the theoretical background and step-by-step
instructions to create a model application. The applications are available in COMSOL as
MPH-files that you can open for further investigation. You can use the step-by-step
instructions and the actual applications as a template for your own modeling and applications.
In most models, SI units are used to describe the relevant properties, parameters, and
dimensions in most examples, but other unit systems are available.

Once the Application Libraries window is opened, you can search by name or browse under
a module folder name. Click to view a summary of the application and its properties, including
options to open it or a PDF document.

The Application Libraries Window in the COMSOL Multiphysics


Reference Manual.

Opening the Application Libraries Window


To open the Application Libraries window ( ):

• From the Home toolbar, Windows menu, click ( ) Applications


Libraries.
• From the File menu select Application Libraries.

To include the latest versions of model examples, from the File>Help


menu, select ( ) Update COMSOL Application Library.

12 | CHAPTER 1: INTRODUCTION
Select Application Libraries from the main File> or Windows> menus.

To include the latest versions of model examples, from the Help menu
select ( ) Update COMSOL Application Library.

CONTACTING COMSOL BY EMAIL


For general product information, contact COMSOL at [email protected].

To receive technical support from COMSOL for the COMSOL products, please contact your
local COMSOL representative or send your questions to [email protected]. An automatic
notification and case number is sent to you by email.

COMSOL WEBSITES

COMSOL website www.comsol.com


Contact COMSOL www.comsol.com/contact
COMSOL Access www.comsol.com/access
Support Center www.comsol.com/support
Product Download www.comsol.com/product-download
Product Updates www.comsol.com/support/updates
COMSOL Blog www.comsol.com/blogs
Discussion Forum www.comsol.com/community
Events www.comsol.com/events
COMSOL Video Gallery www.comsol.com/video
Support Knowledge Base www.comsol.com/support/knowledgebase

ABOUT THE CAD IMPORT MODULE | 13


14 | CHAPTER 1: INTRODUCTION
2

Geometry Tools and Features

This chapter describes the tools and features available for creating, importing, and
modifying geometry with the CAD Import Module.

15
Geometry Representation
Working with the CAD Kernel
The component of the COMSOL Multiphysics® software that is used to represent,
build, and manage the interactions between geometric objects is the geometric kernel
or geometric modeler. There are two kernels used by the software, the COMSOL
kernel, and the CAD kernel (the Parasolid® kernel) that is included with the CAD
Import Module, the Design Module, and LiveLink™ products interfacing CAD
packages.

With a license for the CAD Import Module the software defaults to the CAD kernel
for representing the geometry. You need to use the CAD kernel to apply the geometry
features included with this module, for example the defeaturing and repair tools, as
well as to import 3D geometries using various 3D CAD file formats.

The 3D operations and primitives listed in Table 0-1 do not support the CAD kernel
— they always use the COMSOL kernel. However, an automatic conversion is
performed for these objects before they are used as input to geometry features that
require the CAD kernel, see Converting Objects to CAD Kernel Representation.
TABLE 2-1: 3D GEOMETRY FEATURES THAT DO NOT SUPPORT THE PARASOLID GEOMETRY KERNEL

FEATURE NAME FEATURE NAME

Bezier Polygon Point


Eccentric Cone Polygon
Extrude Pyramid
Helix Revolve
Hexahedron Sweep
Interpolation Curve Tetrahedron
Parametric Curve Torus
Parametric Surface Work Plane

CHANGING THE GEOMETRIC KERNEL


To switch between geometric kernels, you can click the Geometry node, then in its
Settings window, from the Geometry representation list choose either the CAD kernel or
COMSOL kernel.

16 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


When you change the Geometry representation setting, all nodes that support the CAD
kernel are marked as edited with an asterisk (*) in the upper-right corner of the node’s
icon. To rebuild the geometry using the new kernel, click the Build All button ( ).
To avoid re-solving an already solved model, you can click the Update Solution button
( ) on the Study toolbar to map the solutions from the geometry represented by the
CAD kernel to the new geometry represented by the COMSOL kernel.

If you solve a model using the CAD kernel, it is not possible to view and
postprocess the solution if you open it in a COMSOL Multiphysics
session where a license for the CAD Import Module, Design Module, or
one of the LiveLink for CAD products is not available, unless, before
saving the model, you change the geometry representation to COMSOL
kernel and update the solution. This is possible to do only for 3D
geometry sequences that do not contain geometry features that require
the CAD kernel.

When you create a new model, its default geometry representation is controlled by the
preference setting Geometry>Geometry representation>In new geometries.

When you open an existing model, you normally use the geometry representation used
in the model. To always get the possibility to convert the geometry to the COMSOL
kernel, change the preference setting Geometry>Geometry representation>When
opening an existing model to Convert to COMSOL kernel.

Converting Objects to COMSOL Kernel Representation


To convert CAD objects (geometric objects represented by the CAD kernel) to objects
represented by the COMSOL kernel, from the Geometry toolbar, Conversions menu,
select Convert to COMSOL ( ).

The COMSOL geometry file format (.mphbin, or .mphtxt) can contain


geometric objects saved in both the CAD kernel and COMSOL kernel
representations. To import geometry from such a file to a geometry
sequence that uses the COMSOL kernel, you need to convert geometry
objects to the COMSOL representation before exporting to the file.

GEOMETRY REPRESENTATION | 17
CONVERT TO COMSOL
Select the objects that you want to convert in the Graphics window. The selected
objects are displayed in the Input objects list.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

ASSIGNED ATTRIBUTES
From the Construction geometry list choose On to make the resulting objects available
only in the feature’s geometry sequence. The default option Inherit means that the
resulting objects become construction geometry if all input objects are construction
geometry. Choose Off to never output construction geometry objects. For more
information see Construction Geometry.

Converting Objects to CAD Kernel Representation


If the current geometry representation for the geometry sequence is CAD kernel, an
automatic conversion of COMSOL objects to CAD objects takes place before using
the objects in Boolean operations and before using the objects in the Convert to Solid,
Convert to Surface, Convert to Curve, and Convert to Point operations. This ensures that
the CAD kernel is used in the abovementioned operations. This conversion is also
performed when COMSOL objects are used as input to features that require the CAD
kernel, for example the Knit to Solid feature

18 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


An automatic conversion to CAD objects is also performed before exporting geometry
in the ACIS®, Parasolid®, STEP, and IGES file formats.

If the automatic conversion cannot be performed, the geometry operation is


performed by the COMSOL kernel. For example, geometry objects created from a
mesh cannot be converted to CAD kernel representation. Other examples of geometry
objects that cannot be converted to CAD representation include objects that have an
edge adjacent to three or more isolated faces, or objects that have a face bounded by
an edge loop that intersects itself.

The automatic conversion to CAD kernel representation is not performed if one of the
input objects to the Boolean or conversion operation is the result of a previous Convert
to COMSOL operation.

GEOMETRY REPRESENTATION | 19
Importing and Exporting CAD Files
Importing 3D CAD Files
To import geometry objects from a 3D CAD file, from the Home or the Geometry
toolbar, click Import ( ). In the Import section of the Settings window, select 3D CAD
file from the Geometry import list. You can also skip this step as the type of the selected
file is automatically recognized by the code. Click Browse to locate the file to import,
or enter the path to the file. Before clicking the Import button consider to review and
configure the import settings. If you have changed some settings after importing a file,
the file is automatically re-imported when you click a build button.

The imported geometry objects are represented by the CAD kernel, see Working with
the CAD Kernel, which is the geometric kernel used by the CAD Import Module,
Design Module, and LiveLink™ products interfacing CAD packages.

Some 3D CAD formats use periodic parameterization for edges and faces. For
example, a full-revolution cylindrical edge or face appears seamless in the CAD
program. During import edges or faces that have a periodic parameterization are cut
in two halves by inserting new vertices and edges. This is done because the mesh
algorithms do not support periodic entities. You can ignore such inserted edges using
an Ignore Edges feature from Virtual Operations.

SUPPORTED FORMATS
The CAD import supports the following 3D CAD formats:
TABLE 2-2: SUPPORTED 3D CAD FILE FORMATS

FILE FORMAT NOTES FILE EXTENSIONS SUPPORTED VERSIONS

ACIS® 1 .sat, .sab up to 2021 1.0


® .dwg, .dxf 2.5-2022
AutoCAD 1, 2
® .CATPart, R8 to R2022
CATIA V5 2, 3
.CATProduct
IGES 1 .igs, .iges up to 5.3
® .iam 11-2022
Inventor assembly 1, 2
® .ipt 6-2022
Inventor part 1, 2
® .prt up to 1980
NX 1, 4
® .x_t, .x_b up to V34.0
Parasolid 1
® ® .prt, .asm 1.0-8.0
PTC Creo Parametric™ 1

20 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


TABLE 2-2: SUPPORTED 3D CAD FILE FORMATS

FILE FORMAT NOTES FILE EXTENSIONS SUPPORTED VERSIONS

PTC® Pro/ENGINEER® 1 .prt, .asm 16 to Wildfire 5


SOLIDWORKS® 1, 2, 5 .sldprt, .sldasm 98-2022
STEP 1 .step, .stp AP203E1, AP214,
AP242
Note 1: This format requires a license for one of the CAD Import Module, or Design
Module, or LiveLink product for a CAD package.

Note 2: Available only on a supported Windows operating system.

Note 3: This format requires, in addition to the CAD Import Module, or Design
Module, or a LiveLink product for a CAD package, a license for the File Import for
CATIA V5 module.

Note 4: Support for the NX® file format is available only on a supported Windows or
Linux operating system.

Note 5: Embedded parts in assemblies are not supported. To import such an assembly,
first convert the embedded parts to external parts.

ASSOCIATIVITY
When possible the import maintains associativity for the imported geometry objects,
so that when the CAD file is re-imported the settings applied to the geometric entities,
for example physics or material settings, are retained. To maintain associativity the
import relies on information in the CAD file that uniquely identifies the geometry
objects and their entities, such as faces, edges, and points. This information is usually
included in the CAD file if the geometry is saved in the format of the CAD software
where it was created, but not when the geometry is exported to another CAD format.
When re-importing a CAD file the import automatically tries to identify and match all
geometry objects and their entities to the previous version. This may fail if the
topology (structure) of the geometry has changed since the last import.

IMPORTING AND EXPORTING CAD FILES | 21


Note: To ensure that associativity is maintained when re-importing a CAD file work
with CAD files saved in the originating CAD software’s format, and avoid changes to
the topology (structure) of the geometry. When an associative import is not possible
use coordinate-based selections, such as the Ball, Box, and Cylinder selections in 3D
(see Creating Selections From Geometric Primitives and Operations in the COMSOL
Multiphysics Reference Manual).

LENGTH UNIT
In the Length unit list, select From CAD document to change the geometry’s length unit
to the unit in the file (if the file has a length unit). Select From COMSOL to keep the
geometry’s length unit and scale the objects in the file to the geometry’s unit.

OBJECTS TO IMPORT
Select the types of objects to import using the Solids, Surfaces, and Curves and points
check boxes.

If the Surfaces check box is selected, you can choose how COMSOL imports the
surfaces using the list under For surface objects:

• Choose Form solids (the default) to knit together surface objects to form solids. The
input surface objects must have manifold topology, and the operation can only form
solids with manifold topology. An example of a solid object with nonmanifold
topology is a solid that has an interior surface that separates two domains. A surface
object that contains an edge that is adjacent to more than one boundary is an
example of a surface object with nonmanifold topology.
• Choose Knit surfaces to form surface objects by knitting.
• Choose Do not knit to not form any surface or solid objects from the imported
surfaces.

For the Form Solids and Knit surfaces options select the Fill holes check box to generate
new faces to replace missing geometry.

To import wireframe geometry you need to select the Curves and points check box.
With this option, the Unite curve objects check box is selected by default to unite the
imported curve objects, which speeds up the rendering of the geometry.

22 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


IMPORT OPTIONS
The Absolute import tolerance is a length measured in the geometry’s unit after the
import. When importing 3D CAD files, the program merges geometric entities with a
distance smaller that this tolerance.

If you select the Check imported objects for errors check box, the validity of the
imported objects is checked as the last stage of the import. Warning nodes appear with
details about the detected problems, if any. Use the Zoom to Selection button next to
the Entities list in a warning node to locate the problematic edges or faces. For
information on geometry problems that may occur see the Check feature.

If you select the Repair imported objects check box, the software tries to repair defects
and remove details smaller than the Absolute repair tolerance.

If you select the Remove redundant edges and vertices check box, the software tries to
remove redundant edges and vertices.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the objects consist of
available as selections in all applicable selection lists (in physics and materials settings,
for example), choose an option from the Show in physics list: All levels, Domain selection,
Boundary selection, Edge selection, or Point selection. The default is Domain selection,
which is suitable for use with materials and physics defined in domains. For use with a
boundary condition, for example, choose Boundary selection. These selections do not
appear as separate selection nodes in the model tree. Select Off to not make any
selection available outside of the geometry sequence.

Select the Individual objects selections check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence for each individual object in the geometry
file and for each relevant entity level. To also make all or one of the types of resulting
entities (domains, boundaries, edges, and points) that the objects consist of available
as selections in all applicable selection lists (in physics and materials settings, for

IMPORTING AND EXPORTING CAD FILES | 23


example), choose an option from the Show in physics list: All levels, Domain selection,
Boundary selection, Edge selection, or Point selection. The default is Domain selection, if
available, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

SELECTIONS GENERATED BASED ON INFORMATION IN THE CAD FILE


The following types of data from the CAD file are used to generate selection on the
imported geometry:

• Material assignments can generate objects selections that are named according to
the material names in the CAD file.
• Layer assignments of objects and entities, when supported by the CAD format, can
generate object, boundary, edge, and point selections that are named according to
the layer names in the CAD file.
• Color assignments to objects, faces, or edges can generate object, boundary, and
edge selections, respectively.

After the import the generated selections are displayed in the Settings window for the
Import node in sections named according to the entity level of the selections:

• Object Selections
• Boundary Selections
• Edge Selections
• Point Selections
Depending on which selections are generated, a subset of the above sections is
displayed. The selections are listed in tables with the following columns:

• Name: Here you can edit the selection name that is generated by the import. For
colors the generated names are of the type Color 1, Color 2, etc., for materials and
layers the names from the CAD file are used.
• Name in file: This column contains the original name of the selection. To display this
column select the Show names from file check box above the table.
• Keep: Select the check box in this column to make the selection available in selection
lists for subsequent nodes in the geometry sequence.

24 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


• Physics: Select the check box in this column to make the selection available in all
applicable selection lists (in physics and materials settings, for example).
• Contribute to: If you want to make the objects or entities in the selection contribute
to a cumulative selection, select a cumulative selection from the Contribute to list
(the default, None, gives no contribution), or click the New Cumulative Selection
button under the table to create a new cumulative selection (see Cumulative
Selections in the COMSOL Multiphysics Reference Manual).

Click a row in a table to highlight the corresponding selection on the geometry in the
Graphics window. To help with identifying the color selections, these are highlighted
with the colors defined in the imported CAD file. To always highlight on the geometry
the color selections that you keep select from the Graphics toolbar Colors > Show
Selection Colors.

The selections listed in the Object Selections section that are made available for the
geometry sequence or physics setup are always available in all input selection lists,
including all applicable entity selection lists. For example, the object selection of a solid
object, generated for a material from the CAD file, automatically results in domain,
boundary, edge, and point selections with the same name, so that you can use it to
apply a boundary material, or a boundary condition. In contrast, a color assigned to a
face of a solid object in the CAD file results in a boundary selection that is displayed
in the Boundary Selections section, and it is available in all applicable boundary selection
lists, but not, for example, in any edge selection lists.

ASSIGNED ATTRIBUTES
Select the Construction geometry check box to make the resulting objects available only
in the feature’s geometry sequence. For more information see Construction
Geometry.

Exporting Objects to 3D CAD Formats


With a license for the CAD Import Module you can export 3D geometry objects to
the ACIS® (version 2016 1.0), IGES (version 5.3), Parasolid® (version 34.0), and
STEP (version AP203) formats. To do this:

• right-click the Geometry node and select Export ( ), or


• on the Geometry toolbar click Export ( ).

IMPORTING AND EXPORTING CAD FILES | 25


Then, in the File type list, select Parasolid binary file, Parasolid text file, ACIS binary file,
ACIS text file, IGES file, or STEP file. Use the Browse button to choose the filename, then
click Save to close the Export Geometry window.

Next, select Export selected objects to export only chosen geometry objects or select
Export entire finalized geometry to export the resulting geometry of a Form Union or
Form Assembly operation.

Note that it is not possible to export to the formats mentioned here the
result of virtual geometry operations that come after a Form Union or
Form Assembly node in the geometry sequence.

When exporting to an ACIS file format choose the ACIS file format version. Available
versions are 4.0, 7.0, 2016 1.0 (default).

For the Parasolid, IGES, and STEP file formats select a Length Unit. A unit conversion
is carried out when the selected unit is different from the length unit of the geometry.
A unit conversion is not done for the default From geometry option.

For the Parasolid file formats the option Split in manifold objects is selected by default
to make sure that the exported geometry objects are manifold objects. A non-manifold
object is, for example, a solid with an interior boundary that separates two domains.
When exported using this option the solid is split along the interior boundary into two
separate objects. When exporting to the ACIS, IGES, and STEP formats non-manifold
objects are always split.

Finally, to export the geometry, click the Export button.

The Parasolid binary and text formats do not allow coordinate values
larger than 500. Therefore you might have to change the export unit in
the Length unit list box to be able to export the geometry.

COMSOL objects are automatically converted to CAD objects before saving the file.

For details on which objects can be converted to CAD objects see


Converting Objects to CAD Kernel Representation.

26 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


Using the Defeaturing Tools
This section describes the defeaturing tools for finding and removing details from
imported 3D CAD geometry, and locating overlaps and gaps in imported CAD
assemblies. With the defeaturing tools you can search for and delete both small details,
such as short edges, small faces, sliver faces, and spikes, and larger details, for example,
fillets, chamfers, and cylindrical holes.

To access the defeaturing tools, from the Geometry toolbar, Defeaturing and Repair
menu, select Delete Fillets, Delete Holes, Delete Short Edges, Delete Sliver Faces, Delete
Small Faces, Delete Spikes, Delete Faces, or Detach Faces from the submenu. Here you
also find the Detect Interferences tool to analyze the interference of geometry objects.
You can also right-click the Geometry node and select the same options from the
context menu.

When you are on the Tools window for a defeaturing operation, you can switch to
another defeaturing tool by clicking one of the corresponding buttons at the top of the
page. Upon completion of the defeaturing operation a corresponding feature node,
which you can modify, appears in the geometry sequence.

Finding and Deleting Small Details


You can use any of the Delete Fillets ( ), Delete Holes ( ), Delete Short Edges ( ),
Delete Sliver Faces ( ), Delete Small Faces ( ), and Delete Spikes ( ) tools to
search for and delete details smaller than a given size. First activate the Input objects
selection by clicking the Active button to toggle between and . Select the
objects you want to examine in the Graphics window.

In the field Maximum fillet radius, Maximum hole radius, Maximum edge length, Maximum
face width, Maximum face size, or Maximum spike width, enter the maximum size of the
details you want to delete. When you click the Find button, a list of details that are
smaller than the given size are shown in the list below. To delete the found details,
either click the Delete All button, or select a subset of the found details in the list and
click Delete Selected. Then, the selected details are deleted from their objects, and a
node corresponding to this operation is added to the geometry branch of the model
tree.

USING THE DEFEATURING TOOLS | 27


If you want to modify the performed deletion operation, you can select the added node
in the geometry branch. Then, edit the node’s form that appears in the Settings
window. Click the Build Selected button ( ) to see the result of your edits.

Delete Faces
The Delete Faces ( ) page is used to delete faces and replace them either with a new
face (if Heal method is Fill) or a by growing or shrinking the adjacent faces (if Heal
method is Patch). Select the faces you want to delete in the Graphics window. They
appear in the Faces to delete list. Select the Heal as through hole check box if you have
selected faces that make up a hole that you want to delete. When you click the Delete
Selected button, the selected faces are deleted, and a node corresponding to this
operation is added to the geometry branch of the model tree.

If you want to modify the performed deletion operation, you can select the added node
in the geometry branch. Then, edit the node’s form that appears in the Settings
window. Click the Build Selected button ( ) to see the result of your edits.

Detach Faces
The Detach Faces ( ) page is used to detach faces from a solid object (the parent) to
form a new solid object (the child). Select the faces you want to detach in the Graphics
window. They appear in the Faces to detach list.

The Parent heal method list determines how to replace the detached faces in the parent
object: Fill means that a new face is constructed, and Patch means that the adjacent
faces are grown or shrunk to heal the wound.

The Child heal method list controls how to construct the child solid from the detached
faces: Fill means that a new face is formed based on the surrounding edges of each
wound, Patch from child means that the detached faces grow or shrink to form a solid,
and Patch from parent means that the parent faces surrounding the detached faces grow
or shrink to form a solid together with the detached faces.

When you click the Detach Selected button, the program detaches the selected faces and
adds a node corresponding to this operation to the geometry branch of the model tree.
If you want to modify the performed detach operation, select the added node in the
geometry branch. Then edit the node’s form that appears in the Settings window. Click
the Build Selected button ( ) to see the result of your edits.

28 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


Detect Interferences
Use the Detect Interferences ( ) page to find overlaps and gaps between objects.

In the Input objects list, select the objects you want to analyze. In the Tolerance text
field, enter the absolute tolerance, which has the default value of 0.1 mm, to be used
for the search. When you click the Find Interferences button, a list of interferences is
displayed in the Interfering faces list.

The interference detection applies to the exterior faces of the selected objects, thus
ignoring interior faces, isolated edges and vertices. Each detected interference involves
two objects. The following types of interferences appear in the list when detected by
the tool:

• Touch. Two interfering objects are classified as touching when they intersect, and
the interfering faces are located within a distance less than the specified tolerance
from each other. Thus, an intersection (as defined below) may become a touch after
you increase the tolerance such that it becomes larger than the distance between the
interfering faces.
• Intersection. An intersection between the two objects is detected, and the
interfering faces are located at a distance that is larger than the tolerance from each
other.
• Gap. No intersection is detected between the two objects, but they have faces with
portions that are located within a distance less than the specified tolerance from each
other. The detected size of the gap appears in the list.
• Containment. One object is a contained in another object, which is a solid.

By default the Interfering faces list displays the detected interferences in a tree with the
interferences as the top level nodes sorted by the type of interference. To sort the list
by the objects select the Group by object check box. In this case the objects involved in
an interference are listed as the top level nodes in the tree. Expand a top level node to
see the list of objects that the object on the top level is interfering with. Expand sub
node to see the list of detected interferences for the objects. You can expand the nodes
for the detected interferences to reveal the two interfering objects, and then expand
the nodes for the objects to look at the interfering faces displayed in sub-nodes
according to the following:

• For two intersecting solid objects the nodes for the objects have two sub-nodes
each, Inside and Outside. Click the Inside node to highlight the parts of the
interfering faces that are inside the other object. Click the Outside node to highlight
the parts of the interfering faces that are outside the other object.

USING THE DEFEATURING TOOLS | 29


• For two intersecting surface objects the nodes for the objects have two sub-nodes
each, Small side and Large side. The faces resulting from the intersection are
grouped according to size since surface objects do not delimit a volume in space,
thus it is not possible to determine what is inside or outside the other object. Click
the Small side and Large side nodes to highlight the parts of the interfering faces
that result from the intersection with the faces of the other object.
• For an intersection of a solid and a surface object, the node for the solid object has
the sub-nodes Small side and Large side, while the node for the surface object has
sub-nodes Inside and Outside.
• For two touching objects, the nodes for the objects may have two sub-nodes,
Touching and Not touching. Click these nodes to highlight the corresponding
portions of the interfering faces.
• For a gap between two objects, the nodes for the objects may sometimes have two
sub-nodes Touching and Not touching.
• For a Containment node, the first sub-node is the containing object, and the second
sub-node is the contained object.

VISUALIZATION OF DETECTED INTERFERENCES


For a better visualization of the detected interferences, the Detect Interferences tool
partitions the faces involved in the intersections and touches so that the interfering face
regions can be shown and highlighted separately. In the Interfering faces list, when you
select the nodes for the interferences, or the top most or first sub-level object nodes
when the Group by object check box is selected, the interferences are visualized only by
highlighting those faces or face regions that enclose an intersection or are directly in
touch. In the list, these are the faces belonging to the first sub-node of each object
node under the selected interference node. Thus, when you click a node for an
interference in the list, the faces or face regions belonging to nodes Outside, Large
side, and Not touching are not highlighted. Expand the node for the interference, and
select the object sub-nodes, to see highlighted the involved faces in their entirety,
including the face regions that are not directly interfering.

Note that the face partitioning that is the result of the intersections is visible only while
working with the Detect Interferences tool, and that the geometry is not modified by
this tool.

30 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


To change which objects are shown in the Graphics window while selecting nodes in
the Interfering faces list choose one of the options from the Show in graphics list:

• Choose Interfering faces only to show only the interfering faces involved in the
selected node. For example, if you select an intersection node from the list, only the
face regions from the two objects that are involved in the intersection are shown.
• Choose Selected object (default) to show only the objects involved in the selected
node.
• Choose Other object to show the object that is interfering with the currently selected
object sub-node to the interference node.
• Choose Both objects to show both objects involved in a interference when you select
one of the sub-nodes to the interference node.
• Choose All objects to show all objects regardless of which nodes are selected.

The Zoom to Selection button next to the Interfering faces list may also help to find the
detected interferences on the geometry. For a better view of the interferences between
objects you can also click the Wireframe Rendering or Transparency buttons on the
Graphics toolbar.

USING THE DEFEATURING TOOLS | 31


Geometry Features
In this section:

• Cap Faces • Delete Spikes


• Check • Detach Faces
• Delete Faces • Knit to Solid
• Delete Fillets • Projection
• Delete Holes • Repair
• Delete Short Edges
• Delete Sliver Faces
• Delete Small Faces

Cap Faces
You can add cap faces to fill holes in a geometry (for example, to make a domain for
the void inside a cylinder geometry for simulating fluid flow inside the cylinder) or to
partition the geometry. To add cap faces to objects, from the Geometry toolbar,
Defeaturing and Repair menu, select Cap Faces ( ).

CAP FACES
Select edges that form loops around the faces you want to create. The edges display in
the Bounding edges list.

A cap face is created for each loop of edges in the input selection. The cap faces are
joined with the original objects. If new closed volumes are created by the cap faces,
these are converted to solid domains. The selected edges can contain more than one
edge loop, but no two loops can have edges or vertices in common. The selected edges
can contain edges from more than one object. In this case, each object is processed
individually. This means that two edges or vertices can overlap as long as they are not
in the same object. It also means that if new closed volumes are created, but bounded
by faces from more than one object, these volumes are not converted to solid domains.
If you want to perform a Cap Faces operation involving more than one object, first
unite the objects using a Union operation.

32 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


SELECTIONS OF RESULTING ENTITIES
If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

ASSIGNED ATTRIBUTES
From the Construction geometry list choose On to make the resulting objects available
only in the feature’s geometry sequence. The default option Inherit means that the
resulting objects become construction geometry if all input objects are construction
geometry. Choose Off to never output construction geometry objects. For more
information see Construction Geometry.

Check
To check the validity of CAD objects, from the Geometry toolbar, Defeaturing and
Repair menu, select Check ( ).

Select the objects that you want to check in the Graphics window. These then appear
in the Input objects list. If the geometry sequence includes user-defined selections
above the Check node, choose Manual to select objects, or choose one of the selection
nodes from the list next to Input objects. Click the Active button to toggle between
turning ON and OFF the Input objects selections.

If any problems are detected in the selected objects when building this feature,
warning nodes appear with details about the issues. In the warning nodes use the Zoom
to Selection button next to the Entities list to locate the faulty edges or faces.

GEOMETRY FEATURES | 33
Warnings on geometric entities are usually associated with objects imported from CAD
files, but could also be introduced by geometric operations, for example when
repairing an object with a tolerance that is too large. The presence of warnings does
not generally mean that the geometry is invalid and cannot be used for setting up a
simulation. However, the faulty entities may in some cases cause the failure of
geometric operations that involve these entities, and meshing of entities with certain
types of faults may fail. In the following you can read about two commonly occurring
class of faulty geometric entities, and how to repair these:

• Tolerance issues: The warning messages vertex not on edge, vertex not on face, edge
not on face belong to this category. These type of faults indicate that the topology
(structure) of the object is not correct locally, for example that an edge is not located
on the boundary where it is expected to be. You can often repair tolerance issues in
an object by applying the Repair operation with a tolerance that is larger than the
tolerance used for the import. Repair adjusts the tolerance of the entities where
required, and, if this fixes the issues, warning nodes will not be displayed after the
Repair node. In some cases it may also help to use the option Simplify curves and
surfaces for the Repair operation. Note that increasing the repair tolerance too much
may lead to removing important details from the geometry. As an alternative to the
Repair operation you can also re-import the CAD file using a larger tolerance,
however the option to simplify curves and surfaces is not available in this case. For
more details see Repair, and Import Options.
• Invalid entities: The warning messages invalid curve or surface, self-intersecting
face, face-to-face inconsistency, self-intersecting curve or surface signify invalid
entities. If you encounter any of these faults after importing a geometry from a CAD
file you may need to repair the geometry to avoid problems with meshing. For
example:
- For face-to-face inconsistency faults on solid objects, try to repair the object using
the Repair face-to-face inconsistencies in solids option for the Repair feature.
- Try to replace the faulty face. Use the Delete operation to delete the face, then
use the Cap Faces operation to generate a new face in its place. Another solution
may be to use Delete Faces to delete and patch in one operation several connected
faces that have a fault.

Delete Faces
To delete and replace faces from an object, from the Geometry toolbar, Defeaturing and
Repair menu, select Delete Faces ( ). This opens the Delete Faces window. When the

34 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


deletion operation has been performed, you can modify it by editing the
corresponding Delete Faces node that appears in the geometry branch by clicking it.

The Delete Faces tool can only be applied to objects that are represented
by the Parasolid® geometry kernel, also called CAD objects.

DELETE FACES
In the Faces to delete list, select the faces you want to delete. In the Heal method list,
select the method to use for replacing the deleted faces: Fill means that the deleted faces
are replaced with a new face, while Patch means that the adjacent faces are grown or
shrunk to heal the wound. Select the Heal as through hole check box if you have selected
faces that make up a hole that you want to delete.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

Delete Fillets
To delete fillets from an object, from the Geometry toolbar, Defeaturing and Repair
menu, select Delete Fillets ( ). This opens the Delete Fillets window, see Finding and
Deleting Small Details. When the deletion operation has been performed, you can

GEOMETRY FEATURES | 35
modify it by editing the corresponding Delete Fillets node that appears in the
geometry branch by clicking it.

The Delete Fillets tool can only be applied to objects that are represented
by the Parasolid® geometry kernel, also called CAD objects.

Note that fillets found on nonmanifold objects are not possible to delete. An example
of a nonmanifold object is an object with several domains. Such an object can for
example result from a Union or a Partition operation. To remove the fillets make sure
to defeature the geometry objects before applying Boolean operations that result in
nonmanifold objects.

The Delete Fillets tool cannot delete fillets for which the adjacent faces cannot be
extended to cover the gap. The figure below shows an example of such fillets. Applying
the fillets on the highlighted edges deletes the annular face from the geometry, which
cannot be recreated if the fillets are to be deleted.

DELETE FILLETS
In the Input objects list, select the objects you want to delete fillets from. In the field
Maximum fillet radius, enter the maximum size of the fillets you want to delete. When
you click the Find Fillets button, a list of fillets with radius smaller that the given value
is shown in the Fillet selection list. If Deletion type is All fillets, all such fillets are deleted.
You can delete a subset of these fillets by clicking in the Fillet selection list, and choosing
Selected fillets in the Deletion type list.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

36 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

Delete Holes
To delete cylindrical holes from an object, from the Geometry toolbar, Defeaturing and
Repair menu, select Delete Holes ( ). This opens the Delete Holes window, see Finding
and Deleting Small Details. When the deletion operation has been performed, you can
modify it by editing the corresponding Delete Fillets node that appears in the
geometry branch by clicking it.

The Delete Holes tool can only be applied to objects that are represented
by the CAD kernel; see Converting Objects to CAD Kernel
Representation.

Note that holes found on nonmanifold objects are not possible to delete. An example
of a nonmanifold object is an object with several domains. Such an object can for
example result from a Union or a Partition operation. To remove the holes make sure
to defeature the geometry objects before applying Boolean operations that result in
nonmanifold objects.

DELETE HOLES
In the Input objects list, select the objects you want to delete holes from. In the field
Maximum hole radius, enter the maximum size of the holes you want to delete. When
you click the Find Holes button, a list of holes with radius smaller that the given value
is shown in the Hole selection list. If Deletion type is All holes, all such holes are deleted.
You can delete a subset of these holes by clicking in the Hole selection list, and choosing
Selected holes in the Deletion type list.

GEOMETRY FEATURES | 37
SELECTIONS OF RESULTING ENTITIES
If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

Delete Short Edges


To delete short edges from an object, from the Geometry toolbar, Defeaturing and
Repair menu, select Delete Short Edges ( ). This opens the Delete Short Edges window,
see Finding and Deleting Small Details. When the deletion operation has been
performed, you can modify it by editing the corresponding Delete Short Edges node
that appears in the geometry branch by clicking it.

The Delete Short Edges tool can only be applied to objects that are
represented by the Parasolid® geometry kernel, also called CAD objects.

Note that this defeaturing tool cannot find short edges on nonmanifold objects. An
example of a nonmanifold object is an object with several domains. Such an object can
for example result from a Union or a Partition operation. To avoid this situation
defeature the geometry objects before applying Boolean operations that result in
nonmanifold objects.

DELETE SHORT EDGES


In the Input objects list, select the objects you want to delete short edges from. In the
field Maximum edge length, enter the maximum length of the edges you want to delete.
When you click the Find Short Edges button, a list of edges with length smaller that the

38 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


given value is shown in the Short edge selection list. If Deletion type is All short edges,
all such edges are deleted. You can delete a subset of these edges by clicking in the Short
edge selection list, and choosing Selected short edges in the Deletion type list.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

Delete Sliver Faces


To delete sliver faces from an object, from the Geometry toolbar, Defeaturing and Repair
menu, select Delete Sliver Faces ( ). This opens the Delete Sliver Faces window, see
Finding and Deleting Small Details. When the deletion operation has been performed,
you can modify it by editing the corresponding Delete Sliver Faces node that appears
in the geometry branch by clicking it.

The Delete Sliver Faces tool can only be applied to objects that are
represented by the Parasolid® geometry kernel, also called CAD objects.

Note that this defeaturing tool cannot find sliver faces on nonmanifold objects. An
example of a nonmanifold object is an object with several domains. Such an object can
for example result from a Union or a Partition operation. To avoid this situation
defeature the geometry objects before applying Boolean operations that result in
nonmanifold objects.

GEOMETRY FEATURES | 39
DELETE SLIVER FACES
In the Input objects list, select the objects you want to delete sliver faces from. In the
field Maximum face width, enter the maximum width of the faces you want to delete.
When you click the Find Sliver Faces button, a list of faces with width smaller that the
given value are shown in the Sliver faces selection list. If Deletion type is All sliver faces,
all such faces are deleted. You can delete a subset of these faces by clicking in the Sliver
face selection list, and choosing Selected sliver faces in the Deletion type list.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

Delete Small Faces


To delete small faces from an object, from the Geometry toolbar, Defeaturing and Repair
menu, select Delete Small Faces ( ). This opens the Delete Small Faces window, see
Finding and Deleting Small Details. When the deletion operation has been performed,
you can modify it by editing the corresponding Delete Small Faces node that appears
in the geometry branch by clicking it.

The Delete Small Faces tool can only be applied to objects that are
represented by the Parasolid® geometry kernel, also called CAD objects.

Note that this defeaturing tool cannot find small faces on nonmanifold objects. An
example of a nonmanifold object is an object with several domains. Such an object can

40 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


for example result from a Union or a Partition operation. To avoid this situation
defeature the geometry objects before applying Boolean operations that result in
nonmanifold objects.

DELETE SMALL FACES


In the Input objects list, select the objects you want to delete small faces from. In the
field Maximum face size, enter the maximum diameter of the faces you want to delete.
When you click the Find Small Faces button, a list of faces with diameter smaller that
the given value appears in the Small faces selection list. If Deletion type is All small faces,
all such faces are deleted. You can delete a subset of these faces by clicking in the Small
face selection list, and choosing Selected small faces in the Deletion type list.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

Delete Spikes
A spike is a long and narrow protrusion on an edge or corner of a face defined by two
or three edges. To delete spikes from an object, from the Geometry toolbar, Defeaturing
and Repair menu, select Delete Spikes ( ). This opens the Delete Spikes window, see
Finding and Deleting Small Details. When the deletion operation has been performed,

GEOMETRY FEATURES | 41
you can modify it by editing the corresponding Delete Spikes node that appears in the
geometry branch by clicking it.

The Delete Spikes tool can only be applied to objects that are represented
by the Parasolid® geometry kernel, also called CAD objects.

Note that this defeaturing tool cannot find spikes on faces that belong to nonmanifold
objects. An example of a nonmanifold object is an object with several domains. Such
an object can for example result from a Union or a Partition operation. To avoid this
situation defeature the geometry objects before applying Boolean operations that
result in nonmanifold objects.

DELETE SPIKES
In the Input objects list, select the objects you want to delete spikes from. In the field
Maximum spike width, enter the maximum width of the spikes you want to delete.
When you click the Find Spikes button, a list of spikes with width smaller that the given
value are shown in the Spike selection list. If Deletion type is All spikes, all such spikes
are deleted. You can delete a subset of these spikes by clicking in the Spike selection list,
and choosing Selected spikes in the Deletion type list.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

42 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


Detach Faces
To detach faces from an object (the parent) and form a new object (the child), from
the Geometry toolbar, Defeaturing and Repair menu, select Detach Faces ( ). This
opens the Detach Faces window. When the detach operation has been performed, you
can modify it by editing the corresponding Detach Faces node that appears in the
geometry branch by clicking it.

The Detach Faces tool can only be applied to objects that are represented
by the Parasolid® geometry kernel, also called CAD objects.

DETACH FACES
Select the faces you want to detach in the Graphics window. They appear in the Faces
to detach list.

The Parent heal method list determines how to replace the detached faces in the parent
object: Fill means that a new face is constructed, and Patch means that the adjacent
faces grow or shrink to heal the wound.

The Child heal method list controls how to construct the child solid from the detached
faces: Fill means that a new face is formed based on the surrounding edges of each
wound, Patch from child means that the detached faces are grown or shrunk to form a
solid, and Patch from parent means that the parent faces surrounding the detached
faces are grown or shrunk to form a solid together with the detached faces.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For

GEOMETRY FEATURES | 43
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

Knit to Solid
To knit surface objects to form solid objects, from the Geometry toolbar, Defeaturing
and Repair menu, select Knit to Solid ( ).

KNIT TO SOLID
Select the objects to knit together in the Graphics window. They appear in the Input
objects list.

The knitting merges edges that have a distance smaller than the Absolute repair
tolerance and deletes gaps and spikes smaller than the Absolute repair tolerance. If the
Fill holes check box is selected the operation attempts to generate new faces to replace
missing geometry.

The input surface objects must have manifold topology, and the operation can only
form solids with manifold topology. An example of a solid object with nonmanifold
topology is a solid that has an interior surface that separates two domains. A surface
object that contains an edge that is adjacent to more than one boundary is an example
of a surface object with nonmanifold topology.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These

44 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

ASSIGNED ATTRIBUTES
From the Construction geometry list choose On to make the resulting objects available
only in the feature’s geometry sequence. The default option Inherit means that the
resulting objects become construction geometry if all input objects are construction
geometry. Choose Off to never output construction geometry objects. For more
information see Construction Geometry.

Projection
Use the Projection feature to compute the projection of 3D objects and entities to a
work plane. This can be useful when you need to reference existing 3D objects in the
2D drawing on the work plane. You can also add a new 2D or 2D axisymmetric
component and add the Projection node there. In that case you can select the work
plane to use for the projection from the 3D component’s geometry sequence, but first
make sure that in the 3D component’s Geometry node the Geometry representation is
set to the CAD kernel.

To add a projection to a Work Plane node’s Plane Geometry sequence, from the Plane
Geometry toolbar select Projection ( ), or right-click a Plane Geometry node under a
Work Plane node and select Projection ( ). Enter the properties of the projection
using the following sections:

PROJECTION
From the Project list, choose All objects (the default) to project all 3D geometry objects
to the work plane, or choose Selected objects, Selected domains, Selected boundaries,
Selected edges, or Selected vertices to project only the objects or entities that you add
to the Entities to project list that appears.

Click the Active button to toggle between turning ON and OFF the Entities to project
selections.

When projecting objects, domains, and boundaries you can select the Projection type
to project the Outline (default) of the selected objects and entities, or to project the
Edges and vertices only, or the Outline, edges, and vertices.

Projecting the outline for surface and solid objects results in the edges that form the
boundary of the shadow of the object’s faces. In this case the edges are projected only
if they coincide with the outline. If you project the outline of a mixed object that

GEOMETRY FEATURES | 45
contains isolated edges and vertices, only the outline of the faces is generated, the
isolated edges and vertices are not projected.

For point and curve objects, projecting the outline is the same as projecting the edges
and vertices.

You can change the settings for the Repair tolerance list if you experience problems with
the projection operation. Geometric entities that have a distance less than the repair
tolerance are merged.

• The default value in the Repair tolerance list is Automatic, which means a relative
repair tolerance of 10-6.
• Choose Relative to enter a value for the Relative repair tolerance field (the default is
determined by the main Geometry node’s setting). This value is relative to the largest
absolute value of the coordinates of all input objects.
• Choose Absolute to enter a value for the Absolute repair tolerance field (the default
is determined by the main Geometry node’s setting; SI unit: m). This value uses the
same unit as the geometry sequence’s length unit.

When you build this feature, the relative and absolute repair tolerances are set to the
values that are used for the last projected object (with a precision of two digits). This
is useful to find out the tolerance used for the last projected object. After the feature
is built, you can set the Repair tolerance to either Relative or Absolute, then check the
values displayed in the Relative repair tolerance or Absolute repair tolerance fields.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, boundaries, and points — that are applicable) in subsequent nodes in
the plane geometry sequence. To also make all or one of the types of resulting entities
(objects, boundaries, and points) available as selections in applicable selection lists in
the main Geometry node’s geometry sequence, choose an option from the Show in 3D
list: All levels, Object selection (default), Boundary selection, or Point selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the plane geometry sequence.

46 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


ASSIGNED ATTRIBUTES
From the Construction geometry list choose On to make the resulting objects available
only in the feature’s geometry sequence. The default option Inherit means that the
resulting objects become construction geometry if all input objects are construction
geometry. Choose Off to never output construction geometry objects. For more
information see Construction Geometry.

Repair
To repair objects, from the Geometry toolbar, Defeaturing and Repair menu, select
Repair ( ).

REPAIR
Select the objects to repair in the Graphics window. They appear in the Input objects list.

The software tries to repair defects and remove details smaller than the Absolute import
tolerance. More precisely:

• Entities with invalid sense


• Invalid edge and vertex tolerances
• Invalid manifolds
• Self-intersecting manifolds
• Non-G1 manifolds
• Missing edge or vertex manifolds
• Missing vertex
• Vertices not on curve of edge
• Edges and vertices not on surface of face
• Removal of surface self-intersections that lie outside the face
• Splitting at edge intersections which have no vertex
• Removal of discontinuities by either splitting or smoothing
• Remove small features (short edges, small faces, sliver faces, and spikes)

Select the option Simplify curves and surfaces to also simplify within the Absolute import
tolerance the underlying curve and surface manifolds of the geometric entities.
Repairing objects with this option may improve both the performance and reliability
of geometric operations on some imported geometry, for example it may help in some
cases when Boolean operations on the imported objects fail. Simplification means that

GEOMETRY FEATURES | 47
the manifolds are converted where possible to analytical form: linear, circular, and
elliptical curves; and planar, spherical, cylindrical, conical, and toroidal surfaces.
Manifolds that are converted are B-spline curves and surfaces, or certain surfaces
generated by operations such as sweeping, revolving, and filleting.

Select the Repair face-to-face inconsistencies in solids check box to try to repair solid
objects with this fault reported by Import, Check, or Repair features.

When the option Check resulting objects is selected the repaired objects are checked for
remaining problems. Warning nodes appear with details about the detected problems,
if any. Use the Zoom to Selection button next to the Entities list in a warning node to
locate the problematic edges or faces. For information on geometry problems see the
Check feature.

SELECTIONS OF RESULTING ENTITIES


If you want to make the resulting entities contribute to a cumulative selection, select
a cumulative selection from the Contribute to list (the default, None, gives no
contribution), or click the New button to create a new cumulative selection (see
Cumulative Selections in the COMSOL Multiphysics Reference Manual).

Select the Resulting objects selection check box to create predefined selections (for all
levels — objects, domains, boundaries, edges, and points — that are applicable) in
subsequent nodes in the geometry sequence. To also make all or one of the types of
resulting entities (domains, boundaries, edges, and points) that the resulting objects
consist of available as selections in all applicable selection lists (in physics and materials
settings, for example), choose an option from the Show in physics list: All levels, Domain
selection, Boundary selection, Edge selection, or Point selection. The default is Domain
selection, which is suitable for use with materials and physics defined in domains. For
use with a boundary condition, for example, choose Boundary selection. These
selections do not appear as separate selection nodes in the model tree. Select Off to not
make any selection available outside of the geometry sequence.

ASSIGNED ATTRIBUTES
From the Construction geometry list choose On to make the resulting objects available
only in the feature’s geometry sequence. The default option Inherit means that the
resulting objects become construction geometry if all input objects are construction
geometry. Choose Off to never output construction geometry objects. For more
information see Construction Geometry.

48 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES


GEOMETRY FEATURES | 49
50 | CHAPTER 2: GEOMETRY TOOLS AND FEATURES
3

Programming and Command Reference

In this section you find detailed COMSOL® API reference information for the
geometry features in the CAD Import Module.

51
D e f e a tur i ng T ool s
To remove unnecessary details in objects imported from a 3D CAD file, and detect
interferences between objects, you can use the defeaturing tools. You access these by
typing:

model.component(<ctag>).geom(<tag>).defeaturing("Fillets");
model.component(<ctag>).geom(<tag>).defeaturing("Holes");
model.component(<ctag>).geom(<tag>).defeaturing("ShortEdges");
model.component(<ctag>).geom(<tag>).defeaturing("SliverFaces");
model.component(<ctag>).geom(<tag>).defeaturing("SmallFaces");
model.component(<ctag>).geom(<tag>).defeaturing("Spikes");
model.component(<ctag>).geom(<tag>).defeaturing("DeleteFaces");
model.component(<ctag>).geom(<tag>).defeaturing("DetachFaces");
model.component(<ctag>).geom(<tag>).
defeaturing("DetectInterferences");

Using the defeaturing tools you can search for small details, without altering your
geometry. If you find small details that you want to remove, a defeaturing tool can
create a feature that removes the details from the geometry.

The features corresponding to the defeaturing tools are DeleteFillets,


DeleteHoles, DeleteShortEdges, DeleteSliverFaces, DeleteSmallFaces,
DeleteSpikes, DeleteFaces, and DetachFaces. If you already know which details
you need to remove, it is also possible to create these features directly using the
standard create syntax.

This section includes these topics:

• Defeaturing Tools — Finding and Deleting Small Details


• Defeaturing Tools — Delete Faces
• Defeaturing Tools — Detach Faces
• Defeaturing Tools — Detect Interferences

Defeaturing Tools — Finding and Deleting Small Details


The defeaturing tools Fillets, Holes, ShortEdges, SliverFaces, SmallFaces,
and Spikes search for and delete details smaller than a given size. First select the
objects you want to examine by typing, for example,

model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
selection("input").set(<onames>);

52 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


where <onames> is a string array contains the object names.

Set the maximum size of the details (fillets in this case) you want to remove by typing

model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
set("entsize",size);

To find the details that are smaller than the given size, type

model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
find();

The found details appear in the selection

model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
detail();

To get the number of found details, type

int nd = model.component(<ctag>).geom(<tag>).
defeaturing("Fillets").detail().size();

To get the names of the found details, type

String[] filletNames = model.component(<ctag>).geom(<tag>).


defeaturing("Fillets").detail().groupNames();

In general, a detail (fillet in this case) consists of a number of geometric entities. For
example, a fillet consists of a number of faces. To get the entity numbers in the nth
detail, type

int[] entities = model.component(<ctag>).geom(<tag>).


defeaturing("Fillets").detail().groupEntities(n);

To get the object that contains the nth detail, type

String oname = model.component(<ctag>).geom(<tag>).


defeaturing("Fillets").detail().groupObject(n);

To delete all details found, type

model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
deleteAll(<ftag>);

This adds a feature, tagged <ftag>, that performs the deletion operation to the
geometry sequence, after the current feature, and build this feature. In this case, it adds
a DeleteFillets feature.

To delete a subset of the details found, type, for example

model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
detail().setGroup(2,5);

DEFEATURING TOOLS | 53
to delete fillets number 2 and 5. You can also use, for example,

model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
detail().addGroup(7,8);
model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
detail().removeGroup(3);

to add and remove details from the selection. Perform the deletion by typing

model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
delete(<ftag>);

This adds a DeleteFillets feature tagged <ftag> after the current feature in the
geometry sequence.

DEFEATURING METHODS
model.component(<ctag>).geom(<tag>).feature(<ftag>).find() searches for
small details, for a defeaturing feature <ftag>.

model.component(<ctag>).geom(<tag>).defeaturing(tooltag).find()
searches for small details, for a defeaturing tool tooltag.

model.component(<ctag>).geom(<tag>).defeaturing(tooltag).detail().
selMethod manipulates the selection of details to remove, for a defeaturing tool
tooltag.

model.component(<ctag>).geom(<tag>).feature(<ftag>).detail().
selMethod manipulates the selection of details to remove, for a defeaturing feature
<ftag>.

model.component(<ctag>).geom(<tag>).defeaturing(tooltag).
delete(<ftag>) creates a defeaturing feature of type tooltag, tagged <ftag>, with
the properties currently specified in the defeaturing tool. The property delete of the
created feature is set to selected. If the feature <ftag> can be built, it is inserted in
the geometry sequence after the current feature, otherwise the feature is discarded.

model.component(<ctag>).geom(<tag>).defeaturing(tooltag).
deleteAll(<ftag>) creates a defeaturing feature of type tooltag, tagged <ftag>,
with the properties currently specified in the defeaturing tool. The property delete of
the created feature is set to all. If the feature <ftag> can be built, it is inserted in the
geometry sequence after the current feature, otherwise the feature is discarded.

54 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


DEFEATURING SELECTION METHODS
For a defeaturing selection sel the following methods are available, in addition to the
methods available for a general geometry selection.

Geometry Object Selection Methods in the COMSOL Multiphysics


Programming Reference Manual

The find method on the corresponding feature or defeaturing tool provides the
defeaturing selection with a list of details. Each detail is a group of geometric entities.
Group numbers, <groups>, is an array of integers that index into the list of details.

You can select groups either by explicitly referring to group numbers, or by selecting
geometric entities. In the latter case, any group that has non-empty intersection with
the provided entity selection is selected.

int[] sel.group(<groups>) returns the group numbers for the selected groups.

sel.addGroup(<groups>) adds the specified groups to the selection.

sel.setGroup(<groups>) sets the selection groups.

sel.removeGroup(<groups>) removes the specified groups from the selection.

String[] sel.groupNames() returns a list of names of the groups found.

String sel.groupObject(<group>) returns the name of the geometry object that


contains the specified detail group.

int[] sel.groupEntities(<group>) returns the entity numbers of the specified


detail group.

int sel.size() returns the number of detail groups found.

Defeaturing Tools — Delete Faces


Use the DeleteFaces tool to delete faces and replace them either with a new face or
by growing or shrinking the adjacent faces. Select the faces to delete and properties for
the operation like in the corresponding feature DeleteFaces. The deletion is
performed when you issue the command

model.component(<ctag>).geom(<tag>).defeaturing("DeleteFaces").
delete(<ftag>);

DEFEATURING TOOLS | 55
This adds a DeleteFaces feature tagged <ftag> after the current feature in the
geometry sequence.

Defeaturing Tools — Detach Faces


Use the DetachFaces tool to detach faces from a solid object (the parent) to form a
new solid object (the child). Select the faces to detach and properties for the operation
like in the corresponding feature DetachFaces. The detach operation is performed
when you issue the command

model.component(<ctag>).geom(<tag>).defeaturing("DetachFaces").
delete(<ftag>);

Defeaturing Tools — Detect Interferences


Access the DetectInterferences tool by the command

GeomDefeature tool = model.component(<ctag>).geom(<tag>).


defeaturing("DetectInterferences");

To access the input objects selection, use

GeomObjectSelection input = tool.selection("input");

To set the tolerance, use

tool.set("abstol", value);

To find interferences, type

tool.find();

To access the resulting interferences, use

GeomObjectGroupSelection interf = tool.detail();

Each node listed in Interfering faces list in the user interface corresponds to a group
of faces in GeomObjectGroupSelection. To access the data for a group, use its integer
group index:

String label = interf.groupNames()[group];


String objName = interf.groupObject(group);
int[] faces = interf.groupEntities(group);
double gapSize = interf.entSize(group)[0];

The face numbers in the groups do not refer to the input objects. Rather, they refer to
objects in a local state, where the tool has imprinted edges where objects interfere. To
hide faces in the local state, first type

56 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


tool.localState(true);

to enter the local state. After doing the hiding, type

tool.localState(false);

to exit the local state.

See also DetectInterferences.

DEFEATURING TOOLS | 57
Summary of Commands
• CapFaces • Import 3D CAD
• Check • Knit
• ConvertToCOMSOL • Projection
• DeleteFaces • Repair
• DeleteFillets
• DeleteHoles
• DeleteShortEdges
• DeleteSliverFaces
• DeleteSmallFaces
• DeleteSpikes
• DetachFaces
• DetectInterferences
• Export, ExportFinal

58 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


C o m m a nds G r ou p ed b y Fu n c t i on
Commands for Creating and Modifying Geometry in 2D

FUNCTION PURPOSE

Projection Project 3D objects and entities to a 2D work plane

Commands for Defeaturing

FUNCTION PURPOSE

DeleteFaces Delete faces from CAD objects and heal the


wounds
DeleteFillets Find and delete fillets in CAD objects
DeleteHoles Find and delete holes in CAD objects
DeleteShortEdges Find and delete short edges in CAD objects
DeleteSliverFaces Find and delete sliver faces in CAD objects
DeleteSmallFaces Find and delete small faces in CAD objects
DeleteSpikes Find and delete spikes in CAD objects
DetachFaces Detach faces from CAD objects to form a new
solid
DetectInterferences Detect intersections, touches, gaps, and
containments between CAD objects

Commands for File Import, Export, Conversion and Repair

FUNCTION PURPOSE

Check Check the validity of CAD objects


ConvertToCOMSOL Convert CAD Import Module geometry objects to
COMSOL objects
Export, ExportFinal Export geometry objects to a 3D CAD file
Import 3D CAD Import geometry objects from a 3D CAD file
Knit Knit surface CAD objects to form solids or surface
objects
Repair Repair CAD objects

COMMANDS GROUPED BY FUNCTION | 59


Commands for Creating and Modifying Geometry in 3D

FUNCTION PURPOSE

CapFaces Add cap faces to fill holes in CAD geometries

60 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


Commands in Alphabetical Order
CapFaces

PURPOSE
Add cap faces to objects.

SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"CapFaces");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
setAttribute(attribute,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getAttribute(attribute);

DESCRIPTION
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"CapFaces")

creates a CapFaces feature. A cap face is created for each loop of edges in the input
selection. The cap faces are joined with the original objects. If new domains are created
by the cap faces, these domains are made solid.

The input selection can contain more than one edge loop, but no two loops can have
edges or vertices in common.

The input selection can contain edges from more than one object. In this case, each
object is processed individually.
TABLE 3-1: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

input Selection The input edges.


selresult on | off off Create selections of all
resulting objects.

COMMANDS IN ALPHABETICAL ORDER | 61


TABLE 3-1: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

selresultshow all | obj | dom Show selections of resulting


dom | bnd | objects in physics, materials,
edg | pnt | and so on, or in part
off instances. obj is not available
in a component’s geometry.
dom, bnd, and edg are not
available in all features.
contributeto String none Tag of cumulative selection to
contribute to.
The following attributes are available:
TABLE 3-2: VALID ATTRIBUTES

NAME VALUE DEFAULT DESCRIPTION

construction on | off | inherit Designate the resulting objects as


inherit construction geometry. Use inherit to set
the construction geometry attribute only if
all input objects are construction geometry.

Check
Check the validity of CAD objects.

SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"Check");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property)

DESCRIPTION
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"Check") creates a check feature tagged <ftag>. The following
properties are available.
TABLE 3-3: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

input Selection Names of input objects

62 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


SEE ALSO
Repair

ConvertToCOMSOL
Convert CAD objects to COMSOL objects.

SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"ConvertToCOMSOL");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
setAttribute(attribute,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getAttribute(attribute);

DESCRIPTION
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"ConvertToCOMSOL")

creates a ConvertToCOMSOL feature.


TABLE 3-4: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

input Selection Names of input objects.


selresult on | off off Create selections of all
resulting objects.
selresultshow all | obj | dom Show selections of resulting
dom | bnd | objects in physics, materials,
edg | pnt | and so on, or in part
off instances. obj is not available
in a component’s geometry.
dom, bnd, and edg are not
available in all features.
contributeto String none Tag of cumulative selection to
contribute to.

COMMANDS IN ALPHABETICAL ORDER | 63


The following attributes are available:
TABLE 3-5: VALID ATTRIBUTES

NAME VALUE DEFAULT DESCRIPTION

construction on | off | inherit Designate the resulting objects as


inherit construction geometry. Use inherit to set
the construction geometry attribute only if
all input objects are construction geometry.

SEE ALSO
Import 3D CAD

DeleteFaces
Delete faces from CAD objects and heal the wounds.

SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"DeleteFaces");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property);

model.component(<ctag>).geom(<tag>).defeaturing("DeleteFaces").
selection(property)
model.component(<ctag>).geom(<tag>).defeaturing("DeleteFaces").
set(property,<value>);
model.component(<ctag>).geom(<tag>).defeaturing("DeleteFaces").
delete(<ftag>);

DESCRIPTION
model.component(<ctag>).geom(<tag>).defeaturing("DeleteFaces").
delete(<ftag>) creates a DeleteFaces feature tagged <ftag> with the specified
properties. If the feature can be built, it is inserted in the geometry sequence after the
current feature; otherwise, the feature is discarded.

64 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


It is also possible to create a DeleteFaces feature using the standard create method.
TABLE 3-6: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

input Selection Faces to delete.


heal fill | patch patch Healing method.
throughhole on | off off Heal as if the removed faces are a
through hole.
selresult on | off off Create selections of all resulting
objects.
selresultshow all | obj | dom | dom Show selections of resulting
bnd | edg | pnt | objects in physics, materials, and
off so on, or in part instances. obj is
not available in a component’s
geometry. dom, bnd, and edg are
not available in all features.
contributeto String none Tag of cumulative selection to
contribute to.

The faces in the property input are deleted from their objects. The resulting object is
healed so that a solid object is obtained. If heal is fill, a new face is formed based on
the surrounding edges of each wound. If heal is patch, the surrounding faces of each
wound are grown or shrunk to heal the wound.

When you delete through holes, set the throughhole property to on to indicate that
the two wounds from where the hole entered and exited the geometry are to be healed
independently instead of as a single wound. If throughhole is off, the wound would
be healed with a single new face that would just recreate the hole.

EXAMPLE
The following example imports the file defeaturing_demo_2.mphbin, and removes
a hole from the geometry model.

Model model = ModelUtil.create("Model1");


model.component.create("comp1");
model.component("comp1").geom().create("geom1",3);
model.component("comp1").geom("geom1").feature().
create("imp1","Import");
model.component("comp1").geom("geom1").feature("imp1").
set("filename","defeaturing_demo_2.mphbin");
model.component("comp1").geom("geom1").run("imp1");
model.component("comp1").geom("geom1").feature().
create("dfa1","DeleteFaces");

COMMANDS IN ALPHABETICAL ORDER | 65


model.component("comp1").geom("geom1").feature("dfa1").
selection("input").set("imp1",6,7,8,9,11,12,13);
model.component("comp1").geom("geom1").run();

COMPATIBILITY
The following property is no longer supported:
TABLE 3-7: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

Out stx | ftx | ctx | none Output variables


ptx

SEE ALSO
DeleteFillets, DeleteSliverFaces, DeleteSmallFaces, Export, ExportFinal

DeleteFillets
Find and delete fillets in CAD objects.

SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"DeleteFillets");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).find();
model.component(<ctag>).geom(<tag>).feature(<ftag>).detail();

model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
selection(property);
model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
set(property,<value>);
model.component(<ctag>).geom(<tag>).defeaturing("Fillets").find();
model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
detail();
model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
delete(<ftag>);
model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
deleteAll(<ftag>);

DESCRIPTION
model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
delete(<ftag>)

66 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


creates a DeleteFillets feature tagged <ftag> with the specified properties. The
property delete is set to selected. If the feature can be built, it is inserted in the
geometry sequence after the current feature; otherwise, the feature is discarded.

model.component(<ctag>).geom(<tag>).defeaturing("Fillets").
deleteAll(<ftag>) works as the delete method, but the property delete is set to
all.

It is also possible to create the DeleteFillets feature using the standard create
method. The following properties are available..
TABLE 3-8: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

delete all | selected selected Delete all fillets of given size, or


a selection. Only available for
the feature.
entsize double 1e-3 Maximum fillet radius.
input Selection Names of input objects.
selresult on | off off Create selections of all resulting
objects.
selresultshow all | obj | dom | dom Show selections of resulting
bnd | edg | pnt | objects in physics, materials, and
off so on, or in part instances. obj
is not available in a component’s
geometry. dom, bnd, and edg
are not available in all features.
contributeto String none Tag of cumulative selection to
contribute to.

model.component(<ctag>).geom(<tag>).feature(<ftag>).find() searches the


input objects for fillets with radius less than entsize.

model.component(<ctag>).geom(<tag>).feature(<ftag>).detail() returns a
selection object where you can select a subset of the fillets found.

The find and detail methods of

model.component(<ctag>).geom(<tag>).defeaturing("Fillets")

have the corresponding functionality for the defeaturing tool.

Only faces that can be deleted without invalidating the object are deleted. If a fillet was
not possible to delete, a warning is given, accessible through
model.geom(<tag>).feature(<ftag>).problem().

COMMANDS IN ALPHABETICAL ORDER | 67


COMPATIBILITY
The following property is no longer supported:
TABLE 3-9: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

Out stx | ftx | ctx | none Output variables


ptx

EXAMPLE
The following example imports the CAD object in the COMSOL Multiphysics
geometry file defeaturing_demo_3.mphbin and finds all fillets with radius less than
4·10−3. The first of these fillets is deleted.

Model model = ModelUtil.create("Model1");


model.component.create("comp1");
model.component("comp1").geom().create("geom1",3);
model.component("comp1").geom("geom1").feature().
create("imp1","Import");
model.component("comp1").geom("geom1").feature("imp1").
set("filename", "defeaturing_demo_3.mphbin");
model.component("comp1").geom("geom1").run("imp1");
model.component("comp1").geom("geom1").feature().
create("dfi1","DeleteFillets");
model.component("comp1").geom("geom1").feature("dfi1").
selection("input").
set("imp1");
model.component("comp1").geom("geom1").feature("dfi1").
set("entsize",4e-3);
model.component("comp1").geom("geom1").feature("dfi1").find();
model.component("comp1").geom("geom1").feature("dfi1").detail().
setGroup(1);
model.component("comp1").geom("geom1").run();

SEE ALSO
DeleteFaces

DeleteHoles
Find and delete holes in CAD objects.

68 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"DeleteHoles");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).find();
model.component(<ctag>).geom(<tag>).feature(<ftag>).detail();

model.component(<ctag>).geom(<tag>).defeaturing("Holes").
selection(property);
model.component(<ctag>).geom(<tag>).defeaturing("Holes").
set(property,<value>);
model.component(<ctag>).geom(<tag>).defeaturing("Holes").find();
model.component(<ctag>).geom(<tag>).defeaturing("Holes").detail();
model.component(<ctag>).geom(<tag>).defeaturing("Holes").
delete(<ftag>);
model.component(<ctag>).geom(<tag>).defeaturing("Holes").
deleteAll(<ftag>);

DESCRIPTION
model.component(<ctag>).geom(<tag>).defeaturing("Holes").
delete(<ftag>) creates a DeleteHoles feature tagged <ftag> with the specified
properties. The property delete is set to selected. If the feature can be built, it is
inserted in the geometry sequence after the current feature; otherwise, the feature is
discarded.

model.component(<ctag>).geom(<tag>).defeaturing("Holes").
deleteAll(<ftag>) works as the delete method, but the property delete is set to
all.

It is also possible to create the DeleteHoles feature using the standard create
method. The following properties are available..
TABLE 3-10: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

delete all | selected selected Delete all holes of given size, or


a selection. Only available for
the feature.
entsize double 1e-3 Maximum hole radius.
input Selection Names of input objects.

COMMANDS IN ALPHABETICAL ORDER | 69


TABLE 3-10: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

selresult on | off off Create selections of all resulting


objects.
selresultshow all | obj | dom | dom Show selections of resulting
bnd | edg | pnt | objects in physics, materials, and
off so on, or in part instances. obj
is not available in a component’s
geometry. dom, bnd, and edg
are not available in all features.
contributeto String none Tag of cumulative selection to
contribute to.
model.component(<ctag>).geom(<tag>).feature(<ftag>).find() searches the
input objects for holes with radius less than entsize.

model.component(<ctag>).geom(<tag>).feature(<ftag>).detail() returns a
selection object where you can select a subset of the holes found.

The find and detail methods of


model.component(<ctag>).geom(<tag>).defeaturing("Holes") have the
corresponding functionality for the defeaturing tool.

Only faces that can be deleted without invalidating the object are deleted. If a hole was
not possible to delete, a warning is given, accessible through
model.component(<ctag>).geom(<tag>).feature(<ftag>).problem().

COMPATIBILITY
The following property is no longer supported:
TABLE 3-11: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

Out stx | ftx | ctx | none Output variables


ptx

EXAMPLE
The following example imports the CAD object in the COMSOL Multiphysics
geometry file defeaturing_demo_3.mphbin and finds all holes with radius less than
4·10−2. The first four of these holes are deleted.

Model model = ModelUtil.create("Model1");


model.component.create("comp1");
model.component("comp1").geom().create("geom1",3);

70 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


model.component("comp1").geom("geom1").feature().
create("imp1","Import");
model.component("comp1").geom("geom1").feature("imp1").
set("filename", "defeaturing_demo_3.mphbin");
model.component("comp1").geom("geom1").run("imp1");
model.component("comp1").geom("geom1").feature().
create("dho1","DeleteHoles");
model.component("comp1").geom("geom1").feature("dho1").
selection("input").
set("imp1");
model.component("comp1").geom("geom1").feature("dho1").
set("entsize",4e-2);
model.component("comp1").geom("geom1").feature("dho1").find();
model.component("comp1").geom("geom1").feature("dho1").
detail().setGroup(1, 2, 3, 4);
model.component("comp1").geom("geom1").run();

SEE ALSO
DeleteFaces

DeleteShortEdges
Find and delete short edges in CAD objects.

COMMANDS IN ALPHABETICAL ORDER | 71


SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"DeleteShortEdges");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).find();
model.component(<ctag>).geom(<tag>).feature(<ftag>).detail();

model.component(<ctag>).geom(<tag>).defeaturing("ShortEdges").
selection(property);
model.component(<ctag>).geom(<tag>).defeaturing("ShortEdges").
set(property,<value>);
model.component(<ctag>).geom(<tag>).defeaturing("ShortEdges").
find();
model.component(<ctag>).geom(<tag>).defeaturing("ShortEdges").
detail();
model.component(<ctag>).geom(<tag>).defeaturing("ShortEdges").
delete(<ftag>);
model.component(<ctag>).geom(<tag>).defeaturing("ShortEdges").
deleteAll(<ftag>);

DESCRIPTION
model.component(<ctag>).geom(<tag>).defeaturing("ShortEdges").
delete(<ftag>) creates a DeleteShortEdges feature tagged <ftag> with the
specified properties. The property delete is set to selected. If the feature can be
built, it is inserted in the geometry sequence after the current feature; otherwise, the
feature is discarded.

model.component(<ctag>).geom(<tag>).defeaturing("ShortEdges").
deleteAll(<ftag>) works as the delete method, but the property delete is set to
all.

It is also possible to create a DeleteShortEdges feature using the standard create


method. The following properties are available.
TABLE 3-12: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

delete all | selected selected Delete all edges of given size, or


a selection. Only available for the
feature.
entsize double 1e-3 Maximum edge length

72 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


TABLE 3-12: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

input Selection Names of input objects


selresult on | off off Create selections of all resulting
objects.
selresultshow all | obj | dom | dom Show selections of resulting
bnd | edg | pnt | objects in physics, materials, and
off so on, or in part instances. obj is
not available in a component’s
geometry. dom, bnd, and edg are
not available in all features.
contributeto String none Tag of cumulative selection to
contribute to.
model.component(<ctag>).geom(<tag>).feature(<ftag>).find() searches the
input objects for edges of length less than entsize.

model.component(<ctag>).geom(<tag>).feature(<ftag>).detail() returns a
selection object where you can select a subset of the edge sets found.

The find and detail methods of


model.component(<ctag>).geom(<tag>).defeaturing("ShortEdges") have
the corresponding functionality for the defeaturing tool.

Only edges that can be deleted without invalidating the object are deleted. If an edge
was not possible to delete, a warning is given, accessible through
model.component(<ctag>).geom(<tag>).feature(<ftag>).problem().

COMPATIBILITY
The lengths of the edges are no longer returned.

The following property is no longer supported:


TABLE 3-13: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

Out stx | ftx | ctx | none Output variables


ptx

EXAMPLE
The following example imports the file defeaturing_demo_4.x_b and finds all edges
with length less than 3·10−3. The first of these edges is deleted.

Model model = ModelUtil.create("Model1");


model.component.create("comp1");

COMMANDS IN ALPHABETICAL ORDER | 73


model.component("comp1").geom().create("geom1",3);
model.component("comp1").geom("geom1").feature().
create("imp1","Import");
model.component("comp1").geom("geom1").feature("imp1").
set("filename", "defeaturing_demo_4.x_b");
model.component("comp1").geom("geom1").runAll();
model.component("comp1").geom("geom1").feature().
create("dse1","DeleteShortEdges");
model.component("comp1").geom("geom1").feature("dse1").
selection("input").
set("imp1");
model.component("comp1").geom("geom1").feature("dse1").
set("entsize",3e-3);
model.component("comp1").geom("geom1").feature("dse1").find();
model.component("comp1").geom("geom1").feature("dse1").
detail().setGroup(1);
model.component("comp1").geom("geom1").runAll();

DeleteSliverFaces
Find and delete sliver faces in CAD objects.

SYNTAX
model.component(<ctag>).geom(gname).feature().
create(<ftag>,"DeleteSliverFaces");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).find();
model.component(<ctag>).geom(<tag>).feature(<ftag>).detail();

model.component(<ctag>).geom(<tag>).defeaturing("SliverFaces").
selection(property);
model.component(<ctag>).geom(<tag>).defeaturing("SliverFaces").
set(property,<value>);
model.component(<ctag>).geom(<tag>).defeaturing("SliverFaces").
find();
model.component(<ctag>).geom(<tag>).defeaturing("SliverFaces").
detail();
model.component(<ctag>).geom(<tag>).defeaturing("SliverFaces").
delete(<ftag>);
model.component(<ctag>).geom(<tag>).defeaturing("SliverFaces").
deleteAll(<ftag>);

74 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


DESCRIPTION
model.component(<ctag>).geom(<tag>).defeaturing("SliverFaces").
delete(<ftag>) creates a DeleteSliverFaces feature tagged <ftag> with the
specified properties. The property delete is set to selected. If the feature can be
built, it is inserted in the geometry sequence after the current feature; otherwise, the
feature is discarded.

model.component(<ctag>).geom(<tag>).defeaturing("SliverFaces").
deleteAll(<ftag>) works as the delete method, but the property delete is set to
all.

It is also possible to create a DeleteSliverFaces feature using the standard create


method. The following properties are available.
TABLE 3-14: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

delete all | selected selected Delete all sliver faces of given


width, or a selection. Only
available for the feature.
entsize double 1e-3 Maximum face width.
input Selection Names of input objects.
selresult on | off off Create selections of all resulting
objects.
selresultshow all | obj | dom | dom Show selections of resulting
bnd | edg | pnt | objects in physics, materials, and
off so on, or in part instances. obj is
not available in a component’s
geometry. dom, bnd, and edg are
not available in all features.
contributeto String none Tag of cumulative selection to
contribute to.

Sliver faces are narrow but long faces with large aspect ratio, which usually give rise to
extremely fine local meshes in their vicinity.

model.component(<ctag>).geom(<tag>).feature(<ftag>).find() searches the


input objects for faces with width less than entsize.

model.component(<ctag>).geom(<tag>).feature(<ftag>).detail() returns a
selection object where you can select a subset of the faces found.

COMMANDS IN ALPHABETICAL ORDER | 75


The find and detail methods of
model.component(<ctag>).geom(<tag>).defeaturing("SliverFaces") have
the corresponding functionality for the defeaturing tool.

Only faces that can be deleted without invalidating the object are deleted. If a face was
not possible to delete, a warning message is given.

COMPATIBILITY
The following property is no longer supported:
TABLE 3-15: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

Out stx | ftx | ctx | none Output variables


ptx | status

EXAMPLE
The following example imports the geometry model from the file
defeaturing_demo_5.x_b, finds sliver faces narrower than 2·10−3, and deletes the
first of these.

Model model = ModelUtil.create("Model1");


model.component.create("comp1");
model.component("comp1").geom().create("geom1",3);
model.component("comp1").geom("geom1").feature().
create("imp1","Import");
model.component("comp1").geom("geom1").feature("imp1").
set("filename", "defeaturing_demo_5.x_b");
model.component("comp1").geom("geom1").runAll();
model.component("comp1").geom("geom1").feature().
create("dsl1","DeleteSliverFaces");
model.component("comp1").geom("geom1").feature("dsl1").
selection("input").
set("imp1");
model.component("comp1").geom("geom1").feature("dsl1").
set("entsize",2e-3);
model.component("comp1").geom("geom1").feature("dsl1").find();
model.component("comp1").geom("geom1").feature("dsl1").detail().
setGroup(1);
model.component("comp1").geom("geom1").runAll();

SEE ALSO
DeleteFaces, DeleteSmallFaces

76 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


DeleteSmallFaces
Find and delete small faces in CAD objects.

SYNTAX
model.component(<ctag>).geom(gname).feature().
create(<ftag>,"DeleteSmallFaces");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).find();
model.component(<ctag>).geom(<tag>).feature(<ftag>).detail();

model.component(<ctag>).geom(<tag>).defeaturing("SmallFaces").
selection(property);
model.component(<ctag>).geom(<tag>).defeaturing("SmallFaces").
set(property,<value>);
model.component(<ctag>).geom(<tag>).defeaturing("SmallFaces").
find();
model.component(<ctag>).geom(<tag>).defeaturing("SmallFaces").
detail();
model.component(<ctag>).geom(<tag>).defeaturing("SmallFaces").
delete(<ftag>);
model.component(<ctag>).geom(<tag>).defeaturing("SmallFaces").
deleteAll(<ftag>);

DESCRIPTION
model.component(<ctag>).geom(<tag>).defeaturing("SmallFaces").
delete(<ftag>) creates a DeleteSmallFaces feature tagged <ftag> with the
specified properties. The property delete is set to selected. If the feature can be
built, it is inserted in the geometry sequence after the current feature; otherwise, the
feature is discarded.

model.component(<ctag>).geom(<tag>).defeaturing("SmallFaces").
deleteAll(<ftag>) works as the delete method, but the property delete is set to
all.

COMMANDS IN ALPHABETICAL ORDER | 77


It is also possible to create a DeleteSmallFaces feature using the standard create
method. The following properties are available.
TABLE 3-16: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

delete all | selected selected Delete all small faces of given


size, or a selection. Only
available for the feature.
entsize double 1e-3 Maximum face size.
input Selection Names of input objects.
selresult on | off off Create selections of all resulting
objects.
selresultshow all | obj | dom | dom Show selections of resulting
bnd | edg | pnt | objects in physics, materials, and
off so on, or in part instances. obj is
not available in a component’s
geometry. dom, bnd, and edg are
not available in all features.
contributeto String none Tag of cumulative selection to
contribute to.

A small face is a face that fits within a sphere of specified radius, given in the property
entsize.

model.component(<ctag>).geom(<tag>).feature(<ftag>).find() searches the


input objects for faces with size less than entsize.

model.component(<ctag>).geom(<tag>).feature(<ftag>).detail() returns a
selection object where you can select a subset of the faces found.

The find and detail methods of


model.component(<ctag>).geom(<tag>).defeaturing("SmallFaces") have
the corresponding functionality for the defeaturing tool.

Only faces that can be deleted without invalidating the object are deleted. If a face was
not possible to delete, a warning message is given, accessible through
model.component(<ctag>).geom(<tag>).feature(<ftag>).problem().

78 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


COMPATIBILITY
The following property is no longer supported:
TABLE 3-17: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

Out stx | ftx | ctx | none Output variables.


ptx | status

EXAMPLE
The following example imports the geometry model from the file
defeaturing_demo_6.x_b, finds sliver faces narrower than 10−3, and deletes the first
of these.

Model model = ModelUtil.create("Model1");


model.component.create("comp1");
model.component("comp1").geom().create("geom1",3);
model.component("comp1").geom("geom1").feature().
create("imp1","Import");
model.component("comp1").geom("geom1").feature("imp1").
set("filename", "defeaturing_demo_6.x_b");
model.component("comp1").geom("geom1").runAll();
model.component("comp1").geom("geom1").feature().
create("df1","DeleteSmallFaces");
model.component("comp1").geom("geom1").feature("df1").
selection("input").
set("imp1");
model.component("comp1").geom("geom1").feature("df1").find();
model.component("comp1").geom("geom1").feature("df1").detail().
setGroup(1);
model.component("comp1").geom("geom1").run();

SEE ALSO
DeleteFaces, DeleteSliverFaces

DeleteSpikes
Find and delete spikes in CAD objects.

COMMANDS IN ALPHABETICAL ORDER | 79


SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"DeleteSpikes");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).find();
model.component(<ctag>).geom(<tag>).feature(<ftag>).detail();

model.component(<ctag>).geom(<tag>).defeaturing("Spikes").
selection(property);
model.component(<ctag>).geom(<tag>).defeaturing("Spikes").
set(property,<value>);
model.component(<ctag>).geom(<tag>).defeaturing("Spikes").find();
model.component(<ctag>).geom(<tag>).defeaturing("Spikes").detail();
model.component(<ctag>).geom(<tag>).defeaturing("Spikes").
delete(<ftag>);
model.component(<ctag>).geom(<tag>).defeaturing("Spikes").
deleteAll(<ftag>);

DESCRIPTION
model.component(<ctag>).geom(<tag>).defeaturing("DeleteSpikes").
delete(<ftag>) creates a DeleteSpikes feature tagged <ftag> with the specified
properties. The property delete is set to selected. If the feature can be built, it is
inserted in the geometry sequence after the current feature; otherwise, the feature is
discarded.

model.component(<ctag>).geom(<tag>).defeaturing("DeleteSpikes").
deleteAll(<ftag>) works as the delete method, but the property delete is set to
all.

It is also possible to create a DeleteSpikes feature using the standard create


method. The following properties are available.
TABLE 3-18: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

delete all | selected selected Delete all spikes of given width,


or a selection. Only available for
the feature.
entsize double 1e-3 Maximum spike width.
input Selection Names of input objects.

80 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


TABLE 3-18: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

selresult on | off off Create selections of all resulting


objects.
selresultshow all | obj | dom | dom Show selections of resulting
bnd | edg | pnt | objects in physics, materials, and
off so on, or in part instances. obj is
not available in a component’s
geometry. dom, bnd, and edg are
not available in all features.
contributeto String none Tag of cumulative selection to
contribute to.
A spike is a long and narrow protrusion on an edge or corner of a face defined by two
or three edges.

model.component(<ctag>).geom(<tag>).feature(<ftag>).find() searches the


input objects for spikes of width less than entsize.

model.component(<ctag>).geom(<tag>).feature(<ftag>).detail() returns a
selection object where you can select a subset of the spikes found.

The find and detail methods of


model.component(<ctag>).geom(<tag>).defeaturing("Spikes") have the
corresponding functionality for the defeaturing tool.

Only spikes that can be deleted without invalidating the object are deleted. If a spike
was not possible to delete, a warning message is given, accessible through
model.component(<ctag>).geom(<tag>).feature(<ftag>).problem().

COMPATIBILITY
The width of each spike is no longer returned.

The following property is no longer supported:


TABLE 3-19: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

Out stx | ftx | ctx | none Output variables.


ptx | status

COMMANDS IN ALPHABETICAL ORDER | 81


EXAMPLE
The following example imports the geometry model from the file
−4
defeaturing_demo_7.x_b, finds all spikes narrower than 10 , and deletes the first
of these.

Model model = ModelUtil.create("Model1");


model.component.create("comp1");
model.component("comp1").geom().create("geom1",3);
model.component("comp1").geom("geom1").feature().
create("imp1","Import");
model.component("comp1").geom("geom1").feature("imp1").
set("filename", "defeaturing_demo_7.x_b");
model.component("comp1").geom("geom1").runAll();
model.component("comp1").geom("geom1").feature().
create("dsp1","DeleteSpikes");
model.component("comp1").geom("geom1").feature("dsp1").
selection("input").
set("imp1");
model.component("comp1").geom("geom1").feature("dsp1").
set("entsize",1e-4);
model.component("comp1").geom("geom1").feature("dsp1").find();
model.component("comp1").geom("geom1").feature("dsp1").detail().
setGroup(1);
model.component("comp1").geom("geom1").runAll();

SEE ALSO
DeleteShortEdges, DeleteSliverFaces

DetachFaces
Detach faces from CAD objects to form a new (child) solid.

82 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"DetachFaces");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property);

model.component(<ctag>).geom(<tag>).defeaturing("DetachFaces").
selection(property);
model.component(<ctag>).geom(<tag>).defeaturing("DetachFaces").
set(property,<value>);
model.component(<ctag>).geom(<tag>).defeaturing("DetachFaces").
delete(<ftag>);

DESCRIPTION
model.component(<ctag>).geom(<tag>).defeaturing("DetachFaces").
delete(<ftag>) creates a DetachFaces feature tagged <ftag> with the specified
properties. If the feature can be built, it is inserted in the geometry sequence after the
current feature; otherwise, the feature is discarded.

It is also possible to create a DetachFaces feature using the standard create method.
TABLE 3-20: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

input Selection Faces to detach.


healchild fill | patchparent Healing method used on the
patchchild | child object.
patchparent
healparent fill | patch patch Healing method used on the
parent object.
selresult on | off off Create selections of all
resulting objects.
selresultshow all | obj | dom dom Show selections of resulting
| bnd | edg | objects in physics, materials,
pnt | off and so on, or in part
instances. obj is not available
in a component’s geometry.
dom, bnd, and edg are not
available in all features.
contributeto String none Tag of cumulative selection
to contribute to.

COMMANDS IN ALPHABETICAL ORDER | 83


The faces in the property input are detached from their parent object. A new solid,
the child object, are formed from the detached faces. The output objects are the healed
parent and child objects.

The property healparent determines how the parent object is healed to form a new
solid after detaching the faces. The value fill means that a new face is formed based
on the surrounding edges of each wound. The value patch means that the
surrounding faces of each wound are grown or shrunk.

The property healchild determines how the child solid is constructed from the
detached faces. The value fill means that a new face is formed based on the
surrounding edges of each wound. The value patchchild means that the detached
faces are grown or shrunk to form a solid. The value patchparent means that the
parent faces surrounding the detached faces are grown or shrunk to form a solid
together with the detached faces.

EXAMPLE
The following example imports the COMSOL Multiphysics geometry file
defeaturing_demo_2.mphbin and detaches a hole defined by a set of faces:

Model model = ModelUtil.create("Model1");


model.component.create("comp1");
model.component("comp1").geom().create("geom1",3);
model.component("comp1").geom("geom1").feature().
create("imp1","Import");
model.component("comp1").geom("geom1").feature("imp1").
set("filename", "defeaturing_demo_2.mphbin");
model.component("comp1").geom("geom1").runAll();
model.component("comp1").geom("geom1").feature().
create("det1","DetachFaces");
model.component("comp1").geom("geom1").feature("det1").
selection("input").set("imp1",6,7,8,9,11,12,13);
model.component("comp1").geom("geom1").runAll();

COMPATIBILITY
The following property is no longer supported:
TABLE 3-21: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

Out stx | ftx | ctx | none Output variables


ptx

SEE ALSO
DeleteFaces

84 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


DetectInterferences
Detect intersections, touches, gaps, and containments between CAD objects.

SYNTAX
model.component(<ctag>).geom(<tag>).
defeaturing("DetectInterferences").selection(property);
model.component(<ctag>).geom(<tag>).
defeaturing("DetectInterferences").set(property,<value>);
model.component(<ctag>).geom(<tag>).
defeaturing("DetectInterferences").selection(property);
model.component(<ctag>).geom(<tag>).
defeaturing("DetectInterferences").find();
model.component(<ctag>).geom(<tag>).
defeaturing("DetectInterferences").detail();

DESCRIPTION
See Defeaturing Tools — Detect Interferences.

Available properties:
TABLE 3-22: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

input Selection Input objects


abstol double 0.1[mm] Absolute tolerance
showingraphics interferingonly | selected Objects to show in graphics
selected | other
| both | all
groupbyobject boolean false Group interferences by
object in GUI

Export, ExportFinal
Using the CAD Import Module, Design Module, or a LiveLink product for CAD
software, export selected geometry objects or the finalized geometry to a 3D CAD
format, such as ACIS, Parasolid, STEP, and IGES.

To export selected geometry objects to a file, first select the objects to export using

model.component(<ctag>).geom(<tag>).export().selection().set(<obj
names>);

where <objnames> is a string array of object names. Then export them by entering

model.component(<ctag>).geom(<tag>).export(<filename>);

COMMANDS IN ALPHABETICAL ORDER | 85


To export the finalized geometry to a file, enter

model.component(<ctag>).geom(<tag>).exportFinal(<filename>);

where <filename> is a string.

In the above commands the file extension in the <filename> string determines the file
format, which can be of any of the following:
TABLE 3-23: SUPPORTED FILE FORMATS

FILE FORMAT FILE EXTENSION

Parasolid Binary (3D) .x_b, .xmt_bin


Parasolid Text (3D) .x_t, .xmt_txt
ACIS Binary (3D) .sab
ACIS Text (3D) .sat
IGES File (3D) .igs, .iges
STEP File (3D) .step, .stp

EXPORTING TO AN ACIS FILE


When exporting to an ACIS file you can set the ACIS file format version using

model.component(<ctag>).geom(<tag>).export().setAcisVersion(<vers
ion>);

where <version> is a string 4.0, 7.0, or 2016 1.0. Default is 2016 1.0.

EXPORTING TO A PARASOLID FILE


The Parasolid text or binary file generated by the export is of version 31.0.

When exporting to a Parasolid format, a unit conversion can optionally be performed


during export. Use the following method to select the export length unit:

model.component(<ctag>).geom(<tag>).export().setLengthUnit(<unit>
);

where <unit> is either fromgeom (default) to disable unit conversion or a COMSOL


Multiphysics length unit, such as m for meters or in for inches. To get the current value
of the export length unit type:

model.component(<ctag>).geom(<tag>).export().getLengthUnit();

To decide how the non-manifold objects are exported use the following method:

model.component(<ctag>).geom(<tag>).export().setSplitInManifold(<
value>);

86 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


where <value> is either true (default) to split the objects into manifold objects during
the export, or false to export the unmodified objects.

EXPORTING TO AN IGES FILE


When exporting to the IGES format, a unit conversion can optionally be performed
during export. Use the following method to select the export length unit:

model.component(<ctag>).geom(<tag>).export().setLengthUnitIGES(<u
nit>);

where <unit> is either fromgeom (default) to disable unit conversion or a supported


length unit: uin, um, mil, mm, cm, in, ft, m, km, mi.To get the current value of the
export length unit type:

model.component(<ctag>).geom(<tag>).export().getLengthUnitIGES();

EXPORTING TO A STEP FILE


When exporting to the STEP format, a unit conversion can optionally be performed
during export. Use the following method to select the export length unit:

model.component(<ctag>).geom(<tag>).export().setLengthUnitSTEP(<u
nit>);

where <unit> is either fromgeom (default) to disable unit conversion or a supported


length unit: nm, uin, um, mil, mm, cm, in, dm, ft, m, km, mi. To get the current value of
the export length unit type:

model.component(<ctag>).geom(<tag>).export().getLengthUnitSTEP();

SEE ALSO
Import 3D CAD

Import 3D CAD
Import geometry objects from a 3D CAD file using the CAD Import Module, Design
Module, or a LiveLink product for CAD software.

COMMANDS IN ALPHABETICAL ORDER | 87


SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"Import");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
importData();
model.component(<ctag>).geom(<tag>).feature(<ftag>).
setAttribute(attribute,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getAttribute(attribute);

DESCRIPTION
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"Import") creates an import feature. When the property filename
is set to a filename recognized as a 3D CAD file, the property type is set to cad. The
following properties are available.
TABLE 3-24: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

check on | off Check imported objects for


errors.
filename String Filename.
fillholes on | off off Attempt to generate new faces
to replace missing geometry if
the property knit is solid or
surface
importtol double 1e-5 Absolute repair tolerance.
keepbnd on | off on Import surface objects.
keepfree on | off off Import curve and point objects.
keepsolid on | off on Import solid objects.
knit solid | surface | solid Knit together surface objects
off to form solids or surface
objects.
removeredundant on | off off Remove redundant edges and
vertices.
repair on | off on Repair imported objects.
type cad Type of import.

88 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


TABLE 3-24: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

unit source | current source Take length unit from file or


from the current geometry
unit.
unitecurves on | off on Unite curve objects.
selresult on | off off Create selections of all
resulting objects.
selresultshow all | obj | dom | dom Show selections of resulting
bnd | edg | pnt | objects in physics, materials,
off and so on, or in part instances.
obj is not available in a
component’s geometry. dom,
bnd, and edg are not available
in all features.
contributeto String none Tag of cumulative selection to
contribute to.
The file to import is specified by filename, which can have of any of the following
formats:
TABLE 3-25: SUPPORTED 3D CAD FILE FORMATS

FILE FORMAT NOTE FILE EXTENSION

ACIS 1 .sat, .sab


AutoCAD 1, 3 .dwg, .dxf
CATIA V5 2, 3 .CATPart, .CATProduct
IGES 1 .igs, .iges
Inventor 1, 3 .ipt, .iam
NX 1, 4 .prt
Parasolid 1 .x_t, .x_b
PTC Creo Parametric 1 .prt, .asm
PTC Pro/ENGINEER 1 .prt, .asm
SOLIDWORKS 1, 3, 5 .sldprt, .sldasm
STEP 1 .step, .stp

Note 1: This format requires a license for the CAD Import Module, Design Module,
or a LiveLink product for a CAD package.

COMMANDS IN ALPHABETICAL ORDER | 89


Note 2: This format requires, in addition to the CAD Import Module, Design
Module, or a LiveLink product for a CAD package, a license for the File Import for
CATIA V5 module.

Note 3: Only supported on Windows.

Note 4: Only supported on Linux, or Windows.

Note 5: Embedded parts in assemblies are not supported. To import such an assembly,
first convert the embedded parts to external parts.

The imported geometry objects are represented using the Parasolid geometry kernel,
which is the geometry kernel utilized by the CAD Import Module and the LiveLink
products for CAD software.

The method

model.geom(gname).feature(<ftag>).importData()

imports the file again, even if the feature is built.

The import can generate object, boundary, edge, and point selections based on
material, layer, and color assignments in the 3D CAD file. The following properties are
available for working these selections:
TABLE 3-26: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

selcadshownamesfromfileobj boolean false Show the object selection


names from the file in the
GUI.
selcadnameobj String[] empty Names of object
selections in 3D CAD
import.
selcadnameinfileobj String[] empty Original names of object
selections in 3D CAD
import. Read-only.
selcadkeepobj on | off empty Keep object selections in
3D CAD import.
selcadshowobj on | off empty Show object selections in
3D CAD import in
physics, materials, and so
on; in part instances; or in
3D from a plane
geometry.

90 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


TABLE 3-26: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

selcadcontributetoobj String[] empty Tags of cumulative


selection to contribute to
(or none to not
contribute), for object
selections in 3D CAD
import.
selcadtagobj String[] empty Tags of object selections
(read-only, hidden in GUI)
in 3D CAD import.
selcadcolorobj String[] empty Colors of object
selections (read-only) in
3D CAD import. The
color is stored as a
comma-separated triple
of numbers between 0
and 1. It can also be
"none" (in which case it
will be displayed in
yellow).
selindividualintable boolean false Show individual object
selections and, for the
knit case, individual
original object selections
in the CAD-tables.
selcadshownamesfromfilebnd boolean false Show the boundary
selection names from the
file in the GUI.
selcadnamebnd String[] empty Names of boundary
selections in 3D CAD
import.
selcadnameinfilebnd String[] empty Original names of
boundary selections in
3D CAD import.
Read-only.
selcadkeepbnd on | off empty Keep boundary selections
in 3D CAD import.

COMMANDS IN ALPHABETICAL ORDER | 91


TABLE 3-26: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

selcadshowbnd on | off empty Show boundary


selections in 3D CAD
import in physics,
materials, and so on; in
part instances; or in 3D
from a plane geometry.
selcadcontributetobnd String[] empty Tags of cumulative
selection to contribute to
(or none to not
contribute), for boundary
selections in 3D CAD
import.
selcadtagbnd String[] empty Tags of boundary
selections (read-only,
hidden in GUI) in 3D
CAD import.
selcadcolorbnd String[] empty Colors of boundary
selections (read-only) in
3D CAD import. The
color is stored as a
comma-separated triple
of numbers between 0
and 1. It can also be
"none" (in which case it
will be displayed in
yellow).
selcadshownamesfromfileedg boolean false Show the edge selection
names from the file in the
GUI.
selcadnameedg String[] empty Names of edge selections
in 3D CAD import.
selcadnameinfileedg String[] empty Original names of edge
selections in 3D CAD
import. Read-only.
selcadkeepedg on | off empty Keep edge selections in
3D CAD import.

92 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


TABLE 3-26: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

selcadshowedg on | off empty Show edge selections in


3D CAD import in
physics, materials, and so
on; in part instances; or in
3D from a plane
geometry.
selcadcontributetoedg String[] empty Tags of cumulative
selection to contribute to
(or none to not
contribute), for edge
selections in 3D CAD
import.
selcadtagedg String[] empty Tags of edge selections
(read-only, hidden in GUI)
in 3D CAD import.
selcadcoloredg String[] empty Colors of edge selections
(read-only) in 3D CAD
import. The color is
stored as a
comma-separated triple
of numbers between 0
and 1. It can also be
"none" (in which case it
will be displayed in
yellow).
selcadshownamesfromfilepnt boolean false Show the point selection
names from the file in the
GUI.
selcadnamepnt String[] empty Names of point selections
in 3D CAD import.
selcadnameinfilepnt String[] empty Original names of point
selections in 3D CAD
import. Read-only.
selcadkeeppnt on | off empty Keep point selections in
3D CAD import.

COMMANDS IN ALPHABETICAL ORDER | 93


TABLE 3-26: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

selcadshowpnt on | off empty Show point selections in


3D CAD import in
physics, materials, and so
on; in part instances; or in
3D from a plane
geometry.
selcadcontributetopnt String[] empty Tags of cumulative
selection to contribute to
(or none to not
contribute), for point
selections in 3D CAD
import.
selcadtagpnt String[] empty Tags of point selections
(read-only, hidden in GUI)
in 3D CAD import.
selcadcolorpnt String[] empty Colors of point selections
(read-only) in 3D CAD
import. The color is
stored as a
comma-separated triple
of numbers between 0
and 1. It can also be
"none" (in which case it
will be displayed in
yellow).
The following attributes are available:
TABLE 3-27: VALID ATTRIBUTES

NAME VALUE DEFAULT DESCRIPTION

construction on | off off Designate the resulting objects as construction


geometry.

COMPATIBILITY
The following property is no longer supported:
TABLE 3-28: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

coercion solid | face | solid Alias for knit. face is equivalent


off to surface.

94 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


SEE ALSO
Export, ExportFinal

Knit
Knit surface CAD objects to form solids or surface objects.

SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"Knit");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property)
model.component(<ctag>).geom(<tag>).feature(<ftag>).
setAttribute(attribute,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getAttribute(attribute);

DESCRIPTION
model.component(<ctag>).geom(<ftag>).feature().
create(<ftag>,"Knit") creates a knit feature tagged <ftag>. The following
properties are available.
TABLE 3-29: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

fillholes on | off off Attempt to generate new faces


to replace missing geometry
input Selection Names of input surface objects.
repairtol double 1e-5 Absolute repair tolerance.
selresult on | off off Create selections of all resulting
objects.
selresultshow all | obj | dom | dom Show selections of resulting
bnd | edg | pnt | objects in physics, materials, and
off so on, or in part instances. obj is
not available in a component’s
geometry. dom, bnd, and edg are
not available in all features.
contributeto String none Tag of cumulative selection to
contribute to.

COMMANDS IN ALPHABETICAL ORDER | 95


This function also removes gaps and spikes that are within the absolute tolerance
specified in the property repairtol.

The following attributes are available:


TABLE 3-30: VALID ATTRIBUTES

NAME VALUE DEFAULT DESCRIPTION

construction on | off | inherit Designate the resulting objects as


inherit construction geometry. Use inherit to set
the construction geometry attribute only if
all input objects are construction geometry.

COMPATIBILITY
The following property is no longer supported:
TABLE 3-31: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

Out stx | ftx | ctx | none Output variables.


ptx

EXAMPLE
The following example imports the file repair_demo_2.x_b, and knits the surface
objects into a solid. A gap is also removed during the operation.

Model model = ModelUtil.create("Model1");


model.component.create("comp1");
model.component("comp1").geom().create("geom1",3);
model.component("comp1").geom("geom1").feature().
create("imp1","Import");
model.component("comp1").geom("geom1").feature("imp1").
set("filename","repair_demo_2.x_b");
model.component("comp1").geom("geom1").runAll();
model.component("comp1").geom("geom1").feature().
create("knit1","Knit");
model.component("comp1").geom("geom1").feature("knit1").
selection("input").set("imp1");
model.component("comp1").geom("geom1").feature("knit1").
set("repairtol",1e-3);
model.component("comp1").geom("geom1").runAll();

SEE ALSO
Repair

96 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


Projection

PURPOSE
Project 3D objects and entities to a 2D work plane.

SYNTAX
model.component(<ctag>).geom(<tag>).feature(<wptag>).
geom().create(<ftag>,"Projection");
model.component(<ctag>).geom(<tag>).feature(<wptag>).
geom().feature(<ftag>).selection("input");
model.component(<ctag>).geom(<tag>).feature(<wptag>).
geom().feature(<ftag>).set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<wptag>).
geom().feature(<ftag>).getType(property)
model.component(<ctag>).geom(<tag>).feature(<ftag>).
setAttribute(attribute,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getAttribute(attribute);

DESCRIPTION
Use

model.component(<ctag>).geom(<tag>).feature(<wptag>).geom().
create(<ftag>,"Projection")

to create a projection feature tagged <ftag> in the 2D sequence of the work plane
feature <wptag>. It can compute the projection of 3D objects and entities to the work
plane.

By default, you get the projection for all 3D objects that were generated by the features
preceding the work plane feature. To select a subset of these objects or to select
entities, set the project property to the appropriate entity level, and use the property
input to select the 3D objects or entities.

The following properties are available.


TABLE 3-32: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

absrepairtool ...geom(<tag>). Absolute repair tolerance


absRepairTol()
input Selection Entities to project. Used
when project is not all
project all | obj | all Project all objects or selected
dom | bnd | objects or entites
edg | vtx

COMMANDS IN ALPHABETICAL ORDER | 97


TABLE 3-32: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

projectiontyp edgvtx | outline Projection type. Used when


e outline | project is all, dom, or bnd.
all
repairtol double ...geom(<tag>). Relative repair tolerance,
repairTol() relative to size of each input
object
repairtoltype auto | ...geom(<tag>). Repair tolerance type:
relative | repairTolType() automatic, relative, or
absolute absolute
workplane String Work plane to project onto
selresult on | off off Create selections of all
resulting objects.
selresultshow all | obj | bnd Show selections, if selresult is
bnd | pnt | on, in physics, materials, and
off so on; or in 3D from a plane
geometry. obj is not available
in a component’s geometry
contributeto String none Tag of cumulative selection to
contribute to.
The following attributes are available:
TABLE 3-33: VALID ATTRIBUTES

NAME VALUE DEFAULT DESCRIPTION

construction on | off | inherit Designate the resulting objects as


inherit construction geometry. Use inherit to set
the construction geometry attribute only if
all input objects are construction geometry.

SEE ALSO
CrossSection, WorkPlane

Repair
Repair CAD objects.

98 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


SYNTAX
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"Repair");
model.component(<ctag>).geom(<tag>).feature(<ftag>).
selection(property);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
set(property,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getType(property)
model.component(<ctag>).geom(<tag>).feature(<ftag>).
setAttribute(attribute,<value>);
model.component(<ctag>).geom(<tag>).feature(<ftag>).
getAttribute(attribute);

DESCRIPTION
model.component(<ctag>).geom(<tag>).feature().
create(<ftag>,"Repair")

creates a repair feature tagged <ftag>. The following properties are available.
TABLE 3-34: AVAILABLE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

input Selection Names of input objects


check on | off on Check the input objects for
errors.
repairtol double 1e-5 Absolute repair tolerance
selresult on | off off Create selections of all resulting
objects.
selresultshow all | obj | dom Show selections of resulting
dom | bnd | objects in physics, materials, and
edg | pnt | so on, or in part instances. obj is
off not available in a component’s
geometry. dom, bnd, and edg are
not available in all features.
simplify on | off off Simplify the underlying curve and
surface manifolds of geometric
entities
repairfacetoface on | off off Repair face-to-face
inconsistencies in solid objects
contributeto String none Tag of cumulative selection to
contribute to.

COMMANDS IN ALPHABETICAL ORDER | 99


The function tries to remove or repair the following defects:

• Entities with invalid sense


• Invalid edge and vertex tolerances
• Invalid manifolds
• Self-intersecting manifolds
• Non-G1 manifolds
• Missing edge or vertex manifolds
• Missing vertex
• Vertices not on curve of edge
• Edges and vertices not on surface of face
• Removal of surface self-intersections that lie outside the face
• Splitting at edge intersections which have no vertex
• Removal of discontinuities by either splitting or smoothing
• Remove small features (short edges, small faces, sliver faces, and spikes)

The following attributes are available:


TABLE 3-35: VALID ATTRIBUTES

NAME VALUE DEFAULT DESCRIPTION

construction on | off | inherit Designate the resulting objects as


inherit construction geometry. Use inherit to set
the construction geometry attribute only if
all input objects are construction geometry.

COMPATIBILITY
The following property is no longer supported:
TABLE 3-36: OBSOLETE PROPERTIES

PROPERTY VALUE DEFAULT DESCRIPTION

Out stx | ftx | ctx | none Output variables


ptx

EXAMPLE
The following example imports the file repair_demo_2.x_b, and repairs the resulting
objects.

Model model = ModelUtil.create("Model1");


model.component.create("comp1");

100 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE


model.component("comp1").geom().create("geom1",3);
model.component("comp1").geom("geom1").feature().
create("imp1","Import");
model.component("comp1").geom("geom1").feature("imp1").
set("filename", "repair_demo_2.x_b");
model.component("comp1").geom("geom1").runAll();
model.component("comp1").geom("geom1").feature().
create("rep1","Repair");
model.component("comp1").geom("geom1").feature("rep1").
selection("input"). set("imp1");
model.component("comp1").geom("geom1").feature("rep1").
set("repairtol",1e-3);
model.component("comp1").geom("geom1").runAll();

SEE ALSO
Check, Knit

COMMANDS IN ALPHABETICAL ORDER | 101


102 | CHAPTER 3: PROGRAMMING AND COMMAND REFERENCE
I n d e x
A Application Libraries window 12

C cap faces 32

D defeaturing tools 52
documentation 10

E emailing COMSOL 13
export (of geometries) 25

F filling holes 32

G geometry
exporting to file 25

I internet resources 10

K knowledge base, COMSOL 13

M MPH-files 12

T technical support, COMSOL 13

W websites, COMSOL 13

INDEX| 103
104 | I N D E X

You might also like