Hello,
Is there an efficient way to identify elements concerned by runtime warnings on a component ? In my case, I have 1600 elements and some are truncated but I can’t identify which ones. The output doesn’t indicate anything, I have the same number of elements than the input list, and no one is a null value.
I must precise it’s for the DirectShape Mesh component of Rhino.Inside.Revit but the same logic can apply to native GrassHopper components, how to identify warning elements ?
Thanks
I think your problem could be solved with metahopper. Otherwise some code…
This is from my coworker:
import Grasshopper as gh
import Rhino
import System.Drawing
def group_problem_components():
if not gh.Instances.ActiveCanvas:
print("Grasshopper is not running.")
return
doc = gh.Instances.ActiveCanvas.Document
if not doc:
print("No Grasshopper document found.")
return
# Find all problematic GH_ActiveObject instances
problem_objects = [obj for obj in doc.Objects
if isinstance(obj, gh.Kernel.GH_ActiveObject) and
obj.RuntimeMessageLevel != gh.Kernel.GH_RuntimeMessageLevel.Blank]
if not problem_objects:
print("No bad components found.")
return
# Create a red group for each one
for obj in problem_objects:
group = gh.Kernel.Special.GH_Group()
group.NickName = "Bad"
group.Colour = System.Drawing.Color.FromArgb(255, 220, 80, 80) # Distinct red
group.AddObject(obj.InstanceGuid)
doc.AddObject(group, False)
gh.Instances.ActiveCanvas.Refresh()
group_problem_components()
I’d run the script from Rhino and then using Find / F3 in Grasshopper go to one problem after another.
1 Like