Python union brep

It might be the easiest question of them all of which I previously questioned. But how to output the guide as a brep?

What am I doing wrong?
Thanks for your response. :slight_smile:

20190120 problem unionbrep (8.2 KB)

it requires a list of geometry as first argument

union = rs.BooleanUnion([brepA,brepB])

the second argument is a optional boolean which asks if the input shall be deleted.

Hint: after writing ‘(’, there should be an entry on what a rs method needs as input and what it returns.
The error says brepA doesn’t have len(), may give you a hint that it expect a list, although a defensive implementation of that method would have told you so.


Okay, thank you. I tried that before, but I am still doing something wrong.

20190120 problem unionbrep (8.8 KB)

oh, thats another odd thing. If you are using rhinoscriptsyntax just leave the input parameter of brepA and brepB as ghDoc object. If you set Brep it means you need to use Rhinocommon, not rs methods.

Guid is the global identification number of your ghobject. Rs deals with ghobjects (or when changing the context with rhinoobjects) only.

1 Like

Do you might know how I can get the corners?

20190120 problem get corners brep (9.5 KB)

Hi ForestOwl

Is this what you want?

1 Like

Thank you for your response, I have managed to do so,

what I am now after is to get the points of the ‘unioned brep.’
Because the brep is written as a List/Guid I am not able retrieve the points of it that make the ‘unioned brep.’

Do you might know how to retrieve the points of the unioned brep?’

Is this what you want?Convert guid to brep, you need to use rs.coercebrep(brep) function.

20190120 problem get corners brep (7.9 KB)

1 Like

Thank you :slight_smile: Do you might why those points appear while the brep is one closed polysurface?

You need to merge coplanar faces. like this

1 Like

Thank you. Do you might know what I am doing wrong below? I am trying to script points like [0,1,1] for in python.

20190120 problem unionbrep (6.9 KB)

like this?I hope this help you,I’m going to sleep.

import rhinoscriptsyntax as rs
import Rhino as rc
import scriptcontext as sc
#if not rs.BooleanIntersection(brepA, brepB):
#    uubrps = [brepA, brepB]
#    brep = rs.BooleanUnion(uubrps)
#uubrps = [brepA, brepB]
#brep = rs.BooleanUnion(uubrps)
#geo_brep = rs.coercebrep(brep)
#a = geo_brep.Vertices

uubrps = [brepA, brepB]
brep = rs.BooleanUnion(uubrps, True)
print brep
geo_brep = rs.coercebrep(brep)
print geo_brep

bool = rc.Geometry.Brep.MergeCoplanarFaces(geo_brep,0.001,0.1)
list = []
    pts = geo_brep.Vertices
    for i in pts:
    print list
    a = list
1 Like

Thank you Naruto! :smiley:

Whatch out - you have overwritten the built in list() method :open_mouth: