How to select wire frame items only at Z = 0

I have extracted a wire frame from a 3d model, and I want to select only the wire frame items which are at Z:0 and discard the other items below that, and I’m wondering if this is possible? ( or the other option is select the items below Z:0 and delete them )

I have tried just going to a front view and drawing a selection square for the items below Z:0 and deleting these items hoping to leave just the items at Z:0 and this works fairly well, but there are still some items that are just slightly below the Z:0 that are hard to pick using this process.

I’m using this process to create and export a selection group that will be used for my CNC Cam tool paths

Thank You…

Kent

Are you looking for something like this?

import Rhino.Geometry as rg
from scriptcontext import doc
tol = doc.ModelAbsoluteTolerance
for obj in doc.Objects:
    bbx = obj.Geometry.GetBoundingBox(False)
    if bbx.IsDegenerate(tol):
        if rg.Plane.WorldXY.DistanceTo(bbx.Center) < tol:
            doc.Objects.Select(obj.Id)

SelOnWorldXY.py (293 Bytes)

I don’t believe so…

So for example in this screenshot I started selecting just the wire frame lines that are at the Z:0 elevation, ( the items in yellow ) But I’m having to go through and hand select each item one at a time, so I’m looking for a way to select just the items that are at the Z:0 elevation and not the items below them.

Are you familiar with running scripts? Mahdiyar’s script reads as though it ought to do pretty much what you want. If you tried running it and it didn’t, perhaps you could be more specific about it’s shortcomings. On the other hand, if you need some guidance about what to do with it just ask.

1 Like

I’m sorry, but I’m not familiar with scripts… ( But I am definitely interested in learning more on them )

In Mahdiyar’s example I think the result was that it moved all of the lines to the Z: zero position.

But in my example what I am wanted to do is only select the lines that are currently at the Z:0 position and disregard the rest.

What I am doing is exporting the 3d step file from Rhino, and then I want to export a second line drawing file that only has the line drawing for the outline at the Z:0 position so that I can use that in my CAM software for a tooling boundary.

I am attaching a screen shot from my CAM software showing that line drawing (in light blue) laying on top of the 3d model.

That way my CAM knows what part of the model ( the boundary ) to use for my tool paths.

Hi @kentdesautel,

i would like to suggest a different way to get the required curves. You can sub-select the top surface of your tooling by clicking on it while holding CTRL + Shift.

Then run the _DupBorder command to get only the trim curves of the top surface.

Alternatively, below script will select all planar curves which are in the current viewports active CPlane. Make sure that you’re running it while the Perspective viewport is active, eg. with the default CPlane Top:

import rhinoscriptsyntax as rs

def SelectCurvesInActiveCPlane():
    
    # unselect all objects
    rs.UnselectAllObjects()
    
    # get all selectable curves
    crv_ids = rs.ObjectsByType(rs.filter.curve, False, 1)
    
    # get cplane of the current view
    plane = rs.ViewCPlane()
    
    # select curves in plane
    for crv_id in crv_ids:
        if rs.IsCurveInPlane(crv_id, plane):
            rs.SelectObject(crv_id, redraw=False)
    
    # redraw all viewports
    rs.Redraw()
    
SelectCurvesInActiveCPlane()

this will select the (planar) curves at Z=0.
_
c.

2 Likes

That did the Trick!!! I was not aware of the CTRL + SHIFT Trick…!

This is going to save me a TON OF TIME!!

Thank You EVERYONE for all of your help on this…!

Kent