Macro / VBA - Drawing file setup

Aug 02, 2005 4 Replies

Hi all


Any VBA guru's out there?



I would like to be able to programatically set specific properties in a drawing document using VBA. Specific Document Properties such as Text size and font of Dimensions, Notes, Arrow size, leader length, etc.



I've been scouring over the Solidworks Object Model, for weeks (in my spare time), but not been able to find a reference to the document property pages.



for instance - From the menu: Tools - Options - Document Properties



- Units



- Dimensions - bent leader length



- Arrows - size



- Annotations Font - Note



- Annotations Font - Dimension



- Annotations Font - Tables



The idea is to open a series of existing drawings to update and revise arrow size and font etc. of notes baloons and dimensions all by automation. Thus to bring a batch of old drawings to a common standard.



I have been succesfull at removing then recreating custom properties and repopulating them with prefferred information. Also have been able to replace the drawing sheet with a revised one containing revisions to the title block.



Accessing the docment properties has me stumped and thinking that they are not exposed to automation.



Any help is greatly appreciated.



BW


I'm no expert, but you might start here and see if it's what you are looking for. Look up swUserPreferenceDoubleValue_e in the API help.

WT

Wow!

Yes that's the stuff.

Upon a quick review of the help files, it looks like exactly what I've been looking for.

Can't wait to get some code into action.

Thanks a bunch.

BW

"Wayne Tiffany" wrote in news:evPHe.190$ snipped-for-privacy@news.sisna.com:

Ray

That's a bull's-eye

You've put a heck of a lot of work into it. It would have taken me weeks to decipher the syntax for those constants. I had a look at the info posted by Wayne, yesterday, and although the constants are there in the help files there's nill info about the syntax.

Goofy help files: ( see "System Options" in VB help - but first type "swUserPreferenceDoubleValue" into the code area and press F1 to invoke help, then scroll down for "System Options" )

I am in your debt for the code.

Thanks Ray

BW

rmchugh wrote in news: snipped-for-privacy@comcast.com:

................ clip

PS

It works in SWK 2K5

Funny thing, when I try to change the font in a table (BOM), only the last row is affected. However, the same behavior is observed when done manually from the menu.

I've not yet checked the all of the settings adjustments, but so far it behaves as though a manual change had been implemented.

nicely done

thanks

BW

" snipped-for-privacy@carrollhealthcare.com" wrote in news:Xns96A7B75A3E69BBWelchcarrollhealthc@216.196.97.142:

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required