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>);
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);
The defeaturing tools Fillets and Holes also support specifying a minimum radius, to do this type (for fillets in this case):
model.component(<ctag>).geom(<tag>).defeaturing("Fillets").set("minentsize",minsize);
To find the details in the specified size interval, 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);
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.
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 nonempty 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.