You could do something like this. You run this rule from an assembly that contains the part with all the holes. the rule will ask you to select the part with the holes. The part will open and you need to select the face with all the holes. Then it will create iMates on all holes (that are not holes ;-). Lastly the rule will add the pipe with imates.
You will need to change the "Pipe" file name in the rule.
Dim doc As AssemblyDocument = ThisDoc.document
Dim occ As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select chees part.")
Dim refDoc As PartDocument = occ.ReferencedDocumentDescriptor.ReferencedDocument
refDoc = ThisApplication.Documents.Open(refDoc.FullDocumentName)
Dim face As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select face with holes")
For Each edge As Edge In face.Edges
If edge.GeometryType <> CurveTypeEnum.kCircleCurve Then Continue For
refDoc.ComponentDefinition.iMateDefinitions.AddInsertiMateDefinition(edge, True, 0)
Next
doc.Activate()
doc.ComponentDefinition.Occurrences.AddUsingiMates("C:\Path\to\your\pipe.ipt", True)
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com