- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello guys,
Im posting on behalf of my company here.
I am trying to create a library of Functions to add a part, delete a part and create iMates for added parts.
Right now i have a hard time to figure out the best way to do this.
External rules seem to be the ideal way, but i read that it has to be a straight vb file to be added in the local iLogic rule editor.
Would it be better if i add them to VBA macros and call the functions locally?
I also could not find a proper code to call functions which has ThisApplication and ThisDoc objects properly from external rules or VBA Macros.
Any help would be appreciated.
Please look into into it if someone finds free time.
Best,
Vamsi
These are the functions that i am trying to store externally and call them locally in required assemblies.
Sub Main() End Sub Function Add(ComponentName As String) oACD = ThisDoc.Document.ComponentDefinition oPath = ThisDoc.Path & "\" oFile = ComponentName oTG = ThisApplication.TransientGeometry oM = oTG.CreateMatrixoM.SetTranslation(oTG.CreateVector(0, 0, 0)) oOcc = oACD.Occurances.Add(oPath & oFile, oM) End Function Function Check(ComponentName As String) oACD = ThisDoc.Document.ComponentDefinition For i = 1 To 20 Try entity = oACD.Occurances.ItemByName(ComponentName & ":" & i) entity.Delete Catch End Try Next End Function Function DoiMates(Component1 As String, Component2 As String, MateName As String) oACD = ThisDoc.Document.ComponentDefinition Comp1 = oACD.Occurances.ItemByName(Component1) Comp2 = oACD.Occurances.ItemByName(Component2) i = 1 For Each iMateDefinition In Comp1.iMateDefinitions If iMateDefinition.Name = MateName Then iMate1 = Comp1.iMateDefinitions.Item(i) Exit For End If i = i + 1 Next i = 1 For Each iMateDefinition In Comp2.iMateDefinitions If iMateDefinition.Name = MateName Then iMate1 = Comp2.iMateDefinitions.Item(i) Exit For End If i = i + 1 Next oiMateResults = oACD.iMateResults.AddByTwoiMates(iMate1, iMate2) End Function
Solved! Go to Solution.