edrawing api (2016) where to get AxEmodelView

I'm trying to update a vb application that used eDrawing 2012 api to 2016. 

I replaced the EModelView reference but I can't find AxInterop.EModelView.dll

I think I need to add the EDrawing Control to the toolbox but I don't see it in the COM Components.

This is my first time working with the eDrawing API so I hope it's not a stupid question..

SolidworksApi macros
Answers 13
HN
HN 2015-12-09 Best Answer

Hi Duane,

do you want to do it under 32-bit?

If yes than there are no good news for you

see note for SWX 2015

Service Packs, Simulation, PDM, 3DVIA Products, SOLIDWORKS Viewer, Free CAD Tools Downloads | Windows, Mac, Linux | SOL…

"This is the last eDrawings version that will install/run on any 32-bit Windows operating System"

regards

Heinz

闫峰
闫峰 2015-12-09

i meet this problem ,too   I develop a solidworks application ,and i want to use edrawing view to see the model,but it fails,can you help me ?

RD
RD 2016-01-13

I'm having similar issues. I did have some luck using the API instructions and samples here: 2016 SOLIDWORKS API Help - Getting Started  I can sort of get this work in Visual Studio 2012 if I don't change the form. I can't find any way to add the control to the Windows Form Toolbox.

I could get a document to open and print, but only if I had a local copy. If I try to mix the EDrawing API and EPDM API in one program, it just crashes.

I've tried doing all sort of things, changing the target .NET platforms of the samples, which use .Net Framework 2. You have to do that anyway if you want to use the EPDM 2016 API, which needs at least v4. This included using the TLBIMP.EXE from that platform. I also tried changing the target platform (X86, X64, Any CPU).

Nothing seems to work here.

ST
ST 2016-01-14

Because devenv.exe is a 32 bit process, you cannot add the 64 bit eDrawings control to the toolbox, and the control would not appear in the form design even if you could add it.

Using the link you supplied is the only way to go - it creates and adds the control to a placeholder at runtime rather than at design time.

This also means you cannot insert the eDrawings control into any 32 bit program, for example a 32 bit Excel macro or spreadsheet.

DM
DM 2016-01-14

What code are you using. I'm using Visual Studio 2010 and coding in Visual Basic.

ST
ST 2016-01-14

You need to follow all of these steps:

2016 SOLIDWORKS API Help - Getting Started

It will work in VS2010, but for x64 projects only.

DM
DM 2016-01-14

Simon,

     Thanks for the link.

     I was actually curious if people are using C# or VB. I have been able to create e-drawing controls and modified an older program we use but the link above did not work for me. I received some different information from my VAR and after several days was able to create the control from that information. I have the process I used half written out and I think I have some time to finish my notes.

Dan Miel

Visual Basic 2010

Using SW2014

Testing SW 2016.

RD
RD 2016-01-14

I can get around the toolbox issue by using a Panel control on the form. You pick this from the Container section of the toolbox.

Then use code like this:

using eDrawingHostControl;

eDrawingHostControl.eDrawingControl thisModelView;

  private void button1_Click(object sender, EventArgs e)

        {

            SWFile = @"C:\2632\82813.SLDDRW";

            thisModelView = new eDrawingHostControl.eDrawingControl();

            //Add control to panel before calling OpenDoc, etc. THIS IS REALLY IMPORTANT.

            this.panel1.Controls.Add(thisModelView);

            thisModelView.eDrawingControlWrapper.OpenDoc(SWFile, false, false, true, "");

    }

This lets you use the form designer for other things (as soon as I try to add a button or something to the form in the API example, the edrawingcontrol vanishes). Maybe if I was a better programmer I could make a reusable User Control by combining a Panel and the eDrawingHostController, but this works for me.

I can only get this to work if I take the eDrawingExample file in the API help, follow the API instructions for this to the letter, and then make copies of that solution and modify those. If I do everything in the API instructions and then try to add this to a new solution, it fails. No idea why.

My main problem, however, is that I can't seem to get this to coexist with the EPDM API. I want to open and print the file from EPDM vault, not my C: drive.

I can open the file, no problem, but it crashes when it hits the SetPageSetupOptions in the code below. No error or anything. It just crashes.

My goal here is to print this without the print dialog. If I remove the references and directives for the EPDM API, this will work. If I leave in the EPDM API, but remove the SetPageSetupOptions line, I will see the print dialog. I just can't do both.

Back to the research.

PrinterSettings ps = new PrinterSettings();

