algorithmic modeling for Rhino
as we know,Point3d has properties,x,y,z.
but i want to inherit Point3d class to add another property,(such as a boolean value,to verify the visibility or a double value that show the distance between original point(0,0,0))
anyone can show me how to code it ?
vb or csharp all is welcome,but perfer csharp^_^
thank you very much!
Tags:
Hi Andrea,
Point3d is not a class, it is a struct. You cannot inherit from a struct. What you can do is create another class or struct that has a Point3d as a member:
public class MyPoint
{
private Point3d m_point;
private double m_distance;
private bool m_visible;
public Point3d Location
{
get { return m_point; }
set { m_point = value; }
}
//Etcetera, etcetera
}
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Structs can have methods just like classes.
The RhinoCommon help file can be used to determine whether something is a struct or a class (or an interface or any other type of OOP element).
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by