Grasshopper

algorithmic modeling for Rhino

Hi,

I had regionSlit component error: "regions must be planar".

Usual one, and I did not know how to solve, all my regions were planar because in gh was able to create planar surfaces. I was also working just in polylines.

I tried simplifying curves, project to plane, that was created by points, still result in some failed regions , but for majority it worked. Then instead of this I tried this :

I tested not nice approach of de-compiling the component and changing this code -projecting the curve inside component that solved this issue. I only changed slab function in the class slab this function. I do not know if it helps for other as maybe other errors may occur, but in my case it worked well for all the elements.

public Slab(int index, Curve shape)

{

//Here curve is projected by division points

Point3d[] divisionPoints;
shape.DivideByCount(10, false, out divisionPoints);

Plane planeTemp;
Plane.FitPlaneToPoints(divisionPoints.ToList(), out planeTemp);

shape = Curve.ProjectToPlane(shape, planeTemp);

this.Cutters = new List<Line>();
this.Index = index;
this.Region = shape;
this.Bounds = shape.GetBoundingBox(true);
this.Plane = planeTemp;

//Exception that was causing error

//if (!shape.TryGetPlane(ref this.Plane))
//throw new ArgumentException("shape must be a planar region");

if (!this.Plane.IsValid)
throw new ArgumentException("shape must be a planar region");
}

Views: 286

Replies to This Discussion

I commented that this line, since I divide the curve and project it to average plane. But normally in rhinocommon for operations like divisions, trygetsomething - out is used. Ref was probably coming from vb decompiler

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service