Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

pyRevit extension to toggle point cloud visibility

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
962 Views, 5 Replies

pyRevit extension to toggle point cloud visibility

I'm trying to write a basic extension to toggle point cloud visibility in the active vew as shown below. But I receive this eror... 

TypeError: bool is not callable

 

import clr

clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')

from Autodesk.Revit import DB

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document

view = doc.ActiveView
t = DB.Transaction(doc)
t.Start('Set Pt Cloud Color Mode')
view.ArePointCloudsHidden(False, True)
t.Commit()

 

 

5 REPLIES 5
Message 2 of 6
franciscopossetto
in reply to: Anonymous

Hey,

 

It seems like you are trying to use the property ArePointCloudsHidden as a method. If you want to switch the visibility of the point cloud, you could use the method HideCategoryTemporary. 

https://www.revitapidocs.com/2022/26684015-0635-cb13-d5a9-f6a6f9b0780a.htm

 

I have developed this tool before, it is on C# but you can see the code.

https://github.com/franpossetto/Nina/blob/master/Nina/Lib/PointCloud.cs

 

or download it.

https://github.com/franpossetto/Nina/releases

 

I hope it helps,

Kind regards.

Github:
https://github.com/franpossetto
Message 3 of 6

Thank you for the precise answer and the pointer to your nice and useful collection of tools!

 

P.S. Best regards to Nina as well.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 4 of 6

Thank you @jeremy_tammik! I appreciate it.
I'll send Nina your regards!

Github:
https://github.com/franpossetto
Message 5 of 6
Anonymous
in reply to: franciscopossetto

Vey helpful, thankyou @franciscopossetto 

Message 6 of 6
juraj.kiaba
in reply to: Anonymous

My solution for hiding and showing point clouds in active view (in pyRevit script file):

 

from Autodesk.Revit.DB import *

doc = __revit__.ActiveUIDocument.Document
collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_PointClouds).WhereElementIsNotElementType()
elements = collector.ToElements()
pointclouds = collector.ToElementIds()

visible = False
for element in elements:
   if not element.IsHidden(doc.ActiveView):
      visible = True
      break

if visible:
   t = Transaction(doc,"Hide pointclouds")
   t.Start()
   doc.ActiveView.HideElements(pointclouds)
   t.Commit()
else:
   t = Transaction(doc,"Unhide pointclouds")
   t.Start()
   doc.ActiveView.UnhideElements(pointclouds)
   t.Commit()

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report