13 Replies Latest reply on Aug 19, 2016 11:07 AM by Scott Stuart

    edrawing api (2016) where to get AxEmodelView

    Duane Blanchet

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

        • Re: edrawing api (2016) where to get AxEmodelView
          Heinz Navratil

          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

            • Re: edrawing api (2016) where to get AxEmodelView
              闫 志 峰 志 峰

              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 ?

              • Re: edrawing api (2016) where to get AxEmodelView
                Robert Duncan

                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.

                  • Re: edrawing api (2016) where to get AxEmodelView
                    Simon Turner

                    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.

                      • Re: edrawing api (2016) where to get AxEmodelView
                        Robert Duncan

                        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, "");

                    • Re: edrawing api (2016) where to get AxEmodelView
                      Scott Stuart

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

                    • Re: edrawing api (2016) where to get AxEmodelView
                      Dan Miel

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

                        • Re: edrawing api (2016) where to get AxEmodelView
                          Simon Turner

                          You need to follow all of these steps:

                          2016 SOLIDWORKS API Help - Getting Started

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

                            • Re: edrawing api (2016) where to get AxEmodelView
                              Dan Miel

                              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.

                                • Re: edrawing api (2016) where to get AxEmodelView
                                  Sascha Smolny

                                  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

                                    • Re: edrawing api (2016) where to get AxEmodelView
                                      Dan Miel

                                      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

                                        • Re: edrawing api (2016) where to get AxEmodelView
                                          Sascha Smolny

                                          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)

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

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

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

                                           

                                           

                                          And it seems to be working.

                                           

                                          Regards,

                                          Sascha