Model.AE_AttachmentCreateWithOptions#
- Model.AE_AttachmentCreateWithOptions(target_collection, location_collection, search_type, control=0, maxdiameter=0.0, mindiameter=0.0, tolerance=0.0, snaptocenter=0)#
Creates attachments with options.
- Parameters:
target_collection (Collection) – The collection containing the target entities to consider for adding attachments. Valid entities are parts and components.
location_collection (Collection) – The collection containing the location entities to use for determining the attachment location (one attachment per location). Valid entities are nodes. This is optional (can be passed as empty value) if doing a hole search (
search_type="Hole").search_type (hwString) –
Hole - If nodes are passed in via
location_collection, attempt to find a single hole per node. If no nodes are passed, create an attachment for each hole found on entities intarget_collection.Node - Create a special node attachment on the nodes pass in via
location_collection.control (unsigned int) – The ID of the attachment control to use for realization.
maxdiameter (double) – The maximum hole diameter to find.
mindiameter (double) – The minimum hole diameter to find.
tolerance (double) – The tolerance used for hole searches and projections.
snaptocenter (int) – Reserved for future development.
Examples#
Create an attachment for each location entity (nodes with IDs 266 and 380), looking for the nearest hole on “Part1” or “Part2” for each node#import hm import hm.entities as ent model = hm.Model() trgt_part_collection = hm.Collection(model, ent.Part, ["Part1", "Part2"]) node_loc_collection = hm.Collection(model, ent.Node, [266, 380]) model.AE_AttachmentCreateWithOptions( target_collection=trgt_part_collection, location_collection=node_loc_collection, search_type="Hole", control=1, maxdiameter=25.0, mindiameter=5.0, tolerance=25.0, )
Create attachments for each hole on 3 different parts, specifying an attachment control be created#import hm import hm.entities as ent model = hm.Model() trgt_part_collection = hm.Collection(model, ent.Part, ["Part1", "Part2", "Part3"]) model.AE_AttachmentCreateWithOptions( target_collection=trgt_part_collection, location_collection=hm.Collection(model, ent.Node, populate=False), search_type="Hole", control=1, maxdiameter=25.0, mindiameter=5.0, tolerance=25.0, )
Create two node attachments (nodes with IDs 221 and 365), referencing specific nodes with no other realization#import hm import hm.entities as ent model = hm.Model() node_loc_collection = hm.Collection(model, ent.Node, [266, 380]) model.AE_AttachmentCreateWithOptions( target_collection=hm.Collection(model, ent.Part, populate=False), location_collection=node_loc_collection, search_type="Node", )