Wish: 2click solid split

split
solidworks
boolean

#1

Hello McNeel team,

I usually work on large projects with contains nearly 100% of solids (closed poly surfaces…) during my daily work, I spend huge amounts of time doing boolean operations.
Let’s assume I want to do a boolean split on a given solid, in order to divide it into two pieces, my typically workflow would be like this :

  1. Creating a temporal object to be used as the second operant, in this case a box from 3 points (3clicks)

  2. execute the boolean split command (1click)

  3. Select first operand and acknowledge (2clicks)

  4. Select splitting objects (1click)

  5. Delete temporal Object (1click)

Done…

So it takes me 8 clicks and additional time to draw the 3 point box…
I think the whole operation could be accomplished with 3 clicks:

  1. Execute new command “solid split by line” (1click)

  2. Select the solid to be split (1click)

  3. “Start of line” (1click)

  4. “End of line” (1click) [Aditional lines]

That would reduce the time for the procedure at least by 60%

If you do 100 of these you would save up a lot of time…

Best

Andreas

P.s. I know the wire cut command but that is not the same…


#2

Wirecut can be pretty much the same as your 1.2.3.4 process… if you macro it.

! _Select _Pause _Wirecut _Line
_Direction=_CPlaneNormal  
BothSides=Yes 
_KeepAll=_Yes
_Pause _Pause _Enter

There is some flakiness in the operation depending on if the object is preselected or not, which is why I used _Select at the beginning to stabilize it. This should be cleaned up… @rajaa

To make it a little smoother, a script could be made…

–Mitch


#3

Ok Mitch, I remember that I tried it out and it was somehow not working really properly…
I will give it another try on monday.

Andreas


For Rhino V6 wishlist
(Willem Derks) #4

Hi Andreas,

I’ve been using this button for ages and indeed I use it all the time
It’s been a while so I’m not sure what Simon this is (Mitch do you remember a Simon back at the old NG?)

macros:

;script by Simon

_NoEcho -_Runscript (
Sub SplitingLine
Dim arrObj, strObject
arrObj = Rhino.GetObjects("Select objects to split", 0, True, True)
If IsNull(arrObj) Then Exit Sub
Rhino.UnselectAllObjects
Rhino.Command "_Polyline", False
If Rhino.LastCommandResult > 0 Then Exit Sub
strObject = Rhino.firstobject
Rhino.EnableRedraw False
Rhino.UnselectAllObjects
Rhino.SelectObjects arrObj
Rhino.Command "_Split _SelID " & strObject & " _Enter", False
Rhino.DeleteObject strObject
Rhino.UnselectAllObjects
Rhino.EnableRedraw True
End Sub
SplitingLine
;script by Simon

_NoEcho -_Runscript (
Sub SplitingLine
Dim arrObj, strObject
arrObj = Rhino.GetObjects("Select objects to split", 0, True, True)
If IsNull(arrObj) Then Exit Sub
Rhino.UnselectAllObjects
Rhino.Command "_Line", False
If Rhino.LastCommandResult > 0 Then Exit Sub
strObject = Rhino.firstobject
Rhino.EnableRedraw False
Rhino.UnselectAllObjects
Rhino.SelectObjects arrObj
Rhino.Command "_Split _SelID " & strObject & " _Enter", False
Rhino.DeleteObject strObject
Rhino.UnselectAllObjects
Rhino.Command "_SelLast"
Rhino.Command "_Cap" 
Rhino.EnableRedraw True
End Sub
SplitingLine)

#5

Thanks Willen (and Simon…)
I will try it ASAP…

Andreas


#6

This prompted me to modify (actually completely re-write) an older script for splitting objects. The attached will attempt to split any selected collection of curves, surfaces, polysurfaces, extrusions and meshes by a line drawn in any viewport.

  • Splits perpendicular to the viewport CPlane in the view that is active when the line endpoint is chosen.
  • Splits along an infinite line/plane, the drawn line does not need to completely cut through all objects
  • Splitting meshes may not always be reliable, that is a general Rhino problem…
  • Reports number of splits on the command line

Let me know if this is useful or if you find any major bugs…

Edit: fixed a couple on my own…

SplitObjsWithLine.py (5.0 KB)

–Mitch


#7

I am downloading right now…

very curious… thank you very much guys for your support, you are really great!

Andreas


#8

Mitch, this is totally awesome !

I just tested it on a few objects so far but it seems to work like a breeze and is actually more than I asked for ( the fact that the line does not need to cross the entire operand is super cool)

IMHO this has to be incorporated into the standard Rhino tools ASAP…

It works like 80% faster than the old aproach … all my colleagues are enthusiastic too…

Can we get you something nice?

best

Andreas


(Rajaa Issa) #9

Would the following script work as expected without the initial select?

_Wirecut _Line _Pause
_Direction=_CPlaneNormal
BothSides=Yes
_KeepAll=_Yes
_Pause _Pause _Enter


#10

Hello Mitch, we worked now for 1 day with the new command, it works on many cases, but we get problems every 5 to 6 times we use it…

attached please find a scene in which we isolated a common problem:
splitSolid_bug.3dm (609.7 KB)

we try to split the wall at the corner, after executing the command the split works, but we end up with an additional surface. I don’t know if there is an easy fix to this, maybe the script could check if any surfaces have been created in the process and delete them automatically?

best

Andreas


#11

Hello Rajaa,

I just tried your wirecut version and in this configuration it worked better than I remembered, however it failed completely at the example I posted (splitSolid_bug.3dm).

Maybe you can take a look at the scene, I would really appreciate it , I have the feeling we are very close to a working solution…

For serengeti I really wish this to be a regular 100% solid working command -> saves me huge amounts of time and I guess all folks doing solid modeling would really profit from such a thing (although they might not know yet…)

best

Andreas


#12

Yeah, that will happen because the cut line is extended to the limits of the selected objects - so in your posted file it actually splits off the interior surface which is parallel to the cut line. The open surface is preserved because the script is designed to cut open objects as well as closed ones…

The only way to change that would be to either limit the cutting to the extents of the drawn line (not extend it) or limit the results to only closed/solid objects - open objects would not get split.

Edit - @walther

OK, give the following a shot… I added a few lines that check the input object to see if it is closed. If closed, it only allows closed (solid) output. If the original is open it allows (enforces) an open result - it will not try to cap anything.

This addresses a few inconsistencies in the original algorithm, notably closing of open objects. The script will now assume that if the original object is open, the result should be left open.

I haven’t tested this version thoroughly, I do not know if I have introduced any additional bugs in doing so…

SplitObjsWithLine2.py (5.5 KB)

–Mitch


#13

Thanks Mitch ! -> downloadingrightnow


#14

… This solved the last issue indeed -> thanks! sadly I came upon this two minutes later…solid bug2.3dm (632.1 KB)

any ideas?

Andreas


#15

In this case, the plane surface generated by the script is failing to split the polysurface object - not sure why, may be a tolerance issue…

Ahh, I see it - you have something funny in the last window… This surface has virtually zero thickness and shouldn’t be there - that seems to be upsetting Split. If I remove that, it works…

–Mitch


#16

Ok — I see it , cannot explain how this happened-> sorry my fault!

now it works :slight_smile:

best

Andreas


#17

_Wirecut _Line _Pause Direction=CPlaneNormal BothSides=Yes KeepAll=Yes _Pause _Pause _Enter

Unfortunately, your macro really isn’t working correctly, you can see from the command line report (pre- or post- select object), note the “unknown command” reports…

Command: _Wirecut Select cutting curve ( Line ): _Line Start of line: _Pause Start of line: End of line: Direction=CPlaneNormal Unknown command: Direction=CPlaneNormal End of line: BothSides=Yes Unknown command: BothSides=Yes End of line: KeepAll=Yes Unknown command: KeepAll=Yes End of line: _Pause End of line: Select objects to cut: _Pause Select objects to cut: Select objects to cut. Press Enter when done: Curve Normal is ambiguous. Direction is set CPlane Normal First cut depth point. Press Enter to cut through object ( Direction=CPlaneNormal DeleteInput=Yes BothSides=Yes KeepAll=Yes ): _Enter First cut depth point. Press Enter to cut through object ( Direction=CPlaneNormal DeleteInput=Yes BothSides=Yes KeepAll=Yes ): Creating meshes... Press Esc to cancel 1 polysurface added to selection.

The following works better with post-selected objects, but unfortunately not as well with pre-selected objects - still needs an enter after the line is drawn:

_Wirecut _Line _Pause _Pause _Pause Direction=CPlaneNormal BothSides=Yes KeepAll=Yes _Enter
I have yet to find a macro that works satisfactorily both ways. The other thing that is flaky is that if the command sequence fails or is aborted, sometimes it leaves the line behind…

–Mitch


(Rajaa Issa) #18

This is a bug. https://mcneel.myjetbrains.com/youtrack/issue/RH-37789


#19

Hello Mitch,

may I ask you for one more favour?

Often I have the situation like in the attached file that I accidentally split areas that should not be splitted… do you think it would be possible to create another version of the script which would only split where I draw the curve?

best

Andreas

solid split3.3dm (315.9 KB)


#20

Yeah, @walther in the end I guess the “infinite plane” approach is not all that useful… So here is a version that only splits where the line is drawn. I ended up having to exclude meshes from this one, because the results were too unreliable…

SplitObjsWithLine3.py (5.7 KB)

–Mitch