Select Points "NO" Control

Hi all,

immagine

this command only selects connected control points, isn’t there a
similar command for non-control points they travel on the same axis?

Can you show an example of what you are wanting?—-Mark

Sorry if I wasn’t clear, I’ll try to explain myself better. typical example: I select a point and then choose a direction “X or Y or Z axis” and all the points are selected with the chosen coordinate, identical to the selected point.

(I hope it’s clear now, making an outline was more difficult for me than writing)

Is this something you do, or something you want to do?

Rhino does not have a tool that does this, btw.

Perhaps more information on what you want to and why (big picture) would help?

Thanks,

– Dale

Hi Dale,

I asked before, since I had tried to create scripts in Py or def in Gh a few times only to discover that there was already a native command in Rhino that did the same thing. in this case since select points control is very similar to what I would like, I was hopeful that there would be some sort of command, even for a series of “non-control” points that have a single identical direction

I created a def in Gh to better manage when there are a lot of points,
but in some cases I would like to stay in Rhino for practicality.

immagine

a simple example to imagine and like a situation like this: a graph with many peaks, each peak determines a point.
if the points are in the middle of other objects, it becomes convoluted to select them without a suitable code for this operation

As soon as I can I’ll try to write down some code to do this

using sy = System;
using rh = Rhino;

new MyScript().Main();

class MyScript
{
    rh.RhinoDoc doc = rh.RhinoDoc.ActiveDoc;

    public void Main()
    {
        sy.Console.WriteLine( Punto() );
    }

    public rh.Commands.Result Punto()
    {
        var pt = new rh.Input.Custom.GetObject { GeometryFilter = rh.DocObjects.ObjectType.Point };
        pt.SetCommandPrompt("GetPoint");
        pt.Get();

        var xyz = new rh.Input.Custom.GetString();
        xyz.SetCommandPrompt("GetCoordinate");

        xyz.AddOption("X");
        xyz.AddOption("Y");
        xyz.AddOption("Z");

        xyz.Get();

        sy.Console.WriteLine(xyz.Option().LocalName);

        foreach ( rh.DocObjects.RhinoObject item in doc.Objects.FindByObjectType( rh.DocObjects.ObjectType.Point ) )
        {
            var ptt = item.Geometry as rh.Geometry.Point;

            if (ptt.Location.X == pt.Object(0).Point().Location.X)
            {
                item.Select(true);
            }
        }
        return rh.Commands.Result.Success;
    }
}

I tried with this script of mine,
which works in the first part of the selection,

now I’m trying to add a variable to choose the Coordinate via command line, but obviously in this case it returns to me as a string and this is not good.

immagine

ps I would like to find a solution as an example given by me
avoiding using the conditional function with IF (xyz==X or Y or Z)

it is feasible?

Hi @0904,

See if the attached does what you want.

0904.cs (1.8 KB)

– Dale

thanks @dale ,

class MyScript
{
    rh.RhinoDoc doc = rh.RhinoDoc.ActiveDoc;

    public void Main()
    {
        sy.Console.WriteLine( Pnt() );
    }

    public rh.Commands.Result Pnt()
    {
        var pt = new rh.Input.Custom.GetObject { GeometryFilter = rh.DocObjects.ObjectType.Point };
        pt.SetCommandPrompt( "GetPoint" );
        pt.Get();

        var xyz = new rh.Input.Custom.GetString();
        xyz.SetCommandPrompt( "GetCoordinate" );
        xyz.AddOption( "X" );
        xyz.AddOption( "Y" );
        xyz.AddOption( "Z" );
        xyz.Get();

        double[] lst = { pt.Object(0).Point().Location.X, pt.Object(0).Point().Location.Y, pt.Object(0).Point().Location.Z };

        foreach ( var item in doc.Objects.FindByObjectType( rh.DocObjects.ObjectType.Point ) )
        {
            var ptt = item.Geometry as rh.Geometry.Point;

            if ( ptt.Location.X == lst[ xyz.Option().Index - 1 ] )
            {
                item.Select( true );
            }
        }
        return rh.Commands.Result.Success;
    }
}

I would prefer a solution like this, without using IF

I’m just having trouble how to combine two different values/objects, I was trying to concatenate them
as texts and convert everything like: Convert.Geometry.Point(“ptt”+“Location.X”) but I don’t know how.

sorry for the crazy question:

pt.Object(0).Point().Location.X //as objref as Point as Point3d as double

if I have a reference/object that contains a 3d point
and which in turn retrieves a coordinate and therefore a double value.

"pt.Object(0).Point().Location.X" //as string

being that the reference string is correct,
if that code string is obtained by manipulating text
can’t I convert the text to the object reference itself?

ps: Maybe you should do all the steps one at a time. . .

(objref)"pt.Object(0)".(Point)"Point()".(Point3d)"Location".(double)"X"

Hi @0904,

I have no idea what you are trying to do - sorry.

However, you can use Point3d as if it were an array.

var point = objref.Point().Location;
for (var i = 0; i < 3; i++)
{
  var component = point[i];
  // todo...
}

Perhaps this is of interest to you.

– dale

using sy = System;
using rh = Rhino;

new MyScript().Main();

class MyScript
{
    rh.RhinoDoc doc = rh.RhinoDoc.ActiveDoc;

    public void Main()
    {
        sy.Console.WriteLine( Pnt() );
    }

    public rh.Commands.Result Pnt()
    {
        var pt1 = new rh.Input.Custom.GetObject { GeometryFilter = rh.DocObjects.ObjectType.Point };
        pt1.SetCommandPrompt( "GetPoint" );
        pt1.Get();

        var xyz = new rh.Input.Custom.GetString();
        xyz.SetCommandPrompt( "GetCoordinate" );
        xyz.AddOption( "X" );
        xyz.AddOption( "Y" );
        xyz.AddOption( "Z" );
        xyz.Get();

        double[] lst1 = { pt1.Object(0).Point().Location.X, pt1.Object(0).Point().Location.Y, pt1.Object(0).Point().Location.Z };

        foreach ( var item in doc.Objects.FindByObjectType( rh.DocObjects.ObjectType.Point ) )
        {
            var pt2 = item.Geometry as rh.Geometry.Point;
            double[] lst2 = { pt2.Location.X, pt2.Location.Y, pt2.Location.Z };

            var val1 = lst1[ xyz.Option().Index - 1 ];
            var val2 = lst2[ xyz.Option().Index - 1 ];

            if ( val1 == val2 && sy.Math.Abs( val1 - val2 ) <= rh.RhinoMath.ZeroTolerance )
            {
                item.Select( true );
            }
        }
        return rh.Commands.Result.Success;
    }
}

I had gone a little astray,
but it seems to work fine this way.