Grasshopper

algorithmic modeling for Rhino

Hi,

How can I get a list of boundingbox'es from existing objects in a list of Guid in C#

( List <Guid> m = new List<Guid>(); //referenced geometry as meshes or breps) ?

I tried this in a for loop, but it is no success, is it possible to use following function for this situation?

BoundingBox bbox = new BoundingBox();
Grasshopper.Kernel.GH_Convert.ToBoundingBox_Primary(m[i], bbox);

I have attached grasshopper printscreen for boundingbox question.

Thank you,

Petras

Views: 1235

Attachments:

Replies to This Discussion

Like this? (Load Rhino file first and ... er ... take the challenge for the 5 sardine cans [of the finest quality]).

best, The SardineLord

Attachments:

Thank you for the script Peter Fotiadis.

The input is a breplist in your script, but is it possible to have a GUID list as an input list, that contains both breps and meshes as referenced geometry?

Attachments:

Of course you can: You just need the V2 (the trad update).

BTW: Since I haven't your Guids I've created some on-the-fly and then accessed the Guid List in order to demonstrate the method for the bbox. Thus the brepList ... er ... is (rather obviously) a Brep List AND NOT a Guid List. Attempting to feed Guid's to that ... well ...

BoundingBox geoBox = RhinoDoc.ActiveDoc.Objects.Find(brepGuidList[indexForBox]).Geometry.GetBoundingBox(true);

If this would be changed to grasshopper input Guid list, it would work for a list that contains brep and meshes? 

brepGuidList[indexForBox]

BTW: if you have other types in your collection(s) (and provided that there's the BoundingBox method available respectively) this is a classic way to deal with them ( or [i.e.||] clause is used for other than BBox purposes in this code, mind).

Here we are: breps, meshes, sardines ... whatever comes first.

best, the (very same) SardineLord

Attachments:

Thank you.

Really nice graphics and comments:)

And since progress(*) never stops ... get the update of the update (but that Box Method is a "bit" faulty with regard properly "engulfing" the object in question, David said recently that R6 does the same > so wait for R666).

(*) if you buy this, you can buy anything

BTW: what are your resources for learning C#?

Attachments:

I have no resources for learning C#. Just know a little bit of Java.

Could you recommend a book or internet references, that could help me learn C#? Probably there are no tutorials regarding RhinoCommon. While learning python for Rhino I found plenty of them, but no so much of C#.

The bible PlanA: C# In depth (Jon Skeet).
The bible PlanB: C# Step by step (John Sharp).
The bible PlanC: C# 5.0 (J/B Albahari) > my favorite

The reference: C# Language specs  ECMA-334

The candidates:

C# Fundamentals (Nakov/Kolev & Co)
C# Head First (Stellman/Greene)
C# Language (Jones)

C# Objects: From Concepts to Code (Barker/Palmer)

C# Programming (Cengage)

C# Geometric Algorithms (Princeton University)

Thank you very much for the help.

BTW: For learning C# (and any other language) you'll need books AND not that idiot part (the computer) or the other idiot part (the Internet) at least for a certain "acclimatization" period. This is the famous good/old/trad Karate Kid method ...where ... the trainee ... blah, blah.

That said I do hope that this site

http://freecomputerbooks.com/langCSharpBooks.html

is clean (and legal) : I mean ... when someone talks about "free" stuff ... he has entirely other thing(s) in mind other than acting as a good Samaritan.

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service