Edrawing API GetObject

Hello


To open a file in SolidWorks from a macro, I use


Dim swApp As SldWorks.SldWorks

Set swApp = GetObject(, "SldWorks.Application")   ' to retrieve the already open SW

or

Set swApp = CreateObject("SldWorks.Application")  ' to start SW

I would like to do the same thing with eDrawing

Problem, I couldn't find a GetObject for eDrawing

I saw that in my VBA project, I can add as "References"

Library EModelView
    C:\Program Files\SOLIDWORKS Corp\eDrawings\EModelView.dll
    EModelView 2020 Type Library

I tried without success

Set EModelViewApp = CreateObject("EModelView.Application")

but it doesn't work :-(

( I installed SW 2020 / eDrawing 2020 )
 

Hello

If it's just to open a file in eDrawings:

Dim RetVal As Boolean
Dim App As String
Dim File As String

Sub main()
    App = "C:\Program Files\SOLIDWORKS Corp\eDrawings\eDrawings.exe"
    File = "C:\Users\xxx\Desktop\myFile.dxf"
    RetVal = Shell(App &" " & File, 1)
End Sub

Don't forget to put "Microsoft Shell Controls And Automation" as a reference.

Kind regards

Hello

That's how I do it now,

but the problem is to restart an eDrawing application for each file..... 

I wanted to find better using GetObject  CreateObject .....

Look at this example to save a Sldprt as a pdf using the eDrawing API:

https://www.codestack.net/edrawings-api/output/print-to-pdf/

The structure is different from the Solidworks API but it works well. I use it to convert Sldprt to edrawing.