Baking extrusion objects?

unhandled

(Kelvin Cheng) #1

Hi All,

Rhino creates extrusion objects when possible. Is grasshopper able to bake extrusion objects? I always get a polysurface from baking.


File Size!
(David Rutten) #2

Grasshopper 1 was written before Extrusion objects existed and it was never modified to cater for them. If you extrude in GH you will get polysurfaces from the outset.


(Anika Boeller) #3

Hi David.
Is this still the case for Rhino 6/Grasshopper?

I would like to extrude urban plans to random heights, with keeping the model as small as possible…
if not, do you have a suggestion how to do it any other way, maybe outside grasshopper?

Thanks a lot in advance!
Anika


(Laurent Delrieu) #4

It seems that it still not there. See this discussion

It could be easy to generate Extrusion using Rhinocommon
http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Extrusion_Create.htm
But it is possible that Grasshopper will transform it in something else and lost its advantages.


(Anika Boeller) #5

hi. thanks…
could u combine the rhinocommon solution with some randomizing parameter for height?


(Laurent Delrieu) #6

I did a little example


The benefit in size is huge !!

The C# is super simple. I generate some closed polygon which are extruded randomly. One with a C#, but if you bake with Grasshopper Button it will become Brep/Polysurface (heavy 20Mo)
If using Legacy extrude 15 Mo
If using my component and the boolean bake (< 1 Mo) but take care :warning: if you let it at true at every change it will generate data in rhino


if (bake)
{
RhinoDocument.Objects.AddExtrusion(Extrusion.Create(curve, height, true));
}
A = Extrusion.Create(curve, height, true);


extrusion_GH.gh (11.3 KB)


(Anika Boeller) #7

fantastic! …thank you a lot!

somehow this randomizes the height to both sides though.
(from my base curves in rhino… could it be some thing in the script?

imho GH should really incorporate this at some point (@DavidRutten)… it makes models a 10 times smaller…


(David Rutten) #8

Extrusions (along with Sub-D surfaces) will be included in Grasshopper 2.0 as native geometry types.


(Anika Boeller) #9

Hi Laurent… still having this problem with “Flipped” curves…
even if i flip them manually in rhino / or using flip curve component in GH…
could it be something in the script?


(Laurent Delrieu) #10

I have noPC now. Could you post some examples curves ? And script if you changed things. There are also many other functions in rhinocommon.


(Anika Boeller) #11

haven’t change anything… but it seems to be irregular. does the script have to be different for windows?

i even culled all curves that extrude into the opposite (negative) direction… and flipped them, then used the script on them again. Result: some still extrude into the wrong directio…

samplecurve.3dm (87.4 KB)
samplecurve.3dm (87.4 KB)


(Laurent Delrieu) #12

It was easy to fix, just have to read documentation. Not a clean program but seems to work.

private void RunScript(Curve curve, double height, bool bake, ref object A)
{
Plane plane;
curve.TryGetPlane(out plane);
if (plane.Normal.Z < 0) height = -height;

if (bake)
{
  RhinoDocument.Objects.AddExtrusion(Extrusion.Create(curve, height, true));
}
A = Extrusion.Create(curve, height, true);

}
extrusion_GH.gh (17.0 KB)


(Anika Boeller) #13

whoopwhoop! thanks so much!
if only i could code…

so to recap… extrusions are better for file size, meshes are best for smooth viewport experience if one only works with a onboard gpu.