SW 2005 dwgEditor API

Discussion in 'SolidWorks' started by R&E, Jan 28, 2005.

  1. R&E

    R&E Guest

    hi,
    does anyone have any sample API code (VB) for SW 2005 dwgEditor - I want to
    be able to use the API to save drawings as a dxf

    Thanks
    Emma
     
    R&E, Jan 28, 2005
    #1
  2. R&E

    That70sTick Guest

    Do you really need the drawing editor to do this? I thought you could
    export DXF from the main SW API.
     
    That70sTick, Jan 29, 2005
    #2
  3. R&E

    R&E Guest

    I want to be able to batch export dwg files (from autocad) or convert a
    drawing someone has done in the editor to dxf.



    I have created a utility to convert to a dxf from the main SW API - but not
    from the editor. How do you call the editor to even open?



    Thanks
     
    R&E, Jan 29, 2005
    #3
  4. R&E

    That70sTick Guest

    Sorry. My SW2005 is still in the box awaiting SP 1.0.

    It's possible that SW didn't make any API available for the Dwg Editor,
    just like SW Explorer.
     
    That70sTick, Jan 29, 2005
    #4
  5. Emma,

    Here is the code to connect to DWGEditor from VB(A):

    Option Explicit

    Public objIcad As DWGEditor.Application
    Public ActiveDrawing As DWGEditor.Document
    '// START ACTIVE X CONNECTION //
    Public Function Connect() As Boolean
    Dim IcadRunning As Boolean
    On Error GoTo Err_Control
    IcadRunning = IsICADOpen()
    If IcadRunning Then
    Set objIcad = GetObject(, "DWGEditor.Application")
    Else
    Set objIcad = CreateObject("DWGEditor.Application")
    End If
    objIcad.Visible = True
    Set ActiveDrawing = objIcad.ActiveDocument
    Connect = True
    Exit_Here:
    Exit Function
    Err_Control:
    MsgBox Err.Description
    Resume Exit_Here
    End Function

    Function IsICADOpen() As Boolean
    On Error Resume Next
    Set objIcad = GetObject(, "DWGEditor.Application")
    IsICADOpen = (Err.Number = 0)
    Set objIcad = Nothing
    Err.Clear
    End Function

    HTH,

    Bert
     
    Bert Muijtstege, Jan 31, 2005
    #5
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.