Hello,
I try to modify on a drawing the 3d model, using iLogic (same thing as Inventor "Replace model reference" command). Do you know if it is possible ?
Solved! Go to Solution.
Solved by xiaodong_liang. Go to Solution.
Hi,
This will need the Advanced API of iLogic: ThisDoc.Document.
e.g. the code below replace the first file of the drawing to a new part. Hope it helps.
doc = ThisDoc.Document Dim oFD As FileDescriptor oFD = doc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor oFD.ReplaceReference("c:\NewPart.ipt") doc.Update()
Xiaodong,
How would I change the following code to include a second .ipt in the replace reference routine?
I have a part 485000-001 and 485000-002. I can successfully replace the reference of the 485000-001 but, cannot replace the 485000-002.
Could you assist with this?
Sub SAVEDETAIL (ByVal TemplateDrawing As String, ByVal PLAINPN As String, ByVal PNWSUFFIX As String, ByVal PTASSYPN As String, ByVal filePath As String) DESTINATIONDOC = ThisApplication.DOCUMENTS.Open(TemplateDrawing, False) DESTINATIONDOC.SAVEAS(filePath & PLAINPN & ".idw", False) Dim STRNEWREFNAME As String Dim OREFFILE As FILEDESCRIPTOR For Each OREFFILE In DESTINATIONDOC.FILE.REFERENCEDFILEDESCRIPTORS Dim OORIGREFNAME As String OORIGREFNAME = OREFFILE.FULLFILENAME If OORIGREFNAME.EndsWith(".ipt") Then STRNEWREFNAME = filePath & PNWSUFFIX & ".ipt" OREFFILE.REPLACEREFERENCE(STRNEWREFNAME) ElseIf OORIGREFNAME.EndsWith(".iam") Then STRNEWREFNAME = filePath & PTASSYPN & ".iam" OREFFILE.REPLACEREFERENCE(STRNEWREFNAME) End If Exit For Next DESTINATIONDOC.Update() DESTINATIONDOC.Save DESTINATIONDOC.Close End Sub
I am after some code that reads the .idw filename and uses the Replace Model Reference routine to replace the first component in the .idw with an .ipt or .iam that is in exactly the same folder.
Hi,
I was trying to make ilogic rule for changes of references. For Your request You can try function "idw reference" in enclosed rule "change_reference.iLogicVb". It's possible to run from model or drawing and it changes reference in idw file with same name model (ipt or iam or ipn) in the same folder. If there is second reference ipn model, it is also changed.
You can use the rule also for changes of ipn, ipt and other references in many ways.
Regards
Pavel
Here shoud be video. If not, You can see it on my dashboard...
Another videos with example of using the rule change_reference: