batch edrawings

Discussion in 'SolidWorks' started by Vincev, Dec 7, 2003.

  1. Vincev

    Vincev Guest

    I need to convert a large number of ACAD drawings to edrawings, the
    task schedular will only create edrawings from solidworks files, is
    there anyway around this? I also need to create HTML files from these
    edrawings, can this also be done as part of a batch job/script?

    Thanks
     
    Vincev, Dec 7, 2003
    #1
  2. In principle, you could do this with a macro, if you were happy to do the
    conversion by running the macro from inside SolidWorks. Alternatively, you
    could write pretty much the same code in VB6 and schedule it from a batch
    job.

    You could start by recording a macro of opening one AutoCAD file with the
    options that you want and then saving as an E-drawing. For example, I get
    the following:

    -------------------------------------------
    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

    swApp.LoadFile2 "D:\Program Files\SolidWorks
    2004\samples\tutorial\AutoCAD\7550-021.dwg", "2 3"
    Set Part = swApp.ActiveDoc
    swApp.ActiveDoc.ActiveView.FrameWidth = 1205
    swApp.ActiveDoc.ActiveView.FrameHeight = 850
    Part.SaveAs2 "D:\temp\Draw1.EDRW", 0, True, False
    End Sub
    -------------------------------------------

    LoadFile2 loads foreign files , including AutoCAD. SolidWorks determines
    the file type by the extension, .dwg, .dxf etc. The next string "2 3" are
    AutoCAD specific options that were used to load the file.
    2 - Paper Size B
    3 - LengthUnit Inches
    See the API documentation for details.

    SaveAs2 saves the document to file. Again the file type is determined by
    the extension, so to save an E-Drawing make sure the save name has a .EDRW
    extension.

    You could package the above macro as a function, and call the function in a
    loop to, for example, convert all the AutoCAD files in a directory.
    Apart from the batch job issue, HTML on its own is not so great for
    representing drawings. For something ubiquitous, you could use HTML
    referencing JPEG or GIF files for the drawing data in bitmap format. If
    you want a vector format, then you will probably have to put up with a web
    browser plugin. Philippe Guglielmetti always recommends SVG - see his page
    on vector formats for details:

    http://www.dynabits.com/services/vector/index.htm
     
    Paul Delhanty, Dec 7, 2003
    #2
  3. Vincev

    Vincev Guest

    Paul,

    Thanks for the info! That is what I was trying to do.

    Vince
     
    Vincev, Dec 8, 2003
    #3
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.