Model.surfacemark_duplicate_check#
- Model.surfacemark_duplicate_check(collection1, collection2, options, use_plane, plane_normal, plane_base, tol)#
Takes surfaces from two different sets and checks if any surface in one set has an identical counterpart in another set. Optionally, reflection with respect to an input plane is used before checking identity. Only one set of surfaces may also be provided on input if
collection2is set to 0. If a plane is provided (use_plane = 2), then this single set is automatically split into two sets by the surfaces’ position with respect to the input plane. As a result of identity calculations, surfaces are removed or switched between input sets or returned depending on the input options parameter.As a result of surface sets symmetry calculation, input surfaces are separated into four sets. If there are two input sets provided, the meaning of the output sets is:
output_set0 - no identical counterpart was found (unmatched) for surfaces of
collection1.output_set1 - identical counterpart was found (matched) for surfaces of
collection1.output_set2 - no identical counterpart was found (unmatched) for surfaces of
collection2.output_set3 - identical counterpart was found (matched) for surfaces of
collection2.
If only one input set is provided (
collection2=0) , the meaning of the output sets is:output_set0 - surfaces that do not have duplicate counterparts.
output_set1 - “main” surfaces that do have duplicate counterparts (in the set of several identical surfaces, only one surface is selected as “main”).
output_set2 - “secondary” surfaces that have duplicate counterparts.
output_set3 - empty set.
- Parameters:
collection1 (Collection) – The collection containing the surface entities of the first set.
collection2 (Collection) – The collection containing the surface entities of the second set.
options (int) –
Integer value representing combination of flags used to modify function behavior. This parameter is composed of several “action” groups, with each group consisting of several possible values. The value of this parameter is a sum of the required values:
Set selection group - bits 0…3: Since there is a limitation that only two collection values can be used to designate input sets and respectively the same two values are used to mark surfaces in output sets, this means that only two out of four output sets can be selected.
Set selection bits group is used to indicate which of possible four output sets are returned on output. If corresponding to output set bit is set to 1, then surfaces from corresponding result set are selected.
Mark inversion group - bits 4…7: If corresponding bit is not set, then output set is marked by the same collection as originating input set. If bit is set, the collection of another set is used instead. Those bits do not have any effect in case corresponding bit in set selection bits group is not set. Also, bits in this group do not have any effect in case both sets are the same.
Highlight group - bits 9 and 10. If bit 9 is set, then surfaces in the output set marked by
collection1are highlighted. If bit 10 is set, then surfaces in the output set marked bycollection2are highlighted.
use_plane (int) –
0 - Check for identity of surfaces in two sets.
1 - Use plane specified by plane parameter to reflect on of sets before checking identity.
2 - All surfaces are assumed to be selected in only one set and they are rearranged into two sets by their position with respect to input plane before checking for their symmetry.
plane_normal (hwTriple) – The hwTriple object defining the symmetry plane normal components. User can also supply a Python list of three doubles.
plane_base (hwTriple) – The hwTriple object defining the base point components of the symmetry plane. User can also supply a Python list of three doubles.
tol (double) – Tolerance value used to calculate surfaces identity.
Example#
Clean up the model so that it does not contain duplicated surfaces . That is , if there exists a set of two or more surfaces that are identical one would like to delete all but one of surfaces from this set . A tolerance of 0.1 is go to be used to identify surfaces . One puts all input surfaces into thecollection1and selects value 4 foroptionsto indicate that surfaces of * output_set2 * ( “ secondary “ surfaces ) have to be returned on the input collection#import hm import hm.entities as ent model = hm.Model() # Creating a collection that contains all the surfaces input_collection = hm.Collection(model, ent.Surface) model.surfacemark_duplicate_check( collection1=input_collection, collection2=hm.Collection(model, ent.Surface, populate=False), options=4, use_plane=0, plane_normal=[0.0, 0.0, 1.0], plane_base=[0.0, 10.0, 0.0], tol=0.1, ) model.deletemark(collection=input_collection)