Update Drawing View

Update Drawing View

ThomasRambach
Advisor Advisor
3,992 Views
12 Replies
Message 1 of 13

Update Drawing View

ThomasRambach
Advisor
Advisor

Is there not a simple API command to update drawing views that need updating? I've tried everything but I can't get the API/iLogic to just refresh the view like how it behaves when you select the view in Inventor and click the Update button. 

0 Likes
Accepted solutions (2)
3,993 Views
12 Replies
Replies (12)
Message 2 of 13

JhoelForshav
Mentor
Mentor

I might be wrong, but I think the update button that lights up when you click on a view is to update the entire sheet?

In that case it should be sheet.update.

Maybe something like this would work for you?

For Each oSheet As Sheet In ThisDoc.Document.Sheets
	For Each oView As DrawingView In oSheet.DrawingViews
		If oView.UpToDate = False Then oView.Parent.Update
	Next
Next
0 Likes
Message 3 of 13

ThomasRambach
Advisor
Advisor

This doesn't seem to have an affect.

0 Likes
Message 4 of 13

WCrihfield
Mentor
Mentor

Try one of these:

ThisApplication.CommandManager.ControlDefinitions.Item("DrawingUpdateAllSheetsCmd").Execute
ThisApplication.CommandManager.ControlDefinitions.Item("DrawingUpdateComponentCmd").Execute
ThisApplication.CommandManager.ControlDefinitions.Item("DrawingUpdateViewComponentCmd").Execute

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 13

ThomasRambach
Advisor
Advisor

So this works, sort of. I'm trying to use this for iso-shaded views that are out of date. The macro opens the file and publishes a DWF. It won't update using the code unless I do something to the view first even though it's out of date. So I tried changing the shaded view to hidden line and then back again. That works but it takes time for it to finish and it usually makes the DWF before it finishes. Trying to figure out how to handle this. If I add a break it works.

0 Likes
Message 6 of 13

WCrihfield
Mentor
Mentor

In the API, the DrawingView object has a couple of Boolean type Properties that you may be able to use in that situation.  Maybe you can use some variation of a Do...Loop or While...End While type statement.

I know there are System.Threading... ways to pause, but I'm not familiar enough with that process yet to give specific advice about using it.

oView.IsUpdateComplete

oView.UpToDate

DrawingView Object 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 13

sebastien.forman
Advocate
Advocate
Accepted solution

hello,

 

Have you already test that?

Public Sub refresh()
ThisApplication.ActiveDocument.Update
'ThisApplication.ActiveDocument.Update2
'ThisApplication.ActiveDocument.Rebuild
'ThisApplication.ActiveDocument.Rebuild2
End Sub
Message 8 of 13

marcin_otręba
Advisor
Advisor
Accepted solution

Hi,

If you have macro to publish just add code before publish to update drawing views like this below:

 

 

 Dim oselset As SelectSet = ThisDoc.Document.SelectSet
oselset.Clear
For Each oSheet As Sheet In ThisDoc.Document.Sheets
	For Each oView As DrawingView In oSheet.DrawingViews
		If oView.ViewStyle=kShadedDrawingViewStyle  Then
			oselset.Select(oView)
			
		End If
	Next
Next
ThisApplication.CommandManager.ControlDefinitions.Item("DrawingUpdateViewComponentCmd").Execute
 

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 9 of 13

ThomasRambach
Advisor
Advisor

I combination of the last two replies worked but I still have to cycle the view from hidden line and then back to shaded for the update to stick. 

0 Likes
Message 10 of 13

marcin_otręba
Advisor
Advisor

? why, as i told you, just add it to makro befeore publish line and it will work, or add it to on open document trigger

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 11 of 13

ThomasRambach
Advisor
Advisor

You would think it would work, but it wasn't. I have no idea why unless I cycle the view style.

0 Likes
Message 12 of 13

marcin_otręba
Advisor
Advisor

it works, i use it this way from years now. if you want share you r macro with me so i can correct it for you.

you can send it to me via private message or to marcin.j.otreba@gmail.com

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 13 of 13

sebastien_forman
Enthusiast
Enthusiast

try this too:

iLogicVb.UpdateWhenDone = True
0 Likes