Need help running a iLogic rule that saves assembly and drawing file

Need help running a iLogic rule that saves assembly and drawing file

aldrin7CRAL
Explorer Explorer
535 Views
1 Reply
Message 1 of 2

Need help running a iLogic rule that saves assembly and drawing file

aldrin7CRAL
Explorer
Explorer

Hi all,

 

I am trying to run a iLogic rule that allows the user to save the Assembly and Drawing into a new file name/ part number.

I am able to save the assembly, but I cant seem to get the drawing file associated with that assembly to save simultaneously.

Currently I have a rule in the assembly that "saves As" and a rule in the document that "Save As", and my current process is to have the assembly rule run the Drawing rule, but it seeems it wont let me.

 

Is this the right approach? Is there a better approach?

 

here is my current code:

' defining the active document
oDoc = ThisDoc.Document 
' creating a file dialog box pop-up
Dim oFileDlg As Inventor.FileDialog = Nothing 
InventorVb.Application.CreateFileDialog(oFileDlg)

'check file type and set dialog filter
If oDoc.DocumentType = kPartDocumentObject Then
    oFileDlg.Filter = "Autodesk Inventor Part Files (*.ipt)|*.ipt"
Else If oDoc.DocumentType = kAssemblyDocumentObject Then
    oFileDlg.Filter = "Autodesk Inventor Assembly Files (*.iam)|*.iam"
Else If oDoc.DocumentType = kDrawingDocumentObject Then
    oFileDlg.Filter = "Autodesk Inventor Drawing Files (*.idw)|*.idw"
End If

' setting the directory to the dialog at
oFileDlg.InitialDirectory = ThisDoc.PathAndFileName(False)
oFileDlg.FileName = iProperties.Value("Project", "Part Number")

oFileDlg.CancelError = True
On Error Resume Next

oFileDlg.ShowSave

'catch an empty string in the imput
If Err.Number <> 0 Then
MessageBox.Show("No File Saved.", "iLogic: Dialog Canceled")
Else If oFileDlg.FileName <> "" Then
MyFile = oFileDlg.FileName
'save the file
oDoc.SaveAs(MyFile, True) 'True = Save As Copy & False = Save As
End If

iLogicVb.RunRule ("Sample Part", "Rule name")
0 Likes
536 Views
1 Reply
Reply (1)
Message 2 of 2

JaneFan
Autodesk
Autodesk

It is the current behavior in iLogic that in one rule running session, associated drawing file is not updated along with assembly model update simultaneously. The work around is to run drawing update and save rule another time after model update rule running.




Jane Fan
Inventor/Fusion QA Engineer
0 Likes