Model.ME_ModuleOccurrencesLink#
- Model.ME_ModuleOccurrencesLink(main_id, ids, options)#
Links a set of specified module occurrences to a main module occurrence to allow all of them to share the main occurrence’s underlying definition (including its prototype).
Every module occurrence in a model has an associated module prototype. A single module prototype may provide the base definition for multiple module occurrences, i.e. a prototype of a wheel might have four occurrences in a vehicle. In some models, the original model definition does not have this modelling structure and each module occurrence has its own prototype when they could share a common prototype definition. This function provides a method to link these similar module occurrences to obtain the desired instanced model structure.
When this function is applied to a list of occurrences, it will update the model structure, handle the cleanup of the discarded prototype definitions, and handle any matrix updates required by the specified options.
- Parameters:
main_id (Entity) – The part entity occurrence which provides the underlying definitions (i.e. the prototype) to be shared.
ids (EntityList) – The list of part entitites to be linked to the main module occurrence.
options (hwString) –
List of input options, passed as a comma separated string enclosed in quotes. Valid options are:
updatematrices=<value>
none - Do not update the structural matrices of the linked module occurrences (default)
calcoffset - Update the structural matrices for each linked module occurrences by calculating the offset in positions of the current contents of each linked module occurrence relative to the main module occurrence
Example#
Link the parts with IDs 24, 26 and 28 to share the definition of main part with ID 22. As a result of the function , all of these modules will now share the same prototype and representations . In this operation , the matrices for the linked modules will be updated with any required offsets between each module and the main module#import hm import hm.entities as ent model = hm.Model() model.ME_ModuleOccurrencesLink( main_id=ent.Part(model, 22), ids=[ent.Part(model, 24), ent.Part(model, 26), ent.Part(model, 28)], options="updatematrices=calcoffset", )