Message 1 of 2

Not applicable
05-19-2016
01:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
First-off I dont know if ive now posted to the right forum... I am led to belive this is the API forum???
The question..
I import several of my inventor parts (ipt files) into assemblys ussing the following API- vb.net code
'OPENS TEMPLATE...S oApp = Marshal.GetActiveObject("Inventor.Application") oDocs = oApp.Documents oDoc = oDocs.Open("C:\TEMPLATE.ipt", True) 'TESTPART1 'SAVE THE TEMPLATE AS NEW IPT FILE...S oDoc.SaveAs(TextBox22.Text & "\" & TextBox21.Text &".ipt", False) oDoc.Close() 'IMPORTING THE PART INTO THE CURRENT ASSEMBLY...S Dim IAMDOC As AssemblyDocument = oApp.ActiveDocument Dim POS As Matrix = oApp.TransientGeometry.CreateMatrix Dim NEWocc = IAMDOC.ComponentDefinition.Occurrences.Add(TextBox22.Text & "\" & TextBox21.Text & ".ipt", POS) oApp.ActiveView.Update()
The problem though is the part file which is nolonger named TEMPLATE.ipt but the whatever the value of textbox21 is. will keep the name TEMPLATE in the treeview section... this too must conform with the orriginal value of textbox22 when it was saved...
the red arrow in the image shows where the name also needs to append...
Solved! Go to Solution.