Naming a point

In the following, since Point3d doesn’t have attributes, how do I convert StaPt to an ObjRef, in order to change its name

           Rhino.Geometry.Point3d StaPt = new Rhino.Geometry.Point3d(x, y, z);  
            string NewName = "";
            Rhino.Input.RhinoGet.GetString("Name of Point:", false, ref NewName);

            doc.Objects.AddPoint(StaPt);

Create an ObjectAttributes Class and set the name you want to it, then use ObjectTable.AddPoint Method (Point3d, ObjectAttributes) to add your point with the attributes. The ObjectTable is accessed through RhinoDoc.Objects Property on the doc instance you get passed into your RunCommand implementation.

Thx, Nathan.

the second line:

            Rhino.Geometry.Point3d StaPt = new Rhino.Geometry.Point3d(x, y, z);
            ObjectTable.AddPoint(StaPt, objAtt);

tells me that an Object Reference is required for the AddPoint method.

You can’t use ObjectTable directly like that. You need to access an instance of it, which is the Objects property on an instance of a RhinoDoc. As I told you the RunCommand implementation you make for your command gives you access to a RhinoDoc instance.

Please read all the documentation I linked.

Thx, Nathan.

What I missed in my original reading of the AddPoint() method was the method call that included the ObjectAttributes parameter. That makes all the difference.