Error open a active document

Hi, I’m Spanish, so my English is not very good, I work for a company that makes blocks for footwear and are trying to make a small program to create layers under visual studio, we have encountered a problem opening the active document … …

MRhinoDoc doc = RhUtil.RhinoApp().ActiveDoc();

this line throws a FileNotFoundException exception of the library “Rhino_DotNET.dll” I’m working with that library for Rhino v4, does anyone know what happens?

A greeting.

Can you provide the source to a sample Rhino.NET plug-in project that reproduces this? You do know that RhUtil.RhinoApp().ActiveDoc() can only be called from a Rhino plug-in, correct?

sorry, did not know that this method was exclusive to plugin, then how could access active document in rhino? I just need to create layers from an external program created in visual studio.

Thank you very much for the reply.

If you code is not running Rhino, then your alternative is to access Rhino externally via ActiveX automation.

Here is sample example that demonstrates how to automate Rhino 5, via COM, from a standalone C# application.

The bulk of Rhino’s automation support is in the RhinoScript object. For help with RhinoScript, see Help ->Plug-is -> RhinoScript.

I am now exploring that possibility, but I still find obstacles, now visual studio gives me an exception (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

I have run the sample program under xp virtual machine and it works perfectly, the problem I have with the machine windows 7 it ​​gives me the error exception, any ideas?

This is not an error I am familiar with or have encountered. If you are trying to automate 32-bit Rhino, then make sure your application target’s x86, not “any cpu” or x64. Does this help?

the problem is that no regtlibv12.exe not recorded in the Rhino4.tlb windows 7 library, then launch the process but not registered in the Windows registry … any ideas?

but records the library windows xp smoothly and works perfectly, I followed the steps exactly as in windows xp windows 7…

already solved the problem, the solution to been a little sloppy, I had to go to an xp machine, take all entrances to the windows registry, export and insert them one by one on windows 7, and it works perfectly, according seems not register Rhino4.tlb well, thanks for the replies and I hope this helps someone else in the same situation …

Are you using Rhino 4 or Rhino 5? The both installers register the type libraries, so I’m not sure what you have going on…

I thought so, but I tried it with virtual machines and a laptop, and in all these places, even registering the tlb, I had to register it by hand in the windows registry …

I’m using rhino 4 on windows 7