Model.replacentitywithentitymark#
- Model.replacentitywithentitymark(mode, existing_component_collection, incoming_component_collection, tolerance=0.0, customBBoxTolForEquivalencingIncomingIds=0.0, keepSrcProp=0, keepSrcMat=0, keepSrcCompCardimage=0, logFile=0, keepSrcCompId=0, keepSrcInclude=0, replaceByFileImport=0, compsInFileImport=0, deleteSrcComp=0, autoPreserveConnections=0, mergeNodes=0, boxApproachNset=0, bvtRun=0, keepSrcEtType=0, incomingIncludeId=0, componentPairingString='', retainPlotelElemNodeIdsFromSrcComp=0, prefixBasenameSuffixBasedNamePairing=0)#
Replaces multiple components.
- Parameters:
mode (int) –
The replace mode. Valid values are:
0 - Undo/reject replace operation.
1 - Initial replace operation.
2 - Finish/accept replace operation.
existing_component_collection (Collection) – The collection containing the existing/old component entities.
incoming_component_collection (Collection) – The collection containing the incoming/new component entities.
tolerance (double) – The replacement tolerance. Right now it is a global tolerance, meaning the same tolerance is applied for all replace entities. The default is 0.01.
customBBoxTolForEquivalencingIncomingIds (double) – Reserved for future development. Please set the default value.
keepSrcProp (unsigned int) –
0 - Do not reuse/keep the property assigned to the outgoing component. (default)
1 - Reuse/ assign property of source component to the outgoing component.
keepSrcMat (unsigned int) –
0 - Do not reuse/keep the material assigned to the outgoing component. (default)
1 - Reuse/assign material of source component to the outgoing component.
keepSrcCompCardimage (unsigned int) –
0 - Do not reuse/keep the card image assigned to the outgoing component. (default)
1 - Reuse/ assign source component card image to the outgoing component.
logFile (unsigned int) – If a log file is desired, value should be set to the full path and file name to write to.
keepSrcCompId (unsigned int) – Reserved for future development. Please set the default value.
keepSrcInclude (unsigned int) –
0 - Do not organize the incoming component to the outgoing component include. (default)
1 - Organize the incoming component and its nodes/elements/reference entities to the outgoing component include.
replaceByFileImport (unsigned int) – Reserved for future development. Please set the default value.
compsInFileImport (unsigned int) – Reserved for future development. Please set the default value.
deleteSrcComp (unsigned int) – Reserved for future development. Please set the default value.
autoPreserveConnections (unsigned int) – Reserved for future development. Please set the default value.
mergeNodes (unsigned int) – Reserved for future development. Please set the default value.
boxApproachNset (unsigned int) – Reserved for future development. Please set the default value.
bvtRun (unsigned int) – Reserved for future development. Please set the default value.
keepSrcEtType (unsigned int) – Reserved for future development. Please set the default value.
incomingIncludeId (unsigned int) – Reserved for future development. Please set the default value.
componentPairingString (hwString) – Reserved for future development. Please set the default value.
retainPlotelElemNodeIdsFromSrcComp (unsigned int) – Reserved for future development. Please set the default value.
prefixBasenameSuffixBasedNamePairing (unsigned int) – Reserved for future development. Please set the default value.
Example#
Replace the components with IDs 301 and 302 with the components with IDs 501 and 502 respectively#import hm import hm.entities as ent model = hm.Model() component_collection = hm.Collection(model, ent.Component, [301, 302]) model.replacesetentitydata(component=component_collection) preserve_collectionSet = hm.CollectionSet(model) set_collection = hm.Collection(model, ent.Set, [20, 30]) group_collection = hm.Collection(model, ent.Group, [20, 30]) preserve_collectionSet.set(set_collection) preserve_collectionSet.set(group_collection) model.replacesetentitydata( preserveCollectSet=preserve_collectionSet, componentpair=[[301, 501], [302, 502]], incomingonlyentities=[ent.Set, ent.Group], ) component_collection_for_replace = hm.Collection(model, ent.Component, [501, 502]) model.replacentitywithentitymark( mode=1, existing_component_collection=component_collection, incoming_component_collection=component_collection_for_replace, tolerance=0.5, keepSrcProp=1, keepSrcMat=1, keepSrcCompCardimage=1, )