Hey I have been trying to make a macro, so I can change the properties on all my weldment profiles.
I have putted together some pieces but I cant find any info on how to treat the SLDLFP files, its no problem with the standards (drawings, parts and assemblies).
So here is what I got so far.. I have putted some stars where I need input :-)
Dim swApp As SldWorks.SldWorks Dim swModel As ***** 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
Const workDir = "x:\weldmentprofiles..." Const swDocType = ".SLDLFP"
Set swApp = Application.SldWorks swApp.Visible = True ChDir (workDir) Response = Dir(workDir) Do Until Response = "" swUpper = UCase$(Response) If Right(swUpper, 7) = swDocType Then
If UCase$(swDocType) = ".SLDPRT" Then swDocTypeLong = swDocPART ElseIf UCase$(swDocType) = ".SLDASM" Then swDocTypeLong = swDocASSEMBLY ElseIf UCase$(swDocType) = ".SLDDRW" Then swDocTypeLong = swDocDRAWING ElseIf UCase$(swDocType) = ".SLDLFP" Then swDocTypeLong = ***** Else Stop 'Error Occured End If
Dim swName As String swName = workDir & Response
Set swModel = swApp.OpenDoc6(swName, *******, swOpenDocOptions_e.swOpenDocOptions_Silent, "", nErrors, nWarnings)
retval = swModel.AddCustomInfo2("New prop name", "Text", "New prop text")
Do events
DocName = swModel.GetTitle ReturnVal = swModel.Save2(silent)
swApp.CloseDoc DocName Set swModel = Nothing
End If
Response = Dir Loop
Set swApp = Nothing End Sub