MachineSMMC
Industrial
- May 7, 2004
- 70
I have this macro I got from this forum that saves a part file to an iges format. It automatically saves it to the folder location that the part is in. I am going to be using PDM works so I need to have it save it in a different spot. What do I need to change to get this to work?
Here is the Macro:
Option Explicit
Dim swApp, Part As Object
Dim BoolStatus As Boolean
Dim LongStatus As Long
Dim e As Long
Dim w As Long
Dim Msg As String
Dim PartName, Rev As String
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
If ((Part Is Nothing) Or (Not (Part.GetType Eqv swDocPART))) Then
Msg = "A part document must be active to use this command!"
LongStatus = swApp.SendMsgToUser2(Msg, swMbWarning, swMbOk)
End
Else
PartName = Part.GetPathName
PartName = Left(PartName, Len(PartName) - 7) & ".igs"
BoolStatus = Part.SaveAs4(PartName, 0, 0, e, w)
If BoolStatus = False Then
Msg = "Failed to save IGS document!"
LongStatus = swApp.SendMsgToUser2(Msg, swMbWarning, swMbOk)
Else
' Msg = "Saved part as " & PartName
' LongStatus = swApp.SendMsgToUser2(Msg, swMbWarning, swMbOk)
End If
End If
Set Part = Nothing
Set swApp = Nothing
End Sub
Thanks
Chris
Here is the Macro:
Option Explicit
Dim swApp, Part As Object
Dim BoolStatus As Boolean
Dim LongStatus As Long
Dim e As Long
Dim w As Long
Dim Msg As String
Dim PartName, Rev As String
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
If ((Part Is Nothing) Or (Not (Part.GetType Eqv swDocPART))) Then
Msg = "A part document must be active to use this command!"
LongStatus = swApp.SendMsgToUser2(Msg, swMbWarning, swMbOk)
End
Else
PartName = Part.GetPathName
PartName = Left(PartName, Len(PartName) - 7) & ".igs"
BoolStatus = Part.SaveAs4(PartName, 0, 0, e, w)
If BoolStatus = False Then
Msg = "Failed to save IGS document!"
LongStatus = swApp.SendMsgToUser2(Msg, swMbWarning, swMbOk)
Else
' Msg = "Saved part as " & PartName
' LongStatus = swApp.SendMsgToUser2(Msg, swMbWarning, swMbOk)
End If
End If
Set Part = Nothing
Set swApp = Nothing
End Sub
Thanks
Chris