File Exporting Macro

Discussion in 'SolidWorks' started by ctellers, Mar 22, 2005.

  1. ctellers

    ctellers Guest

    Good Morning

    I am looking for a macro that will export an iges file into the current
    directory. I would like to create a button to execute this macro so I
    don't have to go into the file save as pull down all of the time.

    Thanks
    Chris
     
    ctellers, Mar 22, 2005
    #1
  2. ctellers

    CS Guest

    Here is a simple example will export the current drawing to the path it is
    saved in with the same name then it closes the drawing and exports the next
    this one saves to jpg dwg pdf and iges

    Sub main()

    Set swApp = Application.SldWorks
    Set Part = swApp.ActiveDoc
    While Not Part Is Nothing
    If Part.GetType = swDocDRAWING Then
    Set AsDwgDoc = Part

    PartName = Split(Part.GetPathName, ".", -1, vbTextCompare)
    'boolstatus = Part.Extension.SelectByID("Sheet1", "SHEET",
    0.345055119859, 0.1814161421857, 0, False, 0, Nothing)
    Set ThisSheet = AsDwgDoc.GetCurrentSheet
    'ThisSheet.GetName
    'Set MyView = ThisSheet

    Part.Extension.SelectByID ThisSheet.GetName, "SHEET", 0.025,
    0.025, 0.025, False, 1, Nothing
    'Part.ObjectDisplayAsIcon
    AsDwgDoc.EditSketch
    AsDwgDoc.ClearSelection
    Part.SaveAs2 (PartName(0)) & ".jpg", 0, True, True
    Part.ViewZoomtofit2
    Part.SaveAs2 (PartName(0)) & ".dwg", 0, True, True
    Part.SaveAs2 (PartName(0)) & ".pdf", 0, True, True
    Part.SaveAs2 (PartName(0)) & ".igs", 0, True, True
    End If
    swApp.QuitDoc (Part.GetTitle)
    On Error Resume Next
    Set Part = swApp.ActiveDoc
    Wend
    ExitWhile:
    End Sub
     
    CS, Mar 22, 2005
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.