Grasshopper

algorithmic modeling for Rhino

Hi all,

Can you please explain to me what is the difference between Class and Structure in RhinoCommon SDK/rhino.Geometry Namespace. Or what is the difference between Box Structure and Brep Class?

I'm having a hard time to figure out how to use the Contains(Point3D) method which is a method in Box Structure. 

What I am trying to do here is, to eliminate the points outside of the capped box that I have created.

Is this even a proper approach or I need to do this differently?

Here is my code. I've also attached my files.

I would greatly appreciate any help/explanation!

private void RunScript(Curve zoneA, List<Point3d> analysisPoint3D, ref object A, ref object B)
{

Analysis myA = new Analysis(zoneA, analysisPoint3D);
//A = myA.Box;
A = myA.cappedBox;
B = myA.zonePoints;

}

//<Custom additional code>
public class Analysis
{
//*********ATTRIBUTES********//

//1.curve from rhino for zone A
private Curve myZone;
//2.Extrusion direction
private Surface myBox;
//3.cap extruded box
public Brep cappedBox;
//4.eliminate point outside the box
public List<Point3D> zonePoints;

//*********PROPERTIES********//

public Surface Box
{
get { return myBox;}
}

//*********METHODS********//

private void buildBox()
{
//creating a capped box
myBox = Surface.CreateExtrusion(myZone, new Vector3d(0.0, 0.0, 1.0));
Brep b = myBox.ToBrep();
cappedBox = b.CapPlanarHoles(0.001);

}

private void cullPattern()
{
//eliminating points outside cappedBox
zonePoints =


}
//*********CONSTRUCTOR********//
public Analysis(Curve A, Point3D Pts)
{
//populate private variables
myZone = A;
dataPoints = Pts;

//call private methods
this.buildBox();
this.cullPattern();

}

}
//</Custom additional code>

}

Views: 417

Attachments:

Replies to This Discussion

The difference between classes and structures is fundamental to understanding .NET programming (and any other languages that rely on them). I wrote a blog post about this very topic: http://ieatbugsforbreakfast.wordpress.com/2012/06/24/net-fundamenta...

If you have further questions, let me know.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David,

Thank you so much for sharing your blog post. It was extremely helpful and gave me a clear understanding of Structure vs. Class. I will  review the links you suggested as well and keep you posted if I have any question regarding my code.

Best,

Naciem

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service