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)
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
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
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
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
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
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
Regards,
Scott Baugh, CSWP
http://www.3dvisiontech.com
http://www.scottjbaugh.com
FAQ731-376
RE: Settings macro
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
RE: Settings macro
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
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
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
RE: Settings macro
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
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
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