Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5854

How to MergeAllFaces using rhonscript Python objects?

$
0
0

@Darin_Williams wrote:

How can one do the equivalent of -_MergeAllFaces, working with rhinoscript objects in Python?

I've managed to MergeAllFaces in Python by cheating:
rs.Command("-_SelAll")
rs.Command("-_MergeAllFaces")

But would prefer to apply MergeFaces directly to the rhinoscript Python closed surface list object, named "basemodel", getting back an updated object to use in subsequent operations. Thus far, I'm stuck. Hints please?

   breps = [rs.coercebrep(id, True) for id in basemodel]

Seems to work OK, but then
Mbreps = Rhino.Geometry.Brep.MergeCoplanarFaces(breps,tol)
Fails (returns None) for any tolerance I've tried (up to 10x rhinoscript.document.UnitAbsoluteTolerance())

Even if it worked, I'm not clear on how to get back to rhinoscript objects after merging the breps.
Any suggestions where to look for hints on working at the Rhino.Geometry level?

Hints, please?

BACKGROUND:

I'm creating a model for 3D printing with text cut into the top surface of a complex "cubical" object.
The object is 6-way symmetric, so the Python script explicitly creates one section, then "rotates with copy" to make the rest (first 180 deg about 1 axis, then rotating the combined result by 120 and 240 deg about a different axis). The surfaces meet in common planes.

The cut-in text is created by a boolean difference, which does not work right unless MergeAllFaces is first applied to the "cubical" model. BooleanUnion fails, but does not seem to be necessary.

The "cheat" above allows teh script to produce a suitable .stl file for printing.

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5854

Latest Images

Trending Articles



Latest Images