Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh Drawing Propereties

Status
Not open for further replies.

Fixturedesign

Mechanical
Nov 20, 2002
40
I have a macro that assists with custom properties. After running the macro on a drawing, the properties are saved but the titleblock does not refresh. For instance, if I open drawing and change the "STATUS" property from "PRELIMINARY" to "RELEASED", my drawing still shows "PRELIMINARY" in the titleblock. If I do a print preview, the preview still shows "PRELIMINARY" and the printed version does too.

As soon as I click rebuild, the property updates. Is there a way to call for a refresh from the API without rebuilding the entire drawing and the views on the drawing? I just want the custom properties to refresh at the end of the macro.
 
Replies continue below

Recommended for you

I don't think it is possible. You can also try ModelDoc2::WindowRedraw to redraw the graphics but I believe it isn't an issue.

Why you wouldn't like to rebuild you model with ModelDoc2::EditRebuild3 method?

Artem Taturevich
CSWP
 
I am not a VB guru - I find code similar to what I want to do then edit it to make it work. Any some cases, I find several several pieces of code from various sources and stitch them together. Just trying to make myself more productive.

The problem I've ran into now is that the code for this current problem is locked. I have contacted the owner of the code to see if he can help address the issue. The original code had an "ini" file to help customize to the individuals needs, but it does not allow edits to the macro (*.swp) file itself. Bummer.

Someone else suggested this as a way to refresh the properties.

Code:
ModelDoc2.GraphicsRedraw2 ()
 
By the way ... the reason I do not want to rebuild the entire drawing is that rebuild time would be significant with large assembly drawings. Some of the users in my company like to have all detail drawings in the same file with the assembly drawing. So if all sheets are updated, it would take a lot of time to rebuild. Thanks for your response.
 
Are you setting the status in the drawing document properties, or the model properties?

When I change the drawing document properties, the linked annotations in the drawing update immediately.
 
I am setting drawing properties in a drawing document using a special macro. At the end of the macro, the drawing does not update until I do a forced rebuild (click on stop light icon, CTRL+R or CTRL+Q). Thanks
 
OK - so I am thinking about some work arounds. First of all, I wanted to try the code and see if I could get the refresh to happen. So I wrote a simple macro to try and refresh the screen.

Code:
Dim swApp As Object
Sub main()

swModelDoc.WindowRedraw

Set swApp = Application.SldWorks
End Sub

And I modified the code several times trying to find something that would work ...

Code:
ModelDoc2.GraphicsRedraw2 ()

Code:
ModelDoc2::WindowRedraw

Code:
ModelDoc2::EditRebuild3

And of course VB would wants to go into debug mode with all of these scenarios because it realizes that I am not a programmer! Any suggestions on how to write a simple macro to refresh the screen? I've tried the recorder, but it only captures certain actions and everything I tried did not record any code that would suggest a rebuild.

Also, in order for this to work, I will need to find a way to write a macro that call macro A then when it finishes calls macro B. Is this possible?
 
ctopher: took note of your 2 cents. I made this up on the fly - I don't actually use this as a custom property.
 
Hats off to Wayne Matus who recommended this solution. I'm assuming that this is also rebuilding the views, but I can live with that (for now - will explore this at a later date).

Code:
Dim swApp As SldWorks.SldWorks
Dim modelDoc2 As modelDoc2
Sub main()

Set swApp = Application.SldWorks
Set modelDoc2 = swApp.ActiveDoc

modelDoc2.EditRebuild3

End Sub
 
CorBlimeyLimey - the correct answer to you question is NO. If you continue to read the entire post, you will see that I am not a programmer and was having trouble getting the correct syntax to make the macro run.

That said, thanks to ArtemTat for getting me on the correct path. I did not mean to exclude you from the credits.
 
Fixturedesign,

I think you should also try to suppress drawing views. This should prevent their rebuilding while EditRebuild3.

Do you have a large drawing which takes a time while ModelDoc2::EditRebuild3? If so could you please try to suppress the views before rebuilding (select the view from the FM Tree and click Hide command. I believe actually it is the suppress command not hide since from the API it is called SuppressView).

Please note how long time it takes. If the time for rebuild is reduced I can help you to write a macro which will suppress/unsuppress all drawing view within the document.

Artem Taturevich
CSWP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor