×
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

Settings macro

Settings macro

Settings macro

(OP)
I'm looking for a way to create a macro that will set all the "document settings" I have in my template to an old company drawing. I find myself setting the document font and size for each old drawing that I have. This becomes very tedious. I did find an excel-based macro on the internet that will set most of the document settings but not the font style and size. And the macro is password protected so I cannot edit or manipulate it. Does anyone have any ideas on creating a simple macro to set font style and size that I specify in my templates? I am new to VB so please be gentle.

Thanks,

Jon (a.k.a. jksolid)

A man should look for what is, and not for what he thinks should be. -Albert Einstein

A person who never made a mistake never tried anything new. -Albert Einstein

RE: Settings macro

Jon,
For SolidWorks 2004 Check out “Copy Option Wizard”
Click windows Start button, Programs, SolidWorks, SolidWorks Tools, then Copy Option Wizard.

For SolidWorks 2005 Check out “Copy settings Wizard”
Click windows Start button, Programs, SolidWorks, SolidWorks Tools, then Copy “Copy Settings Wizard”

Bradley

RE: Settings macro

Is this the macro that you tried?
http://swtools.cad.de/mac_copyopt.htm

It was created by Stefan Berlitz and seems VERY complete.  It does not appear to be updated for 2005 yet, but it should work (perhaps missing a couple new or changed 2005 options).

It is not password protected, but all API remarks are in German (I think).

RE: Settings macro

(OP)
Thank you Bradley and Arlin for your prompt responses.

Bradley,

I completly forgot about that program, thanks for the reminder. But do you know if there is a way to imbed the Copy Option Wizard into a menu item, Like the Solidworks Explorer is in the "Tools" menu?

Arlin,

That is the macro I did try but it does not apply text style and text size to the drawing. It mentions a few other things that it does not update also.

A man should look for what is, and not for what he thinks should be. -Albert Einstein

A person who never made a mistake never tried anything new. -Albert Einstein

RE: Settings macro

Why do you need a macro to do this???

Your Document settings are saved in the templates you use on a daily basis. If you open a new file up using the template that you normally use and then change the settings in Tools\Options\Document Properties - Then save it off either as the same name or as a new name (Save it as an *.xxxdot file) then the next time you start a new file you have the template with all your settings in it. No needs to run a macro.

Regards,

Scott Baugh, CSWP
http://www.3dvisiontech.com
http://www.scottjbaugh.com

FAQ731-376

RE: Settings macro

(OP)
Scott,

The reason I need a macro to do this is that we have old templates that were used before I got here. I then created new templates that have logic to them(unlike the old ones). Now we are trying to update the old files that used the old templates and trying to update all those options for each drawing seems quite unnecessary. Especailly when we have 20 or more drawings to do at a time.

A man should look for what is, and not for what he thinks should be. -Albert Einstein

A person who never made a mistake never tried anything new. -Albert Einstein

RE: Settings macro

(OP)
Scott,

Sometimes it is the simplest things that we seem to forget.

That will save me lots of time.

Thanks again!

A man should look for what is, and not for what he thinks should be. -Albert Einstein

A person who never made a mistake never tried anything new. -Albert Einstein

RE: Settings macro

If you still need such a macro I can help ya out.

RE: Settings macro

(OP)
AAMOROSO,

If you don't mind I would like to see what kind of macro you have to do this. I think it would benefit the other users here that are unfamiliar with SW.

A man should look for what is, and not for what he thinks should be. -Albert Einstein

A person who never made a mistake never tried anything new. -Albert Einstein

RE: Settings macro

[code]

Sub main()

Dim Now         As Boolean
Dim StdFont     As Object


    
    
Set swApp = Application.SldWorks                    ' Attach to SolidWorks
Set Document = swApp.ActiveDoc                      ' Get active document
 
        If Not Document Is Nothing Then                 ' A Document is open
            FileTyp = Document.GetType                  ' Get document type
            If FileTyp = swDocDRAWING Then              ' If it is a drawing continue else skip ahead
                SheetNames = Document.GetSheetNames
                                
