Update Drawing Template Properties Globaly.

Is there a way to update drawing titleblocks/templates globally? Or do I have to do this one at a time?

SW2008

Thanks All!

-Mark

Reply to
mechdesign2k4
Loading thread data ...

Well, I think you can do that with the solidworks task scheduler - you can find it in START>PROGRAS>SOLIDWORKS>TOOLS but only if you have a pdm licsense.

Other wise a macro can be written to solve that problem but that is a question for a mike to answer.

Good luck. Ron.

Reply to
ronsharo

In SW2007 I don't know if it works in SW2008 as I don't use it.

You can edit the sheet format and save it as a drawing template using a .slddrt file extension. select Sheet Formats as the file type.

Otherwise I did not understand your question.

Reply to
Gang Greene

Thanks,

I guess I was looking for a way to update a bunch of drawings at once... rather than open and reload each one.

-Mark

Reply to
Mark V

You would have to open each one and resave it.

There are some tools from SW, but they all fail miserable.

You need a macro, I can paste mine later (I found the pieces on this newgroup and putted it together)

I made so I could have some people assist me doing it in weekends etc. But also have in mind that my API skills are limited and the code could probably be written much simpler.

What I found out converting hundreds of thousands files was that you cant run more than ~100 parts / small assemblies. The bigger ones really depends on how much memory they take up, as the macro dosnt restart SW between each it fills up.

Option Explicit

Private Sub cmdCancel_Click() End End Sub

Private Sub cmdOpdater_Click()

Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.PartDoc 'SldWorks.PartDoc / SldWorks.DrawingDoc / SldWorks.AssemblyDoc Dim ReturnVal As Long Dim Response As String Dim DocName As String Dim Success As Boolean Dim DocType As String Dim swUpper As String Dim swDocTypeLong As Long Dim nErrors As Long Dim nWarnings As Long

' *********** YOU MAY HAVE TO CHANGE THIS *********** ' change the following constant to target a directory Const workDir = "W:\TEMP2008\" ' *********** YOU MAY HAVE TO CHANGE THIS *********** ' change the following constant to target a type of file Const swDocType = ".SLDPRT" ' I am only want to open drawing files ' the following constants are used in the OpenDoc2() function 'Const swDocNONE = 0 'Const swDocPART = 1 'Const swDocASSEMBLY = 2 'Const swDocDRAWING = 3 Const readOnly = 0 ' 0-false 1-true Const viewOnly = 0 ' 0-false 1-true Const silent = 1 ' 0-false 1-true ' the following constants are used in the ' SetUserPreferenceDoubleValue() function

' start of main program Set swApp = Application.SldWorks swApp.Visible = True ChDir (workDir) Response = Dir(workDir) Do Until Response = "" ' see if filename ends with .SLDDRW swUpper = UCase$(Response) If Right(swUpper, 7) = swDocType Then

' open the SolidWorks file If UCase$(swDocType) = ".SLDPRT" Then swDocTypeLong = swDocPART ElseIf UCase$(swDocType) = ".SLDASM" Then swDocTypeLong = swDocASSEMBLY ElseIf UCase$(swDocType) = ".SLDDRW" Then swDocTypeLong = swDocDRAWING Else Stop 'Error Occured End If

Dim swName As String swName = workDir & Response

Set swModel = swApp.OpenDoc6(swName, swDocTypeLong, swOpenDocOptions_e.swOpenDocOptions_Silent, "", nErrors, nWarnings)

'readOnly, viewOnly, silent, ReturnVal)

'Response, swDocTypeLong,

' add your own code here to do ' whatever you want to the part file

' close the part DoEvents

swModel.ForceRebuild3 False

DocName = swModel.GetTitle ReturnVal = swModel.Save2(silent)

swApp.CloseDoc DocName Set swModel = Nothing

End If

' get the next filename

Response = Dir Loop

Set swApp = Nothing End Sub

Private Sub txt1_Change()

txt1.Locked = True txt1.Enabled = False

End Sub

Private Sub UserForm_Initialize()

txt1.Text = "W:\TEMP2008\" txt1.Enabled = False txt1.Locked = True txt1.BackColor = RGB(212, 208, 200) End Sub

Reply to
Ronni

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.