.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

select object+point on it at the same time

2 REPLIES 2
Reply
Message 1 of 3
5thSth
351 Views, 2 Replies

select object+point on it at the same time

I'd like to be able to select an object (PromptSelection), and remember at what coordinate I grabbed it.

by coordinate, I dont min grip point. But any point on the object/line/poly/etc.

 

usually this is broken into

 

promptSelection

promptPoint

 

but I'd like to use only "prompt selection" with background mechanics getting the point etc.

 

is there a simple solution?

 

cus attm, all I can come up is

using PointMonitor eventH, with a filter that would tell me when (and where) i selected the object to "grab" that point.

 

 

2 REPLIES 2
Message 2 of 3
Keith.Brown
in reply to: 5thSth

If you use GetEntity instead of GetSelection then you can use the PickedPoint property of the result.  

 

        [CommandMethod("GetViewportPropertiesCSharp"]
        public void GetViewportPropertiesCSharpCommand()
        {
            var promptEntityOptions = new PromptEntityOptions("Select a viewport to view properties.");
            promptEntityOptions.SetRejectMessage("\nThat is not an viewport!");
            promptEntityOptions.AddAllowedClass(typeof(Viewport), true);
            var promptEntityResult = Active.Editor.GetEntity(promptEntityOptions);
            if (promptEntityResult.Status != PromptStatus.OK)
            {
                return;
            }

            using (var transaction = Active.Database.TransactionManager.StartTransaction())
            {
                var viewPort = promptEntityResult.ObjectId.OpenAs<Viewport>();
                Active.WriteMessage($"\nBackClip On : {viewPort.BackClipOn}");
                Active.WriteMessage($"\nThe back clip distance is {viewPort.BackClipDistance}");
                Active.WriteMessage($"\nFrontClip On : {viewPort.FrontClipOn}");
                Active.WriteMessage($"\nThe front clip distance is {viewPort.FrontClipDistance}");
                Active.WriteMessage($"\nPicked Point : {promptEntityResult.PickedPoint.ToString()}");

                transaction.Commit();
            }
        }
    }
Message 3 of 3
5thSth
in reply to: Keith.Brown

thank you! really swift reply!


1 question if you dont mind answering.

I wonder, at what point of the learning curve do you learn such details?

and how do you find out about them? Is it experience thing, or I missed some .doc 😉

p.s. Im newb

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost