<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Open existing idw and replace model from iam iLogic assembly. in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977118#M124930</link>
    <description>&lt;P&gt;Thank you! It works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;That was one part of a puzzle :-). &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2nd is I need to push a command to the drawing from iam to &amp;nbsp;Save it As with the new assembly number. How should I do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or should I push the parameter with new file name to the drawing and fire rule in the drawing to save it using parameter from iam assembly ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;Alex.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Apr 2014 16:39:02 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-04-21T16:39:02Z</dc:date>
    <item>
      <title>Open existing idw and replace model from iam iLogic assembly.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4976974#M124928</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I`m pretty sure it is simple I just need a little help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an iLogic assembly for 2 parts that make a stub up. Using form to configure it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG title="stub up configurator.png" src="https://forums.autodesk.com/t5/image/serverpage/image-id/95410i687CF1A586C09920/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="stub up configurator.png" align="center" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the rules that make magic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1st one makes sure that user saves it as new assembly, runs automatically when iam file is open.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;'AC 2014  Stub up assembly configurator

Dim SFD As New SaveFileDialog()
SFD.InitialDirectory=ThisDoc.Path
SFD.Filter = "*.iam files (*.iam)|*.iam|All files (*.*)|*.*"
SFD.FileName="XXXXXTSA001"

PN=iProperties.Value("Project", "Part Number")

If PN&amp;lt;&amp;gt;"iStubup sleeve MASTER"  Then 
	' do nothing 
Else
	MessageBox.Show("PLEASE SAVE IT AS DIFFERENT ASSEMBLY NUMBER, FORMAT [XXXXXTSA001], WHERE XXXXX IS JOB NUMBER", "WARNING",MessageBoxButtons.OK) 
	If SFD.ShowDialog()=DialogResult.OK Then
		ThisDoc.Document.SaveAs(SFD.FileName , False)
		iProperties.Value("Project", "Part Number")=ThisDoc.FileName(False) 'without extension
		iLogicForm.Show("CONFIGURATOR")
	End If
End If&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;2nd code fires after user hits Apply or OK button on the form&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;'АЛЕКС ШМИДТ 2014 Stubup configurator

Imports System.Windows.Forms

Parameter("End1", "Width") = Width
Parameter("End1", "Height") = Height
Parameter("Side1", "Length") = Length
Parameter("Side1", "Height") = Height
Parameter("End1", "FlangeW") = FlangeW
Parameter("Side1", "FlangeW") = FlangeW
Parameter("End1", "ShThk") = ShThk
Parameter("Side1", "ShThk") = ShThk

iProperties.Value("Summary", "Title")=JobN &amp;amp; " STUB UP SLEEVE ASSEMBLY " &amp;amp; Length &amp;amp; """L X " &amp;amp; Width &amp;amp; """W X " &amp;amp; Height &amp;amp; """H"

Dim FBD As New FolderBrowserDialog()
FBD.SelectedPath=ThisDoc.WorkspacePath()

If FBD.ShowDialog()=DialogResult.ok Then
	Parameter("End1", "FilePath") = FBD.SelectedPath
	Parameter("End1", "FileName") = EndPN
	Parameter("Side1", "FilePath") = FBD.SelectedPath
	Parameter("Side1", "FileName") = SidePN
	
	iLogicVb.RunRule("End1", "Adjusting")
	iLogicVb.RunRule("Side1", "Adjusting")
	
	iLogicVb.UpdateWhenDone = True
	Component.Replace("End1", FBD.SelectedPath &amp;amp; "\" &amp;amp; EndPN &amp;amp; ".ipt", True)
	Component.Replace("Side1", FBD.SelectedPath &amp;amp; "\" &amp;amp; SidePN &amp;amp; ".ipt", True)
	
	' update  all
	iLogicVb.UpdateWhenDone = True
	'zoom all
	ThisApplication.ActiveView.Fit
End If

iLogicVb.RunRule("Area")

' ThE eNd&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Each ipt. "Side1", "End1" etc has an iLogic code that allowes to save it with a given in a form Part number.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;'АЛЕКС ШМИДТ 2014&lt;BR /&gt;
iProperties.Value("Project", "Creation Date") = Now 
user = ThisApplication.GeneralOptions.UserName
iProperties.Value("Project", "Designer") = user
iProperties.Value("Summary", "Author") = user
iProperties.Value("Summary", "Title") = "END SLEEVE " &amp;amp; Width &amp;amp; " X " &amp;amp; Height
iProperties.Value("Project", "Description")=iProperties.Value("Summary", "Title")

If ShThk = 0.313 Then
	SheetMetal.SetActiveStyle("5/16"&amp;amp; Chr(34))

Else If ShThk = 0.25 Then
	SheetMetal.SetActiveStyle("1/4"&amp;amp; Chr(34))
	
Else If ShThk = 0.1345 Then
	SheetMetal.SetActiveStyle("10ga")
	
Else If ShThk = 0.105 Then 
	SheetMetal.SetActiveStyle("12ga")
	
Else If ShThk = 0.1793 Then
	SheetMetal.SetActiveStyle("7ga")
End If

Try
ThisDoc.Document.SaveAs(FilePath &amp;amp; "\" &amp;amp; FileName &amp;amp; ".ipt" , True)
Catch Ex As exception
	' do nothing
End Try&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Everything works just great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do have a master drawing, simple, 4 views with callouts and dim`s.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is to open that drawing in the background, save it as the same assembly number and replace reference with newly configured assembly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How I have to make a call from an iam file ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can open drawing using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ThisDoc.Launch("c:\Work12\Designs\PARTS\iLogic tank parts\Stubup sleeve\iStubup sleeve MASTER.idw")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do have a code to replace reference, but this works only form idw..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;doc = ThisDoc.Document 


Dim oFD As FileDescriptor 
 oFD = doc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor 
 oFD.ReplaceReference("C:\File Name.iam")
 doc.Update()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Any help is apreciated.. Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2014 15:44:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4976974#M124928</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-04-21T15:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Open existing idw and replace model from iam iLogic assembly.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977028#M124929</link>
      <description>&lt;P&gt;This is because when the rule is run it is trying to perform Replace reference on the document that called the rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To have it refer to the drawing file try this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim dwgDoc As Document
dwgDoc = ThisApplication.Documents.Open("c:\Work12\Designs\PARTS\iLogic tank parts\Stubup sleeve\iStubup sleeve MASTER.idw")

Dim oFD As FileDescriptor 
oFD = dwgDoc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor 
oFD.ReplaceReference("C:\File Name.iam")&lt;BR /&gt;dwgDoc.Update()&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Apr 2014 16:03:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977028#M124929</guid>
      <dc:creator>rjay75</dc:creator>
      <dc:date>2014-04-21T16:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Open existing idw and replace model from iam iLogic assembly.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977118#M124930</link>
      <description>&lt;P&gt;Thank you! It works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;That was one part of a puzzle :-). &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2nd is I need to push a command to the drawing from iam to &amp;nbsp;Save it As with the new assembly number. How should I do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or should I push the parameter with new file name to the drawing and fire rule in the drawing to save it using parameter from iam assembly ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;Alex.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2014 16:39:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977118#M124930</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-04-21T16:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Open existing idw and replace model from iam iLogic assembly.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977148#M124931</link>
      <description>&lt;PRE&gt;Dim asmDoc as Document
asmDoc = ThisApplication.Documents.Open("Asmdoc.iam")
asmDoc.SaveAs("NewAsmdoc.iam")
asmDoc.Close()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This will just save the assembly file with a new name. You'd have to do the same for each componenent as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See this thread&amp;nbsp;&lt;A target="_blank" href="http://forums.autodesk.com/t5/Inventor-Customization/Run-Time-Error-91/td-p/4945930"&gt;http://forums.autodesk.com/t5/Inventor-Customization/Run-Time-Error-91/td-p/4945930&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2014 16:55:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977148#M124931</guid>
      <dc:creator>rjay75</dc:creator>
      <dc:date>2014-04-21T16:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Open existing idw and replace model from iam iLogic assembly.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977162#M124932</link>
      <description>&lt;P&gt;Thank you. Yes I know this will save current iam as a new assembly.&lt;/P&gt;&lt;P&gt;What I need is to save idw with replaced reference as a new idw drawing with new name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2014 17:02:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977162#M124932</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-04-21T17:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Open existing idw and replace model from iam iLogic assembly.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977188#M124933</link>
      <description>&lt;P&gt;It will be the same thing. On any document call the SaveAs method. So for the drawing it would be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;dwgDoc.SaveAs("NewFileName.idw")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2014 17:15:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977188#M124933</guid>
      <dc:creator>rjay75</dc:creator>
      <dc:date>2014-04-21T17:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Open existing idw and replace model from iam iLogic assembly.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977548#M124934</link>
      <description>&lt;P&gt;Thanks man! This is what I added to make it work. I appreciate your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/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N&gt; &lt;SPAN&gt;oFD&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;FileDescriptor&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN&gt;oFD&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;dwgDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedFileDescriptors&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentDescriptor&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedFileDescriptor&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN&gt;oFD&lt;/SPAN&gt;.&lt;SPAN&gt;ReplaceReference&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;PathAndFileName&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;True&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dwgDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Apr 2014 18:51:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977548#M124934</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-04-21T18:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Open existing idw and replace model from iam iLogic assembly.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977722#M124935</link>
      <description>&lt;P&gt;Just check the document that you're changing the reference on. If you wanted to change it on the file that was saved make sure to open the new file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim dwgDoc As Document

dwgDoc = ThisApplication.Documents.Open("c:\Work12\Designs\PARTS\iLogic tank parts\Stubup sleeve\iStubup sleeve MASTER.idw")
'Save File as new Document
dwgDoc.SaveAs(ThisDoc.Path &amp;amp; "\" &amp;amp; ThisDoc.FileName(False) &amp;amp; ".idw", False)
'Close Template
dwgDoc.Close()
'Open New file
dwgDoc = ThisApplication.Documents.Open(ThisDoc.Path &amp;amp; "\" &amp;amp; ThisDoc.FileName(False) &amp;amp; ".idw")

Dim oFD As FileDescriptor 
oFD = dwgDoc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor 
oFD.ReplaceReference(ThisDoc.PathAndFileName(True))
dwgDoc.Update()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2014 19:55:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977722#M124935</guid>
      <dc:creator>rjay75</dc:creator>
      <dc:date>2014-04-21T19:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Open existing idw and replace model from iam iLogic assembly.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977906#M124936</link>
      <description>&lt;P&gt;Thank you! Good idea.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2014 21:07:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/open-existing-idw-and-replace-model-from-iam-ilogic-assembly/m-p/4977906#M124936</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-04-21T21:07:35Z</dc:date>
    </item>
  </channel>
</rss>

