Grasshopper

algorithmic modeling for Rhino

Hey all,

What is the best way to split a surface in RhinoCommon? SrfSplit in grasshopper is ridiculously slow. In Rhino I am able to select a surface and then split it with a set of curves almost instantaneously, so I was hoping there would be a solution in RhinoCommon. I asked this question before and the current solution is this:

import Rhino.Geometry
temp1=Rhino.Geometry.BrepFace.Split(mybrep.Faces[0],mycurves,mytolerance).Faces

temp2=[]

for i in temp1:

    temp2.append(i.DuplicateFace(False))

a=temp2

The problem with this method is that it still runs significantly slower than in Rhino. I'm still a bit fuzzy as to why my trimmed surfaces need to be converted to breps (mybrep is actually a trimmed surface in Rhino, but I changed the hint to say that it is a brep). The other thing I am not understanding is why I need to do DuplicateFace() (why can't temp1 be the split geometry)?

Views: 5015

Replies to This Discussion

I suspect all the code is using the same function eventually. How do you measure the duration of doing it 'in Rhino'?

I'm still a bit fuzzy as to why my trimmed surfaces need to be converted to breps (mybrep is actually a trimmed surface in Rhino, but I changed the hint to say that it is a brep).

Surfaces cannot have trimming information in Rhino, any trimmed surface or polysurface is always a Brep. If you convert a BrepFace to a Surface, you lose the trimming curves.

The other thing I am not understanding is why I need to do DuplicateFace() (why can't temp1 be the split geometry)?

I'm not entirely sure, but it could be because of BrepFace/Brep difference. A BrepFace is always part of a master Brep, you cannot have just a loose face. So maybe the DuplicateFace turns the BrepFace into a standalone Brep?

I've attached a model and script. When I use the split command in rhino, it takes 1 second at most to execute. When I use the script above, it takes over 11 seconds. I feel like surface perforation is a very common thing among grasshopper users- surface splitting needs to be faster.

I posted a similar question a few weeks ago, and found that Illustrator actually has very good curve/region boolean tools. Maybe Rhino and Grasshopper can try to provide comparable tools?

Attachments:

Hi Lawrence, for a case like this I'd use the IsoTrim component (in Surface> Util tab) instead:
No need for the curves anymore.

Thanks for the suggestion. The example was purely to demonstrate the difference in computation time between splitting in rhino and splitting in rhinocommon.

Reported here. Thanks

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

I've found a partial solution when it comes to polylines, the clipper library gives pretty fast and reliable results when it comes to 2D polylines. If you require curavture, it becomes a bit more difficult.

http://www.food4rhino.com/project/clipper

Is this slower in Grasshopper in particular compared to doing the same commands within the Rhino Python editor?

I am not sure. I've never used the Rhino Python Editor before. If you have experience, could you run it through the Rhino Python Editor to see if there is a time difference (the model is found in my reply to David Rutten)? The reason why I am using the Grasshopper Python component is because I need to split surfaces as part of a Grasshopper script. I'm surprised that not more people have flagged this issue.

It is a Grasshopper -vs- RhinoCommon (and therefore, RhinoPython, GhPython, Grasshopper) thing:

Thanks for the reply, Giulio.

What I am trying to get is a solution to this problem. Is there a faster split function in rhinocommon or rhinoscriptsyntax? If split works quickly in Rhino, why can't it work quickly within Grasshopper?

Probably, but I am not certain, because it is doing more work than it is required.

We will investigate.

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

Hi all,

good news. In Rhino WIP, now the Brep Spit operation attached to this discussion by Lawrence takes more than an order of magnitude less to complete. Here it takes 207ms in place of 2.5s.

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

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service