Grasshopper

algorithmic modeling for Rhino

i am looking for a opennurbs.dll libary compiled against 4.0. Is something like this existing?

Views: 559

Replies to This Discussion

Hi Michael,

You can get the opennurbs toolkit here

http://opennurbs.org/

 

Are you looking for Rhino 4 or .NET 4?

Thanks,

-Steve

Hi Steve, i tried some coding in an old grasshopper with rhino4 it worked , but when i tried to do some tweaking in visualstudio to make a plugin i got the error that i mix different vesions of net in 1 assembly. I think something is mixed up with the refenced dll. but I do not know what.I am using 4.net with visualstudio 2010. It was possible fo example to bind opennurbs.dll as assembly in Rhino4 and older grasshopper about mid 2010. Now in Rhino5 and the new Grasshopper it throws errors. I think some assemblies are mixed up. I cannot use Rhino.IO.3dmfile.Read as it does not have all functions i need for building a proper database.

 

here is some buggy code snippet for getting the layertree.

 

// pre define
    OnTextLog dump_to_stdout = new OnTextLog();
    dump_to_stdout.SetIndentSize(2);
    OnTextLog dump = dump_to_stdout;
    OnFileHandle dump_fp = null;
    OnXModel model = new OnXModel();
    bool bVerboseTextDump = true;


    string sFileName = @"C:\test.3dm";

    // open file containing opennurbs archive
    OnFileHandle archive_fp = OnUtil.OpenFile(sFileName, "rb");
    if (archive_fp == null)
    {
      dump.Print("  Unable to open file.\n");
      //continue;
    }

    dump.PushIndent();

    // create archive object from file pointer
    OnBinaryArchive archive = new OnBinaryFile(IOn.archive_mode.read3dm, archive_fp);

    // read the contents of the file into "model"
    bool rc = model.Read(ref archive, dump);

    // close the file
    OnUtil.CloseFile(archive_fp);


    RMA.OpenNURBS.ArrayOnLayer layer_array = model.m_layer_table;
    // layerstruktur lesen
    List <System.Guid> list_int = new  List<System.Guid>();
    List <System.Guid> list_parent = new  List<System.Guid>();
    for (int i = 0;layer_array.Count() > i;i++)
    {
      list_int.Add(layer_array[i].m_layer_id);
      list_parent.Add(layer_array[i].m_parent_layer_id);

    }
    // calculate
    List <int> list_depth = new  List<int>();
    for (int i = 0;list_int.Count > i;i++)
    {
      list_depth.Add(tree_decompose(i, list_int, list_parent));

    }

    A = list_depth;
</item>
                    <item name="AdditionalSource" type_name="gh_string" type_code="10"> 

 

int tree_decompose (int position, List&lt;System.Guid&gt; list_guuid, List&lt;System.Guid&gt; list_parent)
  {
    int temp_position = position;
    int send = 0;
    if (position != 0){
      if (list_parent[position] != System.Guid.Empty)
      {
        temp_position = list_guuid.IndexOf(list_parent[position]);
        send = 1 + tree_decompose(temp_position, list_guuid, list_parent);
      }
      if (list_parent[position] == System.Guid.Empty){send = 0;}
    }

    if(position == 0){send = 0;}
    return send;

  }

Hi Michael,

If you are working on something that runs inside of grasshopper, you definitely DO NOT want to use the opennurbs files at the link I gave. Those files are for adding 3dm file I/O capabilities to an external application (not running in the rhino process.)  Are you trying to add a reference to a file named "Rhino_DotNet.dll" or am I confused?

 

As it happens, I am working on adding features to the File3dm class right now.  This seems like the best solution in the long run for you instead of having to add a reference to a different DLL just for this one feature.  What specifically is missing from the File3dm class that you need?  I'm having trouble reading your code sample (please ning give us code formatting).  Are you trying to read layer information out of a file?

 

Thanks,

-Steve

ok here are some features... 

 

1.

Rhino.FileIO.File3dm read_in = Rhino.FileIO.File3dm.Read(@"I:\Users\m.sprinzl\test.3dm");
 A = read_in.Layers[3].FullPath;

 

.fullpath is not working it seems that it is flattening the tree node hierarchy.

 

2. name of objects in 3dm file...

 

this are the two features i would like..

Hi Michael,

These should both be available in the next V5 Beta.  FullPath on layers is similar to a file path, where the entire hierarchy is embedded in the path itself.

 

Thanks,

-Steve

Thanks Steve,

whats great news....

Thx steve i can now get the names of the objects in a external rhinofile ... This gives me Lot of flexability in my grasshopperdefinitions.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service