Delete everything outside boundary curve?

Hello, I was wondering is there is a way of deleting all objects outside a boundary curve, meaning that all objects inside the curve will remain and be splitted from the parts that were outside.

Thank you
Shynn

1 Like

Yes, there is, below is a script that will “boundary trim” inside or outside a set of closed curves (trimming curves can be multiple and even nested, but not overlapping).

HTH, --Mitch

MultiNestedBoundaryTrimCurves.py (4.1 KB)

1 Like

Great! Thank you.

One more thing, how can I change the default search paths for pythong scripts?

I got into the python editor, options, add path, added the path I wanted, and moved it up in the search order, but the default search path still opens. Anyways, what is the purpose of having multiple search paths if you cant swap between them? Or can you?

Shynn

I think the folder that comes up first when looking for scripts is the last used one, or the default if one has not previously opened a script in the current session (that may not be 100% correct though). I don’t think this is user changeable.

The search paths in the editor have nothing to do with this. The paths entered in the editor tell Rhino where to look for python scripts if you want to run them by filename but without specifying a full path.

Thus using an alias like ! _-RunPythonScript "MyScriptName.py" will run the script MyScriptName if it is found in one of the directories that have been specified in the editor. It looks in each directory in the list in order and stops looking at the first file it finds with the corresponding name.

–Mitch

Hi guys!

Sorry for replying to an old thread but unfortunately the script “MultiNestedBoundaryTrimCurves.py” that I have loved and used for many years doesn’t seem to work in Rhino 7 anymore (it worked perfectly fine in Rhino 5).
Is there any way someone with some Python knowledge could take a look at what has happened or changed? I have uploaded a screengrab from the message I’m getting as I’m trying to run it.

I have been using it almost daily before the Rhino upgrade and I would really appreciate it if someone could update the script somehow! <3

Thank you in advance!

The i in If should be lowercaseif not If

How did it get that way? The original script is not like that or it would not have worked in V5 either.

1 Like

Oh wow! I have no idea how it got changed to uppercase but now it works perfectly!
Thank you so much for your help! Should I delete my message so that it doesn’t confuse other people?

Glad it’s working now. No, no need to delete the post.

1 Like

I love this script and I use it continuously. Is there a way to make it work on hatches, dimensions, and text rather than just curves?

Well, I don’t know how you trim dimensions and text… It is possible to trim hatches now, I don’t think it was when the script was written, so I suppose these could be added as possible elements.

That’s true, I guess my thought process was that the script is useful if you want to delete everything within a boundary. For instance, I was just using it on a plan on which I needed to delete a chunk of the first floor where there’s a roof on the second floor plan, so I wanted to just delete everything within the boundaries, including the text and any dimensions that are fully within the boundary.

Any possiblity of making this work with hatches? Have been doing some jobs that it would speed up tremendously

I’ll have a look into being able to trim hatch objects. It’s a bit complicated, as I use Intersect to determine what and where to trim and Hatches don’t respond to Intersect. I think I would have to convert the hatches into surfaces (remembering the hatch attributes) and then back into hatches. Fair amount of bookkeeping work. My schedule is fairly impacted at the moment, I’ll look when I can.

1 Like

OK, Mitch. Not a rush at all, much appreciated. I managed to do it pretty quickly in this case by using DupBorder, CurveBoolean, and re-hatching, so that workaround is sufficient for my purposes right now.