Grasshopper

algorithmic modeling for Rhino

     Hi,guys! Recently i  wrote a class library using RhinoCommon in C# ,then call the dll from the c++ to get the Nurbs surface intersection point, when i debug the program,It comes as follows: "System.DLLNotFoundException" in the RhinoCommon.dll, it says con't load the DLL"rhcommon_c"(Exception from HRESULT:0x8007007E)!  Do you guys have any idea what the problem is?

          I got some infomation about how call C++ dll in the c#,bla,bla.....,but the rhcommon_c is not C++ dll ,it's a C dll (know from the "depends"),do you gus know how to call C dll in C#!

 

     Any help will be appriciate! 

      

 

 

Views: 2130

Replies to This Discussion

First, here is probably not the best place to ask this question. Go over to the Rhino Plug-ins Newsgroup and they'd be able to help you more than what you'd get here...

http://news2.mcneel.com/scripts/dnewsweb.exe?cmd=xover&group=rh...

Second, I think there are special steps that need to be taken to make a dll written in dotNET work with C++. I don't know what those steps are, but a regular old dotNET dll probably isn't going to cut it.

Last, if your writing something in C++, then why not translate your C# dll directly into C++ code. Since RhinoCommon is going to be calling the base C++ Rhino SDK anyway, it seams like your going through a big round trip from C++ to C# to C++ back to C#, then back to C++. Any way you look at it, its inefficient to do that. I'm just saying...
Thank you,Damien!I know may be this not the best place to ask this question, But I think maybe someone had the same question and we can share the information about the "rhcommon_c.dll".
I'm not say this question clear:I use the RhinoCommon.dll in C# to calculate the Nurbs surface from four corner points and wrap as a class dll,after this ,i call this dll from C++, then comes with this problem"can't load rhCommon_c.dll".Why not call the dll directly in C++, It's too complicated,i googling some method how to call COM Dll,But there no result make me satisfy!
I also try this RhinoCommon to calculate Nurbs Surface in C#,but it have the same problem "con't load the rhCommon_c.dll"!
From the depends,i know the rhcommon_c.dll depend on "openNurbs,Rhino4" and so on, Does anyone have some information about the rhcommon_c.dll,like it's documention!
Its up to you as to where you ask your questions, but understand that the quality of your answer is going to dependant on who's responding. In this location, that quality isn't going to be as good as if you asked on the developers newsgroup. But its your question, so ask it where you like.

Now, AFAIK, you can't just write a DLL in dotNET and expect it to work in C++. Its not going to work like that. It may be that you have to "manually" load the RhinoCommon dll, since C++ is not going to know that your dll is dependent on RhinoCommon and won't automatically load it for you.

COM is a bitch and you probably don't want to go that route if you can avoid it.

From your description, there isn't anything that can't be done directly in C++. And if all that wrapped class is doing is that one function, than you'd definitely be better off just rewriting that function in C++. Below are a few examples that might help.

http://wiki.mcneel.com/developer/sdksamples/createnurbssurface
http://wiki.mcneel.com/developer/sdksamples/edgesrf

I'm at the end of what I can suggest as C++ isn't my language. Considering the lack of responses I would highly recommend asking your question on the Rhino Plug-ins Newsgroup as there are people there with more knowledge than myself and will be able to give you a more specific answer.
Damien,Thank you very much for the examples! I'll find other way to solve this problem!
If you are running your program from within a Rhino Process (ie a Rhino Plug-in) you can reference RhinoCommon. If you're running from Rhinov5 (I assume) it should load RhinoCommon automatically, Rhinov4 it will be loaded if Grasshopper 0.7.xx has been loaded and you can resolve the assembly if Grasshopper is not running.

However I think you may be developing an assembly to run independent of Rhino/Grasshopper. The v4 sdk was split in two parts, OpenNurbs (which is an open dll you can utilize in any projects) and rhino specific library functions (which only can be called/used in Rhino plug-ins). Intersections (as a general rule) were not provided in open nurbs.

If your assembly is independent of Rhino(/Grasshopper), try building your code referencing only openNurbs (c# or c++ version) and see if it provides the capability you need.
Thank you ,Jon! From your reply, I can't use the functions that the RhinoCommon provided outside the Plug-in ! But i happened want to use RhinoCommon's function ,because it's too complecated to create Nurbs surface from four corner points if do it by myself or use the openNurbs.dll! Do you have any ideas about how to create a nurbs surface from four corner points?
Ooops!!.it seems to i have to do this by myself!
By the way, I LOVE OPENSOURCE CODE!
OnUtil.ON_NurbsSurfaceQuadrilateral

I haven't tested or used this, and don't know if it works for non planar points (I assume it does).

If it doesn't work, let me know. OpenNurbs is brilliant, I'm a big fan.

Hi,

From this old thread i figured out a problem i was having with some unit tests i've written for a library that will ultimately be part of a series of grasshopper components: The unit tests run in visual studio so rhcommon_c.dll will not run.

Is there a way to get my unit tests to actually test my method? Is there a different approach that i should be using when trying to test my .dll and .gha? Is this a grasshopper forum appropriate question - I think so since i'm encountering a problem trying to develop a GHA.

Thank you !OpenNurbs,BIG FAN as you are ! I'll tell you the result as soon as use OnUtil.ON_NurbsSurfaceQuadrilateral i(I can access the internet but can run the Visual studio,only in the lab,>.<)!
Thank you ,Jon! The "OnUtil.ON_NurbsSurfaceQuadrilateral" worked very will in my project! Do you have any idea how to get the intersection point of a line and the Nurbs surface? There are some functions
deal with the simple intersection in the "OnUtil.ON_Intersect", but no more complicated intersection situation!
Glad to hear it helped. But I think this might be where your problems start.

http://wiki.mcneel.com/developer/opennurbs/limitations

OpenNurbs is powerful, but McNeel have also to protect commercial aspects by retaining many functions behind their license system.
Thank you very much for all the helps you've gave!
I just want to say"I love OPENSOURCE CODE"!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service