Convert GUID into BREPS in ghpython with Grasshopper.Kernel.GH_Convert

Hi!

I am trying to convert some surfaces in the “Walls”-list in my project. I´d like to use ghpythonlib.components (e.g., DeconstructBrep) on the geometry I got with rhinoscriptsyntax.

I try to convert GUIDs into Breps with Grasshopper.Kernel.GH_Convert.ToBrep and get always invalid Breps as result.

Thanks a lot if someone can help me with that one.

Below is the ghpython-code and the .gh file:


Conversion_GUIDtoBREP.gh (70.2 KB)

import rhinoscriptsyntax as rs
from ghpythonlib import components as ghcomp
from Grasshopper import Kernel as K
import Rhino
import Grasshopper

Line_like_Elements = []
Surface_Elements = []

for Element in Element_list:
    if rs.IsCurve(Element):
        Line_like_Elements.append(Element)
    elif rs.IsBrep(Element):
        Surface_Elements.append(Element)

Slabs = []
Walls = []

for Surface_Element in Surface_Elements:
    Vertices = []
    Vertices = rs.SurfacePoints(Surface_Element)
    Zcoor = []
    for i in Vertices:
        Zcoor.append(round(i.Z,2))
    if Zcoor[0] == Zcoor[1] == Zcoor[2] == Zcoor[3]:
        Slabs.append(Surface_Element)
    else:
        Walls.append(Surface_Element)

Converted_Walls = []
for Wall in Walls:
    Converted_Wall = K.GH_Convert.ToBrep(Wall,Rhino.Geometry.Brep(),K.GH_Conversion(2))
    Converted_Walls.append(Converted_Wall[1]) # Gives invalid Breps :(

for Converted_Wall in Converted_Walls:
    Deconstructed = ghcomp.DeconstructBrep(Converted_Wall)
    Deconstructed_Vertices = Deconstructed[2] # Gives *None* as output