Update

Update

Anonymous
Not applicable
577 Views
4 Replies
Message 1 of 5

Update

Anonymous
Not applicable

So I made an excel file to drive a part, ilogic pulls in the numbers, then I made a rule to make a drawing.

 

I made a hyperlink on the excel sheet to open up the model, the model reads the updates and then the drawing is launched. However the drawing does not reflect the last changes made, if I click on the model it reflects the updates and then if I click back over to the drawing it is updated. 

 

Is there a way to have the drawing update immediately?

 

Also is there a way to make it so that the new drawing has the title of the PN?

 

0 Likes
578 Views
4 Replies
Replies (4)
Message 2 of 5

Stakin
Collaborator
Collaborator

try :

 

Imports Inventor.ViewOrientationTypeEnum
Imports Inventor.DrawingViewStyleEnum

Dim oDrawDoc as DrawingDocument   
Dim oPartDoc as Document
Dim oSheet As sheet
Dim oTG As TransientGeometry
Dim oBaseView As DrawingView
Dim oView2 As DrawingView
ViewScale = 1/16

'Ask To create drawing?
dwgQuery=MsgBox("Would you like to Create a drawing for this MODEL?", vbYesNo,"Drawing Selection")

If dwgQuery = vbYes Then
    oPartDoc = ThisDoc.Document
   
    'Define IDW Template File Location
    oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "L:\Template.dwg", True)
    oSheet = oDrawDoc.Sheets.Item(1)
   
    'Define 2d view bottom Left corner points For four views
    oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(37, 23)
    oPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(18,15)


Dim oBaseViewOptions As NameValueMap
oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap

'True = folded view
'False = flat pattern view
oBaseViewOptions.Add("SheetMetalFoldedModel", False)
   



oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint1, 1/25,kIsoTopRightViewOrientation, kHiddenLineRemovedDrawingViewStyle, "Default")
    oView2 = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint2, 1/8, kFlatPivotRightViewOrientation, kHiddenLineDrawingViewStyle,,, oBaseViewOptions)


Parameter.UpdateAfterChange = True
MultiValue.UpdateAfterChange = True
iLogicVb.UpdateWhenDone = True
oDrawDoc.Update()
End If

0 Likes
Message 3 of 5

Anonymous
Not applicable

That still did not autoupdate the drawing. It does still update if I swithch screens back to the model though

0 Likes
Message 4 of 5

philippe.leefsma
Alumni
Alumni

Did you try calling Update() on the PartDocument?

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 5

Stakin
Collaborator
Collaborator

 

I think you can add a rule to Update the drawing,triggered by the model save action after you changed the excel sheet.

like this:

Dim oDrawDoc As DrawingDocument   
Dim oTpDoc As Document
Try
 oDrawDoc=ThisApplication.Documents.ItemByName("C:\XXXX\XXX.idw")
 oDrawDoc.Update()
oDrawDoc.Save
Catch oDrawDoc = ThisApplication.Documents.Open("C:\XXXX\XXX.idw",false) oDrawDoc.Update() oDrawDoc.Save
oDrawDoc.Close End Try

"C:\xxx\xxx.idw" is your drawing file location

Maybe it works.

0 Likes