INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Member Login

HANDLE


PASSWORD
Remember Me
Forgot Password?

Come Join Us!

  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • Turn Off Ad Banners
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

E-mail*
Handle

Password
Verify P'word
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Member Feedback

"...Your site is one of the cleanest and BEST forums that I have seen. I have sent quite a few people your way. Keep up the good work!!!"

Geography

Where in the world do Eng-Tips members come from?

API and Macros

Save As Parasolid
Posted: 25 Feb 03

The following macro was created to ease the process for Exporting Sheetmetal parts into another programs. It provide a single click SaveAs in the Parasolid file format to a Specific Directory.
   The MyPath variable should be changed to specify a directory on your system or commented out so that the current directory is used. The file saved will have the same name as the original model.
   WARNING: This Macro provides a prompt, does the SaveAs, and then closes the model. If you make changes to the model and have not saved them, those changes will be lost!
   The way I normally use this macro is to load a dozen sheet metal files and run the macro on each of them. When there are no more files visable then everything done.
   By changing the Extension in the NewName variable, other filetypes can be saved including Tiff and Iges.

This macro works with SW2001+ - I have not tried it with SW2003

' ********************************************************
' Save As Parasolid.swb - Recorded on 02/10/02 by Lee Bell
' ********************************************************
Dim SwApp, Model As Object
Dim MyPath, ModName, NewName As String
Dim MB As Boolean

Sub main()
  Set SwApp = CreateObject("SldWorks.Application")
  ' This ensures that there are files loaded in SWX

  Set Model = SwApp.ActiveDoc
  If Model Is Nothing Then
      MB = MsgBox("This routine requires files to be loaded before it is ran" + Chr(13) + _
                  "Please load a file and run the routine again", vbCritical)
      Exit Sub
    End
  End If

' Use the current directory
  MyPath = CurDir
' Or specify the directory you want to use
' Comment out the next line if you want to use the current directory
  'MyPath = "C:\Where\Ever\Directory\You\Want\"

  ModName = Model.GetTitle
  NewName = Left(ModName, Len(ModName) - 7) + ".X_T"
  MB = MsgBox("Saving " + NewName + " To" + Chr(13) + MyPath, vbCritical)

  Model.SaveAs2 MyPath + NewName, 0, True, False

  Set Model = Nothing
  SwApp.CloseDoc ModName
End Sub

Back to SolidWorks 3D CAD products FAQ Index
Back to SolidWorks 3D CAD products Forum
My FAQ Archive
Email This FAQ To A Friend

My Archive