simple macro help

I've used the macro feature a couple of times before but never got into programming with code.

I have created a macro that rotates the part to an isometric view, zooms it to fit the screen and saves it to a specific location.

' **************************************************************************** ** ' C:\DOCUME~1\lucas\LOCALS~1\Temp\swx1772\Macro1.swb - macro recorded on 08/26/05 by lucas ' **************************************************************************** ** Dim swApp As Object Dim Part As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long Dim FeatureData As Object Dim Feature As Object Dim Component As Object Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc Part.ShowNamedView2 "*Isometric", 7 Part.ViewZoomtofit2 Part.SaveAs2 "E:\Lucas\Seradex Items\Part Pictures\11115.JPG", 0, True, False End Sub

As you can see, the part is always saved under the name "11115.JPG". I would like to change it so that the file name minus the ".SLDPRT" is used.

Can anyone help me out?

Thanks

Reply to
Knotfreak
Loading thread data ...

This might be of some help:

'Get the full pathname of the document PName = Part.GetPathName()

'Strip off the path leaving the document name and extension ptrFname = InStrRev(PName, "\") + 1 FName = Mid(PName, ptrFname)

'Strip off the extension ptrFname = InStr(FName, ".") - 1 FName = Left(FName, ptrFname)

Reply to
TOP

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.