Compas_ifc in Rhino

Hi Li!

I’m trying to run a compas_ifc test within rhino8 (its your example from the IASS24 workshop)

is it not possible to install compas_viwer in rhino8, I see that you open the viewer window for visualisation

from compas_ifc.model import Model

# ==============================================================================
# Load IFC file
# ==============================================================================
model = Model("C:/Users/Uday/uday_dev/IASS2024-main/IASS2024-main/data/Duplex_A_20110907.ifc")


# ==============================================================================
# Print summary of the model
# ==============================================================================
model.print_summary()


# ==============================================================================
# Print spatial hierarchy of the model
# ==============================================================================
model.print_spatial_hierarchy(max_depth=3)


# ==============================================================================
# Visualize the model
# ==============================================================================
model.show()

error below

Rhino.Runtime.Code.Execution.ExecuteException: Environment "default" is corrupted due to a possible package installation failure
 ---> Rhino.Runtime.Code.Environments.CorruptEnvironException: Environment "default" is corrupted due to a possible package installation failure
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonEnviron.ThrowIfCorrupt()
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonCode.Execute(RunContext context)
   at Rhino.Runtime.Code.Code.Run(RunContext context)
   --- End of inner exception stack trace ---
Rhino.Runtime.Code.Environments.CorruptEnvironException: Environment "default" is corrupted due to a possible package installation failure
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonEnviron.ThrowIfCorrupt()
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonCode.Execute(RunContext context)
   at Rhino.Runtime.Code.Code.Run(RunContext context)

or the goal is to be able to see the ifc file within rhino, I couldn’t load the model to Scene either. what steps should I take to view the geometry in Rhino / can I open viewer from Rhino?

Thanks in advance!

Hi Keerthana, indeed the viewer is not going to work in Rhino. But a way around could be something like:

scene = Scene()
for element in model.building_elements:
    mesh = element.geometry.to_mesh()

scene.add(mesh)
scene.draw()

I didn’t test it, but should work :joy:

We can have official support to view an IFC in Rhino, but will need to be something like next month