From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the OpenDoc (Solidworks) ActiveX method to work in LabVIEW?

Solved!
Go to solution

This specific invoke node I am having trouble with is the first one in my code: IEModelView Control, OpenDoc method.

 

For my application I need to print certain drawings (programmatically) from a shared drive.  Most of these drawings are .DWG or .pdf.  However, there are some drawings in the .SLDDRW format.  I downloaded the free eDrawings 2012 from Solidworks in order to achieve this, but I've been running into problems with the OpenDoc method.

 

When LabVIEW gets to the invoke node, it "hangs," - it doesn't execute further and the VI cannot be stopped (I usually have to force-quit it with Ctrl-Alt-Del).  In my code I have 30 s time delays (probably not necessary, was just making sure that eDrawings had time to finish the command) and "<Insert Your Printer Here>" as the printer name - obviously replace with your own printer's name - not that it matters because the execution does not reach that far in the code.

 

I'm going to post this question on the Solidworks website too (I'll post a link as a reply to this thread) incase it is more of a eDrawings debugging thing than a LabVIEW debugging thing.

 

The API for this method is here:

http://help.solidworks.com/2011/English/api/emodelapi/eDrawings.Interop.EModelViewControl~eDrawings....

 

I'm running LabVIEW 2010 and eDrawings 2012 on Windows XP.

 

Thank you for your help!

James

 

These forums have been a huge help before for me - hopefully the same happens even though my question hasn't been answered before.

0 Kudos
Message 1 of 8
(7,649 Views)

Link to the same question on Solidworks:

https://forum.solidworks.com/thread/60922

 

0 Kudos
Message 2 of 8
(7,645 Views)

Hello JamesEdward,

 

Have you registered the ActiveX object with windows?

 

http://digital.ni.com/public.nsf/allkb/4F811A9B23F1D46E862566F700615B7A

 

Are you getting a specific error code or is it just hanging?

 

Thanks,

Joel C

National Instruments

 

 

Message 3 of 8
(7,617 Views)

I assumed that if I could see the ActiveX controls in the LabVIEW ActiveX browser they were registered.

 

But I tried:

"C:\Program Files\Common Files\eDrawings2012\EModelView.dll" /RegServer

and

"C:\Program Files\Common Files\eDrawings2012\EModelView.dll" /UnRegServer

neither worked, I got a an "Open With..." prompt.  Is there a way to format these Run... commands such that it doesn't think I'm trying to open the file?

 

I downloaded the zip file on the help page you linked.  I used that to Unregister "EModelView.dll"

I know this worked because going back into my LabVIEW program, I could not find the ActiveX controls that I was using before.

I then used that same program to register "EModelView.dll", and when I reopened, I could access those controls agian.

 

Except that running my LabVIEW program resulted in the same problem: Execution reaches the first Invoke node (OpenDoc) and then nothing happens.

 

I get no specific error code, LabVIEW just hangs.

 

Thank you for your help thus far!  Is there any more information you need?

 

One Idea:  I have spaces in my filepath (Documents and Settings).  Would that cause an issue as the String input to the FileName argument?  I convert a path control to string using the "Path to String" funtcion.

 

James

0 Kudos
Message 4 of 8
(7,604 Views)
Solution
Accepted by topic author JamesEdward

Ok - It seems to be working now- two fixes:

 

1) I was using a automation constant,I should have used an activeX container.

• When i was initially looking for the control, I could not find it by browsing for items to put into the activeX container, so that is why i was using the constant.  I think that unregistering and reregistering the control might have cause it to appear in that list.  Not sure, as I can't go back in time and figure out if it was there or not.

 

2) Our printers are on a server, so just giving the printer name (or how it appears in your "Devices and Printers" control panel) is not appropriate, it has to be something like:

\\PrinterServer\PrinterName

 

Thank you for your help,

James

0 Kudos
Message 5 of 8
(7,592 Views)

JamesEdward:

 

I'm triying to integrate a solidworks viewer into my labview app. But I can not find the control.

 

Did you remember the name of the control in the list? I have hundreds of them and the list is size-fixed.

 

Thank you!

0 Kudos
Message 6 of 8
(6,752 Views)

I believe it was "EModelViewControl" or "IEModelViewControl".  I can't be sure, because the VI that I looked in was made on my old laptop.  I've since gotten a new laptop, but have not revisited this project, so I have not reinstalled this control.

 

I hope this is what you needed.

 

James

0 Kudos
Message 7 of 8
(6,748 Views)

can you post your working code, please?

0 Kudos
Message 8 of 8
(3,588 Views)