string pName = ps.PrinterName;

thisModelView.eDrawingControlWrapper.SetPageSetupOptions(EModelView.EMVPrintOrientation.eLandscape,
   1, 0, 0, 1, 7, pName, 0, 0, 0, 0);

thisModelView.eDrawingControlWrapper.Print5(false, SWFile, false, false, false,
      EModelView.EMVPrintType.eScaleToFit, 0, 0, 0, true, 0, 0, "");

SS
SS 2016-08-17

Hello,

i have today updated our SolidWorks to 2016. Now i have tried to modify an older vb.net (Visual Studio 2015) program which uses the e-drawing Control in Forms.

I have also tried the way from the API-Help. But i cant get it to work.

Can you share your notes, what you have changed?

Regards,

Sascha

DM
DM 2016-08-17

Sascha,

If you have the control on your form when you start this will be different because the control is created when you start the program. The file from Quest is from my VAR and has the information I used to get the programs going. The other file has a word document with the outline of the steps I did and a sample that I created. These are in Visual Basic 2010. I hope this helps. Ask any question you may have.

Dan Miel

SW 2016 SP04

Visual Studio 2010 VB

SS
SS 2016-08-19

Hello,

many thanks for the examples. It seems to be running now.

I have used the Control on different Froms. So I have created a UserControl for a better handling.

My steps to Update:

1.) Remove the old Control from the Form. (I must do this in the Designer Generated Code)

2.) Remove the old Emodelview Reference

3.) Add the Reference to the new Interop.EModelView.x64.dll (use from the example above or use the batch File to generate it)

4.) Create the Component "eDwHost.vb" (as descipted in your Word-Document)

5.) (Differnet from your Description) Add a UserControl (UCEdrw.vb)

<p>'Written 01-14-2016 Dan Miel.  <br>'Original code was supplied by SolidWorks.</p><p>Imports EModelView.x64</p><p>Public Class UCEdrw</p><p>    'The hostcontainer controls the container itself such as<br>    'Width height location. (See the Sub CreateEdrawContro).<br>    Friend hostContainer As eDwHost = Nothing</p><p>    'The Axemodelviewcontrol1 (Emodel View Control)controls the view controls: opendoc, closeactivedoc,<br>    ' backgrounds, withevents etc.<br>    'Axemodelviewcontrol1 can be any name. I called it this to work better with existing programs<br>    Public WithEvents Axemodelviewcontrol1 As EModelView.x64.EModelViewControl = Nothing</p><p>    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load<br>        CreateEdrawControl()<br>    End Sub</p><p>    Private Sub CreateEdrawControl()<br>        'This creates the Edrawing control at run time.<br>        '=============================<br>        'Added code for 2016 64 bit<br>        hostContainer = New eDwHost<br>        '<br>        Axemodelviewcontrol1 = New EModelViewControl</p><p>        ' Add the container to this form before trying to get the underlying OCX<br>        Me.Controls.Add(hostContainer)<br>        Axemodelviewcontrol1 = hostContainer.GetOcx()</p><p>        hostContainer.Dock = DockStyle.Fill</p><p>    End Sub</p><p>End Class</p>

6.) In the Form (which had the eDrawings Control before) add this:

<p>Imports EModelView.x64</p><p>...</p><p>...<br>Public Class myForm</p><p>    'New EDrawing Control<br>    Dim EDRW As UCEdrw = New UCEdrw<br>    Dim WithEvents Axemodelviewcontrol1 As EModelViewControl</p><p>...</p><p>Private Sub myForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load</p><p>        'New EDrawing Control</p><p>        'First add the Control</p><p>        Me.Controls.Add(EDRW)</p><p>        EDRW.Dock = DockStyle.Fill</p><p>        Axemodelviewcontrol1 = EDRW.Axemodelviewcontrol1</p><p>End Sub</p>

And it seems to be working.

Regards,

Sascha

DM
DM 2016-08-19

I'm glad it helped. I just have one program that uses the control, I like the way you put it in a class.

Dan

SS
SS 2016-08-19

I just went through the process of updating our home-brew drawing viewer program from 2014 to 2016 and was happy to learn that a 32 bit version of the eModelView.dll is actually available. It's part of the PDM Web2 client. See knowledge base solution S-069702.

Be aware that it is buggy. The measure and markup tools don't work (SPR-927101). And when it prompts users to download and install document manager, it will actually download the wrong version and will need to be manually fixed (SPR-964577).