Point cloud Point display

Any idea how can I create the Buttom for the below image.

from pyrevit import script
#Import pyRevit form library
import clr
clr.AddReference('RevitAPI') 
clr.AddReference('RevitAPIUI') 
from Autodesk.Revit.DB import * 
from Autodesk.Revit.DB import Category
from Autodesk.Revit.UI import * 
app = __revit__.Application
uidoc = __revit__.ActiveUIDocument
doc = uidoc.Document
logger = script.get_logger()
logger.set_quiet_mode()
collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_PointClouds).ToElements()
cat = None
for i in collector:
    cat = i.Category

// how can I change the colour mode?

i tried this but not working

PointCloudOverrideSettings Class (revitapidocs.com)

Gui Talarico has you covered :slight_smile:

this is what you are after

pt_cloud_settings = DB.PointClouds.PointCloudOverrideSettings()
pt_cloud_settings.ColorMode = DB.PointCloudColorMode.Normals

Color modes enumeration

When you look for code samples, besides looking into pyrevit code + others extensions I suggest you look through this website instead ApiDocs.co and once you located a method for example, click on the top right symbol

Getting error. I tried multiple ways. :roll_eyes:

yeah, the way the transaction is handled…

try this _ pyrevit modules style _

from pyrevit import revit, DB

uidoc = revit.uidoc
doc = revit.doc
view = uidoc.ActiveView
pt_overrides = view.GetPointCloudOverrides()

pts = DB.FilteredElementCollector(doc).OfClass(DB.PointCloudInstance).WhereElementIsNotElementType().ToElements()
pt_cloud_settings = DB.PointClouds.PointCloudOverrideSettings()
pt_cloud_settings.ColorMode = DB.PointCloudColorMode.Normals

with revit.Transaction('Point Cloud Color Mode change'):
    for pt in pts:
        pt_overrides.SetPointCloudOverrideSettings(pt.Id, pt_cloud_settings)



ERROR [pyrevit.revit.db.transaction] Error in Transaction Context. Rolling back changes. | <type 'exceptions.AttributeError'>:'PointCloudOverrides' object has no attribute 'SetPointCloudOverrideSettings'

IronPython Traceback:
Traceback (most recent call last):
 File "C:\Program Files\pyRevit-Master\extensions\pc.extension\Multivista.tab\Points Display.panel\Normals.pushbutton\Normals_script.py", line 15, in <module>
AttributeError: 'PointCloudOverrides' object has no attribute 'SetPointCloudOverrideSettings'


Script Executor Traceback:
System.MissingMemberException: 'PointCloudOverrides' object has no attribute 'SetPointCloudOverrideSettings'
 at Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)
 at Microsoft.Scripting.Interpreter.Interpreter.HandleException(InterpretedFrame frame, Exception exception)
 at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
 at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
 at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
 at PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime)

not tried, rough guess
SetPointCloudOverrideSettings → SetPointCloudScanOverrideSettings

from pyrevit import revit, DB

uidoc = revit.uidoc
doc = revit.doc
view = uidoc.ActiveView
pt_overrides = view.GetPointCloudOverrides()

pts = DB.FilteredElementCollector(doc).OfClass(DB.PointCloudInstance).WhereElementIsNotElementType().ToElements()
pt_cloud_settings = DB.PointClouds.PointCloudOverrideSettings()
pt_cloud_settings.ColorMode = DB.PointCloudColorMode.Normals

with revit.Transaction('Point Cloud Color Mode change'):
    for pt in pts:
        pt_overrides.SetPointCloudScanOverrideSettings(pt.Id, pt_cloud_settings)
1 Like

Works perfectly…

all the below works good and well.


|NoOverride|Show the actual colors|

|FixedColor|Show a single color|
|Elevation|Color by elevation|
|Intensity|Color by intensity (reflectivity)|
|Normals|Color by normal vectors|