Grasshopper

algorithmic modeling for Rhino

Hello,

I am having a problem working my way around GH and Python SDK's.

Let's say I want to build the same exact GH component named "Brep Wireframe" that retrives the wireframe curves of a Brep.

I am working in Visual Studio Express 2013. I am learning GH and Rhino sdk now so sorry for the basic question.

I managed to retrieve the wireframe of my brep by using the Brep from the Rhinocommon.dll. By doing so, though, I can't get to preserve my GH path (this means that when I manipulate the incoming breps structure (for instance grafting) the structure in output is not what I would expect.

In this case I have looped over the Brep faces and then got the wireframe of each face. Out of this, yes, there are double curves but that's not my focus for now since I still don't fully understand how to structure the data.

Based ont that I did some research online and my understanding is that I should be using GH_Brep rather than Brep (this last one being from Rhinocommon). I did that but by doing so I cannot get the wireframe function that I would use with Brep since I cannot retrieve the faces of a GH_Brep...what am I doing wrong?

Hope my explanation was clear enough.

Thanks for your help.

this is part of the code using GH_Brep:

//List<Curve> crv = new List<Curve>();

GH_Structure/font>GH_Brep> brep = new GH_Structure/font>GH_Brep>();

//Wireframe curves of brep

GH_Curve brepcrv = null;

//Single Brep of Rhino type

Brep brepsingle = null;

//Brep of GH type

GH_Brep brepGH = null;

GH_Curve gcrv = null;

GH_Structure/font>GH_Brep> brepDataOutput = new GH_Structure/font>GH_Brep>();

if (!DA.GetDataTree(1, out brep)) return;

for (int i = 0; i /font> brep.Branches.Count; i++)

{

GH_Path Path = brep.Paths[i];

for (int j = 0; j /font> brep.Branches[i].Count; j++)

{

//Once in here how do I retrieve the faces of the brep and then the wireframe?

brepGH = brep[Path][j];

gcrv = crv[Path][j];

DataOutput.Append(gcrv, Path);

brepDataOutput.Append(brepGH, Path);

}

}

 

DA.SetDataTree(2, brepDataOutput);

Views: 818

Replies to This Discussion

Hi HO,

could you please upload the file?
I would need a sample -- let's see if I or someone else will be able to make this work.

Thanks,

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Giulio,

Sorry I never replied to this. I just noticed that.

Unfortunately I have been tweaking the file around and don't have the "working" version anymore.

 

I'll try to put it together again and re-post it.

Thank you for your help.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service