×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Refresh Drawing Propereties

Refresh Drawing Propereties

Refresh Drawing Propereties

(OP)
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.
 

RE: Refresh Drawing Propereties

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

RE: Refresh Drawing Propereties

(OP)
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 ()

RE: Refresh Drawing Propereties

(OP)
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.

RE: Refresh Drawing Propereties

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.

RE: Refresh Drawing Propereties

(OP)
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

RE: Refresh Drawing Propereties

(OP)
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?
 

RE: Refresh Drawing Propereties

Just my 2 cents....This should be shown in the revision block, not the title block.

Chris
SolidWorks 09, CATIA V5
ctopher's home
SolidWorks Legion

RE: Refresh Drawing Propereties

(OP)
Update - CTRL+R does not refresh the properties

RE: Refresh Drawing Propereties

(OP)
ctopher: took note of your 2 cents.  I made this up on the fly - I don't actually use this as a custom property.

RE: Refresh Drawing Propereties

(OP)
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
 

RE: Refresh Drawing Propereties

Isn't that what ArtemTat suggested in the first reply to this thread?

RE: Refresh Drawing Propereties

(OP)
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.

RE: Refresh Drawing Propereties

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources