Help split polysurface at their corner

My work often has to split polysurface at their corner . I need a solution for this work automatically, please help me.

Simplified, I took the closed curve in the top object. problem is how to draw line with corners of object. Please help

Dear @ins_me welcome to the forum.
are you searching for a script to do this ?
do you have any scripting experience ?
do you have a collection of possible special cases ?

maybe post a .3dm file (just drag and drop to the edit - window)

if you need a workflow to do it quite fast:
one version i am thinking of:

(left to right)

subselect (cmd shift (mac) or ctrl shift (pc) + click / or rectangular selection) the first and last connection.
delete them
_loft the remaining polylines (option split at tangents = yes)
_explode

maybe you need
_dupBoarder to get the curves

are the initial polylines always parallel with same distance and same amount of points / semgents?
maybe also check the commands
_offset
_curveBoolean

you can combine the above commands into a macro (which is simpler then coding)
https://wiki.mcneel.com/rhino/basicmacros

if you want to learn scripting - the point to start

kind regards - tom

2 Likes

I’m looking for a script to do this. Split polysurface at the corners of the subject for machining.
SUBJECT.3dm (262.7 KB)

ok it s a 3d-problem.

  • sorry - i do not have a script that does this / nor something that is fast to modify to suit your needs.
1 Like

@ins_me

You can try the following script - it might work if all the pieces you do are similar to the image/file you posted above.

For it to work successfully, the following conditions must be met:

  • The bottom surface must be planar and parallel to the world XY plane
  • All sides of the bottom surface must be linear
  • The extrusion direction should be vertical
  • The ends (shown in red below) must be the smallest segments, that is how the script determines how to process the object
  • The “inside” and “outside” (after the ends are removed) must have the same number of linear segments.

Maybe it will work for some of your objects… :thinking:
CornerSplitterSpecial.py (4.1 KB)
It has a lot of “abort” points, so if you see “Unable to process this object” at the command line, one of the conditions for the script to work has not been met.

Thank @Helvetosaur .I have a question, if there is more outer loop. I see in you script with such a method

   else:
        #need to find outer loop
        loops=Rhino.Geometry.Curve.JoinCurves(loops,tol)
        outer=FindOuterLoop(loops,plane,tol)
    return outer

SUBJECT.3dm (440.4 KB)

The script is simply not set up for that. In any case the object should never have more than one outer loop, that represents the outer border of the object.

It is not currently designed to detect anything but the lowest surface in an object and if that surface is parallel to the XY plane. This is one of my stock functions for finding the outlines of object “bottoms” that are supposed to be flat - in this case your example #2 isn’t.

The footprint detector could probably be re-written to use the outer object boundary, however, doing so might introduce other problems.

Edit:

You can try the following and see if it works on more of your objects. I can’t say if it will cause other problems, I haven’t tested all possible scenarios…

CornerSplitterSpecial2.py (4.1 KB)

Thank @Helvetosaur . The last question, Please help.
If the object forms a closed loop, for example a rectangle, is the script applicable? In this last case, what would the method look like?
SUBJECT.3dm (333.2 KB)

Well, the current algorithm is based on finding two short “ends” of a single closed loop outline and removing them, then trying to match the corners of the two resulting open polylines to create the cutting planes.

I imagine that it could be modified so that if it finds two closed loops, one inside the other, and that the corners can be matched, that this type of figure could be accommodated. I will look into it, I haven’t much time today though.

1 Like

I am very much looking forward to it. Thank you so much for your help!

So this turned out to be quite a bit more difficult than i thought. Try the following out and see if it works for you.

CornerSplitterSpecial4.py (6.9 KB)

1 Like

Thank you so much!

SUBJECT.3dm (445.3 KB)
Hi @Helvetosaur. Objects with curved surfaces cannot be executed by the script. Can you help me take a look?

Yes, that’s to be expected. The script is designed to work only with outlines that can be resolved into polylines - i.e. all straight sides. Anything curved will be rejected. There might be a possibility to accept some structures that have curved sides, but it would require a fairly good sized re-write of the outline detection algorithm. I can look into it when I have some time.

Remember, there is no AI at work here trying to figure out what type of piece this is and adapt to that, simply a brute force approach based on finding certain specific criteria and is thus quite limited in its scope of application.

Yes I know that, I hope to get help from you.

Here is another version to try. The outline extraction method was re-written to use curves and not polylines, so it will handle some classes of objects with curved outlines. There is also now a command line option to split at G0 (only sharp kinks), G1 (Tangent joints or sharp kinks) or G2 (all sub curve joints including curvature continuous) found.

There will still be many cases where it will fail of course.

CornerSplitterSpecial5.py (9.4 KB)

Oh, and I forgot, here is a ‘manual’ surface/polysurface splitter where you draw lines to indicate where you want it to split. This can help where the other semi-automatic methods fail.
SplitBrepsWLines.py (5.9 KB)

1 Like

Thanks for your help. It helps me a lot