I wrote a script wishing to get points from a point cloud in a desired area, to do this i used the MultiPlaneFilter to box in my desired area. I am not getting points at all and when changing the direction of the normal for planes i am getting points which are not in the desired area.
This script I wrote, I also attached the file. (Warning its not pretty as its just a proof of concept at the moment):
#Importing Python Libraries
#Importing Revit related libraries
import Autodesk
from Autodesk.Revit.DB import Architecture,Transaction
from rpw import ui
#Functions
#Constants
doc = __revit__.ActiveUIDocument.Document
view = doc.ActiveView
t = Transaction(doc, "The transaction")
options = Autodesk.Revit.DB.Options()
#Variables
planes = []
#Main Script
t2 = ui.Pick.pick_element(multiple=False)
intersect = t2.get_element()
origin = intersect.Location.Point
print(origin)
t1 = ui.Pick.pick_element(multiple=False)
pointCloud = t1.get_element()
boundingBox = pointCloud.get_BoundingBox(view)
mini = boundingBox.Min
maxi = boundingBox.Max
corner1 = Autodesk.Revit.DB.XYZ(origin.X + 0.01, origin.Y, origin.Z )
corner2 = Autodesk.Revit.DB.XYZ(origin.X - 0.01, origin.Y, origin.Z )
corner3 = Autodesk.Revit.DB.XYZ(origin.X, origin.Y - 0.01, origin.Z )
corner4 = Autodesk.Revit.DB.XYZ(origin.X, origin.Y + 0.01, origin.Z )
corner5 = Autodesk.Revit.DB.XYZ(origin.X, origin.Y, mini.Z)
corner6 = Autodesk.Revit.DB.XYZ(origin.X, origin.Y, maxi.Z)
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(-1,0,0)), corner1))
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(1,0,0)), corner2))
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(0,-1,0)), corner3))
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(0,1,0)), corner4))
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(0,0,1)), corner5))
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(0,0,-1)), corner6))
pointCloudFilter = Autodesk.Revit.DB.PointClouds.PointCloudFilterFactory.CreateMultiPlaneFilter(planes)
for item in pointCloud.GetPoints(pointCloudFilter, 0.01, 1000):
place = Autodesk.Revit.DB.XYZ(item.X,item.Y,item.Z)
print(place)
I wrote a script wishing to get points from a point cloud in a desired area, to do this i used the MultiPlaneFilter to box in my desired area. I am not getting points at all and when changing the direction of the normal for planes i am getting points which are not in the desired area.
This script I wrote, I also attached the file. (Warning its not pretty as its just a proof of concept at the moment):
#Importing Python Libraries
#Importing Revit related libraries
import Autodesk
from Autodesk.Revit.DB import Architecture,Transaction
from rpw import ui
#Functions
#Constants
doc = __revit__.ActiveUIDocument.Document
view = doc.ActiveView
t = Transaction(doc, "The transaction")
options = Autodesk.Revit.DB.Options()
#Variables
planes = []
#Main Script
t2 = ui.Pick.pick_element(multiple=False)
intersect = t2.get_element()
origin = intersect.Location.Point
print(origin)
t1 = ui.Pick.pick_element(multiple=False)
pointCloud = t1.get_element()
boundingBox = pointCloud.get_BoundingBox(view)
mini = boundingBox.Min
maxi = boundingBox.Max
corner1 = Autodesk.Revit.DB.XYZ(origin.X + 0.01, origin.Y, origin.Z )
corner2 = Autodesk.Revit.DB.XYZ(origin.X - 0.01, origin.Y, origin.Z )
corner3 = Autodesk.Revit.DB.XYZ(origin.X, origin.Y - 0.01, origin.Z )
corner4 = Autodesk.Revit.DB.XYZ(origin.X, origin.Y + 0.01, origin.Z )
corner5 = Autodesk.Revit.DB.XYZ(origin.X, origin.Y, mini.Z)
corner6 = Autodesk.Revit.DB.XYZ(origin.X, origin.Y, maxi.Z)
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(-1,0,0)), corner1))
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(1,0,0)), corner2))
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(0,-1,0)), corner3))
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(0,1,0)), corner4))
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(0,0,1)), corner5))
planes.append(Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin((Autodesk.Revit.DB.XYZ(0,0,-1)), corner6))
pointCloudFilter = Autodesk.Revit.DB.PointClouds.PointCloudFilterFactory.CreateMultiPlaneFilter(planes)
for item in pointCloud.GetPoints(pointCloudFilter, 0.01, 1000):
place = Autodesk.Revit.DB.XYZ(item.X,item.Y,item.Z)
print(place)
Can't find what you're looking for? Ask the community or share your knowledge.