Decouple Geometry Preview from Category: Generic Model

Hi community,

Is there a chance to decouple geometry preview from generic model category? If I hide the category through visibility/graphic, geometry preview goes away as well.

Simply draw a wall and a door. Hiding Wall/Door category does not have any impact on geometry preview whereas unticking Generic Model category also hides geometry preview. What I’m tryin to do is keeping geometry preview alive but hiding all generic models.

bump

bump again.

@jshial I have no solution but a suggestion.
Post an issue at https://github.com/DynamoDS/DynamoRevit/issues

1 Like

maybe a solution is to recalculate the geometry of the elements present in the view with each change.


The node “All Element in View” is used here to detect a change in automatic mode.
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *


clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = uiapp.ActiveUIDocument

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

elems = UnwrapElement(IN[0])
fecInviewId = FilteredElementCollector(doc, doc.ActiveView.Id).ToElementIds()
opt = Options()
opt.View = doc.ActiveView
outGeoDs = []
for elem in elems:
	if elem.Id in fecInviewId:
		geometryRefs = elem.get_Geometry(opt)
		for geo in geometryRefs:
			if isinstance(geo, Solid):
				outGeoDs.append(geo.ToProtoType())
			elif isinstance(geo, GeometryInstance):
				geoinstances = geo.GetInstanceGeometry()		
				for geoinst in geoinstances:
					if isinstance(geoinst, Solid):
						outGeoDs.append(geoinst.ToProtoType())	
			else:
				pass			
		

OUT = outGeoDs
2 Likes

@c.poupin Thx~

yet my situation is like geometry preview and Generic Model category are still coupled. A not perfect workaround I’ve been using recently is hiding generic models by Filter. The filter must contain rules otherwise it will just hide all generic model (equivalent to uncheck Generic Model category in V/G), then geometry preview will be gone also.

@Vikram_Subbaiah Thx~

Issue posted.

1 Like