06-24-2020
12:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-24-2020
12:36 PM
As per @WCrihfield advice, since your assembly is open you should be able to remove both the Open and Close methods from my code and it should still work. I used open/close when copying from outside an assembly and assumed it worked the same.
Dim oApp as Inventor.Application = ThisApplication
Dim oCopyPartName as String = "New part name here"
Dim oAssyPath as String = ThisDoc.Path
Dim oCopyPath as String = oAssyPath & "\" & oCopyPartName & ".ipt"
Dim oPart as ComponentOccurrence = Components("Part to copy name here")
Dim oPartDoc as PartDocument = oPart.Definition.Document
oPartDoc.SaveAs(oCopyPath,True)
For naming/copying a lot of parts, if you want to iterate through a bunch of parts and name/copy them automatically that will be quite a bit more code. If you're looking for a more manual way, I'd make a simple form in Inventor with two text User Parameters inputs and a button to run the rule to copy.