freeze SolidWorks graphics updates

Programming and macros
Kjara
Posts: 21
Joined: Mon Jul 19, 2021 2:49 am
Answers: 0
x 1

freeze SolidWorks graphics updates

Unread post by Kjara »

Is there a way to freeze SolidWorks graphics updates?

I am not talking about freezing graphic updates of a certain IModelDoc2, which can be achieved using IModelView.EnableGraphicsUpdate and IFeatureManager.EnableFeatureTree.

I am talking about the SolidWorks level, where a user can see e.g. if a file gets opened or closed.

Actual problem I want to solve:
I have a program/macro that should modify some data in some model docs, but the user should not see this (mainly due to performance considerations). So I open all docs that I need to update invisibly. More often than not it turns out that invisible documents do not allow certain operations - I can use the API methods but they do not modify the data, or they even crash Swx. So for some operations, like changing design table options, I need the document to be visible. So I make it visible via IModelDoc2.Visible=true, do my data modifications, then make it invisible again (which by the way is NOT as easy as setting IModelDoc2.Visible=false... but it can be done).
This brief phase of visibility can be seen in Swx, like in this gif here (if it does not play, click on it):
file open and close.gif
If the visibility phase is longer (due to more operations being done) I can imagine that the user will even see the geometry of the (shortly) visible file being built up.

I want to hide all that from the user.
User avatar
AlexB
Posts: 455
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 25
x 245
x 405

Re: freeze SolidWorks graphics updates

Unread post by AlexB »

I don't know of a way to fully turn off graphics for the application, however I found this as a helpful resource when speeding up macros in the past.

There are ways to lock the user interface from user interaction as well, in the event that something shows on screen. If locked, the user can't mess with it while the macro/api runs.

https://cadbooster.com/improve-solidwor ... rks-window
Post Reply