Macro to change a lofted coplanar surface into a trimmed plane?

Dear all!

I have a lot of faces that I want to kind of ‘harmonise’ for future edits on each. Is there a script to run and create an outline to then click a surface → generate an outline → make a plane and then get rid of the original?

Question: is it important at all?

Thank you!

Hannes

I assume you want to change a planar surface with a zero length edge into a trimmed planar surface without a zero length edge. One way to do so is to DupBorder of the surface, Delete the original surface, and PlanarSrf with the duplicated border as input. Result will be a trimmed rectangular surface This will work on a separate surface but not on a face of a polysurface. For a face of a polysurface first ExtractSrf the face to be reworked, redo the suface, and then Join the new surface to the remainder of the polysurface.

1 Like

this is what I do. So for macros it’s just writing the commands in one line, right?

Someone else will need to help with the best way to create a macro.

1 Like

So maybe there would be 2 efficient macros that serve tremendously in the process…

  1. the turn loft surface into planar surfaces as described

  2. create a planar surface via clicking to edges (like loft) - which is indispensable as I could extend these surfaces in the boolean and splitting operations for subtracting the foam panels from the overall wooden frame.

@pascal is there a way to make this happen? Can I do it, is there a ressource to learn efficient macro making not to bother you all the time? :slight_smile:

Thank you!

Hannes

Here is an old script of mine that I just revised a bit - it will try to replace any planar surfaces or planar faces within a polysurface or extrusion with simple trimmed faces. Reports what it did on the command line. I probably can make it a bit more sophisticated than it is currently… FWIW.

SimplifyPlanarFaces.py (2.3 KB)

1 Like

phewww! Thank you. Right time right place!!!

Mitch, two issues with the script first is it often would transform perfectly but would create extended surface
http://recordit.co/AVWuHrb7kz

  1. sometimes it says brep object and won’t run. What does it mean. is this like some bad objects?

Thank you! @Helvetosaur

Hi, a BREP is a boundary representation : it’s a set of surfaces which form a closed volume and are interpreted by Rhino as kind of like a solid object. Maybe explode these first?

1 Like

@Dancergraham this way works!!! thank you :slight_smile:

Hmm, OK, if you can post or PM me the object in question, I can check why it is not working correctly and perhaps improve the script.

Brep is as Graham pointed out a “geek” term for a Rhino surface or polysurface. I used it simply because it’s shorter than printing out “surface or polysurface”…

The script is somewhat experimental, and maybe not all that reliable. What it tries to do is get all the individual faces of a surface or polysurface (brep), check to see which ones are planar, if it finds any that are, it gets all the edges and tries to create a new trimmed planar face using those edges. If that succeeds, the new face replaces the old one; if it doesn’t manage, the old one is kept. If a face is non planar, that is kept also. At the end, it tries to join everything back together into one object. If something goes wrong and it can’t do that, it simply discards all that, leaves the original and counts one object that “couldn’t be processed”. At the end the reporting tells you how many objects couldn’t be processed - that just means that they weren’t changed in any way.

So when you get the message that 1 or more Brep objects couldn’t be processed it’s simply because I put a fail-safe error trap in there, but we don’t have any real info as to why - in order to have that I have to step through the script with the object in question so see why/where it fails.

–Mitch

Thank you Mitch for putting out this background. Constantly learning :slight_smile:
Your script is a dramatic enhancer to my process anyhow. Just will trim manually due all connected faces with one click after exploding the polysurface and joining right after. @Helvetosaur

@Helvetosaur could you pls comment why this is happening? Thought a popup if encountered problems would be nice to be integrated in this popup instead in command line.

That’s a message because of some unhandled error in the script, so it bailed. In this case looks like when it goes to replacing the original with the new one, something went wrong. In any case, as I mentioned before, if you can post or PM me a file with an object which creates this or any other kind of error, I can probably fix it. Otherwise, it is difficult to know where in the script the problem actually starts and under what conditions.

BTW, I did all my testing in Rhino V6, I haven’t tested anything in Rhino 5, that may also be the source of some problems.

1 Like

@Helvetosaur could you pls upload your script without the fail popup. Found out, that by firing the script multiple times (3-4 times) the script would eventually work on all surfaces not at the first time always. so the popup is annoying and interfering with my multiple-left-click strategy :slight_smile:

Thank you!

I’d be happy to if you can supply me with a file that makes it happen - then I know where in the script I need to fix it and why… :stuck_out_tongue_closed_eyes: Just export one part that repeatably makes it happen (before running so I can test), if you don’t want to post it here, you can PM it to me via the forum messaging function.

It’s only one piece, hit the command 4 times and the dialogue pops up. It’s not about the script it’s just that I would like a script without any error dialog. Thank you Mitch!

export SPF script.3dm (66.2 KB)