batch edrawings

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?


Reply to
Loading thread data ...

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:

formatting link

Reply to
Paul Delhanty


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


Reply to

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.