'*********** Set new defaults for Font settings on all annotation types **************************

           
            
                Set StdFont = Document.GetUserPreferenceTextFormat(swDetailingDetailTextFormat)
                    StdFont.TypeFaceName = "Helvetica"
                    StdFont.CharHeightInPts = "10"
                    Now = Document.SetUserPreferenceTextFormat(swDetailingDetailTextFormat, StdFont)
                              
                Set StdFont = Document.GetUserPreferenceTextFormat(swDetailingBalloonTextFormat)
                    StdFont.TypeFaceName = "Helvetica"
                    StdFont.CharHeightInPts = "10"
                    Now = Document.SetUserPreferenceTextFormat(swDetailingBalloonTextFormat, StdFont)
                            
                Set StdFont = Document.GetUserPreferenceTextFormat(swDetailingDimensionTextFormat)
                    StdFont.TypeFaceName = "Helvetica"
                    StdFont.CharHeightInPts = "10"
                    Now = Document.SetUserPreferenceTextFormat(swDetailingDimensionTextFormat, StdFont)
                              
                Set StdFont = Document.GetUserPreferenceTextFormat(swDetailingNoteTextFormat)
                    StdFont.TypeFaceName = "Helvetica"
                    StdFont.CharHeightInPts = "10"
                    Now = Document.SetUserPreferenceTextFormat(swDetailingNoteTextFormat, StdFont)
                
                Set StdFont = Document.GetUserPreferenceTextFormat(swDetailingGeneralTableTextFormat)
                    StdFont.TypeFaceName = "Helvetica"
                    StdFont.CharHeightInPts = "10"
                    Now = Document.SetUserPreferenceTextFormat(swDetailingGeneralTableTextFormat, StdFont)
                              
                Set StdFont = Document.GetUserPreferenceTextFormat(swDetailingSectionTextFormat)
                    StdFont.TypeFaceName = "Helvetica"
                    StdFont.CharHeightInPts = "10"
                    Now = Document.SetUserPreferenceTextFormat(swDetailingSectionTextFormat, StdFont)
                           
                Set StdFont = Document.GetUserPreferenceTextFormat(swDetailingSurfaceFinishTextFormat)
                    StdFont.TypeFaceName = "Helvetica"
                    StdFont.CharHeightInPts = "10"
                    Now = Document.SetUserPreferenceTextFormat(swDetailingSurfaceFinishTextFormat, StdFont)
                            
                Set StdFont = Document.GetUserPreferenceTextFormat(swDetailingWeldSymbolTextFormat)
                    StdFont.TypeFaceName = "Helvetica"
                    StdFont.CharHeightInPts = "10"
                    Now = Document.SetUserPreferenceTextFormat(swDetailingWeldSymbolTextFormat, StdFont)
                
                Set StdFont = Document.GetUserPreferenceTextFormat(swDetailingViewArrowTextFormat)
                    StdFont.TypeFaceName = "Helvetica"
                    StdFont.CharHeightInPts = "10"
                    Now = Document.SetUserPreferenceTextFormat(swDetailingViewArrowTextFormat, StdFont)


End Sub
[code]

RE: Settings macro

(OP)
aamoroso,

Thanks for the code. I will try it out and let you know how it works for us here.

A man should look for what is, and not for what he thinks should be. -Albert Einstein

A person who never made a mistake never tried anything new. -Albert Einstein

RE: Settings macro

ooops, missing a couple of end ifs before End Sub, sorry bout that, also I should mention this will set all your defaults to Helvetica Font, 10pt

RE: Settings macro

(OP)
aamoroso,

What are the end ifs statements?

I could not figure them out.

A man should look for what is, and not for what he thinks should be. -Albert Einstein

A person who never made a mistake never tried anything new. -Albert Einstein

RE: Settings macro

Notice near the begining of the code it says " If Not Document Is Nothing Then ' A Document is open"

Well if there is no document open it jumps to find an "End IF" so put one at the bottom on the line above "END SUB"

Back to the top notice " If FileTyp = swDocDRAWING Then "  well if file type is not a drawing it will look for the end of that if also, so again above the first end if put another "End if"


the bottom should look like this.

End if
End if
End sub

Let me know if that dont work

RE: Settings macro

(OP)
Works great now!

Thanks for your help.

I might add a user interface to it so that you can select a font that will globalize each setting.

Might take me awhile cuz I am not so good with writing macros as you probably know.

A man should look for what is, and not for what he thinks should be. -Albert Einstein

A person who never made a mistake never tried anything new. -Albert Einstein

RE: Settings macro

yeah, i use the same one with the added features of setting Arrow ht, arrow wt, and several other settings we have recently chaged in our company format. Just remember that only sets the defaults, it wont change existing notes that are not set as defualt font.

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