algorithmic modeling for Rhino
Hi everybody,
I am having trouble with null objects in a script which are starting to drive me ...
I am trying to iterate intersections plane-curve but when it goes null I get the error "Object not set as an instance of an object", the script component turns red and I can´t skip it
The intersection function goes like this:
public Point3d Interseccion (Point3d origenInt, Curve curvaInt, Vector3d vectorXInt, Vector3d vectorYInt)
{
Point3d intersection = new Point3d();
Plane planoIntersec = new Plane(origenInt, vectorXInt, vectorYInt);
Rhino.Geometry.Intersect.CurveIntersections ci = Rhino.Geometry.Intersect.Intersection.CurvePlane(curvaInt, planoIntersec, 0.0);
if(ci[0] != null) //THIS IS THE PART THAT FAILS :-s
{
Point3d pTemp = new Point3d(ci[0].PointA.X, ci[0].PointA.Y, ci[0].PointA.Z);
intersection = pTemp;
}
return intersection;
}
Any clues of how to deal with this?
Cheers
Tags:
Point3d p = anotherP;
p and anotherP are two different entities, one the copy of the other.if (ci == null) { return; }
Point3d p = new Point3d(double.NaN, 0, 0);
bool valid = p.IsValid;
A = valid; //A is false
Point3d.Unset - Point3d.Unset
gives Point3d(0,0,0). Unset is actually just a very large negative number, about -10^308.Point3d(NaN, NaN, NaN) - Point3d(NaN, NaN, NaN)
returns faithfully Point3d(NaN, NaN, NaN).Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by