Grasshopper

algorithmic modeling for Rhino

Hi All, 

I found this script on the discourse forum but not been able to edit it to return the points inside the brep, don't know if its because i am trying to access the return the points from the wrong part of the code.

Any thought much appreciated.

 

def Threaded_PointTest(Brep,Cloud):

## Make Sure Test Polysurface is Closed##

if rs.IsPolysurfaceClosed(Brep)!=True: print "Test brep is Not Closed" return

## Get a Private Copy for Multi-Threading ##

brep=rs.coercebrep(Brep)

brep.EnsurePrivateCopy()

## Turn Object into a PointCloud ##

Cloud=rs.coercegeometry(Cloud)

## Holder for Points inside Surface ##

Result=[]

tol=scriptcontext.doc.ModelAbsoluteTolerance

def TestPoints(Pt):

try:

point=rs.coerce3dpoint(Pt.Location)

if brep.IsPointInside(point,tol,True)==True:

Result.append(point)

except:

pass

CloudPts=Cloud.GetEnumerator()

ghpythonlib.parallel.run(TestPoints,CloudPts)

Plane=rs.PlaneFitFromPoints(Result)

Plane=rs.coerceplane(Plane) r,Curves,points=Rhino.Geometry.Intersect.Intersection.BrepPlane(brep,Plane,tol) if r==True:

PlanarSrf=rs.AddPlanarSrf(Curves)

Original Post.

https://discourse.mcneel.com/t/pointcloud-analysis/14788/5

Views: 520

Replies to This Discussion

Hi Matt,

there was an answer there, was it helpful?

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service