pyRevit extension to toggle point cloud visibility

pyRevit extension to toggle point cloud visibility

Anonymous
適用対象外
1,519件の閲覧回数
5件の返信
メッセージ1/6

pyRevit extension to toggle point cloud visibility

Anonymous
適用対象外

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()

 

 

0 件のいいね
解決済み
1,520件の閲覧回数
5件の返信
返信 (5)
メッセージ2/6

franciscopossetto
Advocate
Advocate
解決済み

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
メッセージ3/6

jeremy_tammik
Alumni
Alumni

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
メッセージ4/6

franciscopossetto
Advocate
Advocate

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

Github:
https://github.com/franpossetto
メッセージ5/6

Anonymous
適用対象外

Vey helpful, thankyou @franciscopossetto 

メッセージ6/6

juraj.kiaba
Observer
Observer

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()