wait loop until drawing views are updated

wait loop until drawing views are updated

miechh
Collaborator Collaborator
963 Views
3 Replies
Message 1 of 4

wait loop until drawing views are updated

miechh
Collaborator
Collaborator

I've created a VBA program to export drawing views to DXF. While running the program the user is asked to select geometry (engraved text) to be put in another layer before exporting to DXF. Before that, some properties of the part in that drawing view are changed which causes the drawing view to be updated. This update disturbs the selection process, because the drawing view is being 'rendered' (which you can see by the corner marks around the view and the low-resolution) while the VBA program continues. Apparently you can only select geometry when the drawing view is up-to-date.

 

Now I want to program a loop that waits until all the views on the drawing are up-to-date before continuing the rest of the code. How can I do this? Which property of the DrawingDocument indicates this?

 

Thanks in advance.


Product Design Suite 2024
Inventor 2024 (v 28.20.27200.0000), Vault Basic 2024
Fusion 360
HP Workstation Z4
Intel Xeon 3.4GHz
32GB RAM
Windows 10 Professional (64bit)
0 Likes
964 Views
3 Replies
Replies (3)
Message 2 of 4

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

I guess you can loop through each drawingview and check the drawingview.IsRasterViewoption

you just need to loop until all drawingviews are correct. (be carefull that you put a timer on it, that way it will not run into a 

continous loop)

Sub test()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oDrawView As DrawingView
Set oDrawView = oSheet.DrawingViews(1)
If oDrawView.IsRasterView = False Then
'export
End If
End Sub

 

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 3 of 4

bshbsh
Collaborator
Collaborator

I'd try running an update-all command in sync mode, like this:

Call ThisApplication.CommandManager.ControlDefinitions.Item("DrawingUpdateAllSheetsCmd").Execute2(True)

right before the beginning of the user selection part of your code.

Running it in sync will stop your macro until the command finishes. No loop required.

0 Likes
Message 4 of 4

miechh
Collaborator
Collaborator

Thanks. I will give it a try later this week. Sounds promising. Strange thing is, that the Autodesk Inventor 2017 API Help does not mention "DrawingUpdateAllSheetsCmd" when searching for it.


Product Design Suite 2024
Inventor 2024 (v 28.20.27200.0000), Vault Basic 2024
Fusion 360
HP Workstation Z4
Intel Xeon 3.4GHz
32GB RAM
Windows 10 Professional (64bit)
0 Likes