Subscribe to this thread
Home - General / All posts - Type of selection
Akamini87 post(s)
#08-Dec-17 09:48

I would like to understand how to read the type of selection of a drawing object from a script - "type" of selection being whether it is just selected, or if it selected for geometric editing (i.e. as a user has used Ctrl + Alt when selecting the object and vertices are available for moving). In other words I would like the script to be able to differentiate between two objects selected, one just highlighted the other ready for editing as per the attached image.

Thanks.

Attachments:
Selection.jpg

adamw


10,447 post(s)
#08-Dec-17 12:26

To get the object selected for editing, use the ActiveObject property of the DrawingWindow object.

To get all selected objects, use the Selection property of the Drawing object, or check the value of the built-in "Selection (I)" field.

Akamini87 post(s)
#08-Dec-17 14:17

Thanks Adam - can't seem to grab hold of the active drawing object selected using the following:

code

function Main() {

 objectRef = Application.WindowSet.ActiveWindow.ActiveObject.ID;

 Application.MessageBox(objectRef);

}

Any idea why this doesn't seem to work with a drawing window active and an object selected for editing?

adamw


10,447 post(s)
#08-Dec-17 16:01

Well. I checked and this happens because of a bug in the implementation of ActiveObject in DrawingWindow. :-/

Use a map window.

We will fix the bug.

Akamini87 post(s)
#11-Dec-17 15:48

Well, glad it wasn't me for a change.

Have managed to implement the script using your suggestion of MapWindow as a workaround, thanks for your help with this.

steveFitz

340 post(s)
#12-Dec-17 05:23

Would you mind sharing your code with us?

How do you differentiate selected for editing from just selected?

Steve

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.