Jump to content

How do I retrieve info for a Point-PIO by clicking on a drawing element?


VvierA

Recommended Posts

Hi everybody,

another day, another challenge...

I'd like to make a custom point object with the following feature:

When I hover with the cursor over drawing elements they should highlight in the standard Vectorworks manner. By clicking on one of the highlighted elements the plugin should retrieve information of the element (for example the area of that element).

Does anybody know, how to do this?

If I make a new custom point object and start it, there is no highlighting while hovering over the drawing. And in the next step I wouldn't know how to get a handle to the element I clicked on.

Thanks for help

VvierA

Link to comment
Hi everybody,

I'd like to make a custom point object with the following feature:

When I hover with the cursor over drawing elements they should highlight in the standard Vectorworks manner. By clicking on one of the highlighted elements the plugin should retrieve information of the element (for example the area of that element).

Does anybody know, how to do this?

Do you mean that when you hover over the custom point object, or another object that's not your plugin? Or do you mean one of the objects in your plugin?

What exactly do you need to do? I get the impression it's not an custom object you need.

Edited by Dieter @ DWorks
Link to comment

I'm not sure this is possible with VS.

What you need to do is to overwrite the tool behavior, particularly the mouse move and click events.

If there is no way of overwriting the tool, you might do it with a menu command instead or object event:

http://developer.vectorworks.net/index.php/VS:vstGetPickObject

You could trigger this by a button in the OIP.

I do exactly what you describe for a custom tool myself, but it's made with the SDK so I have no idea how to do this in vectorscript.

Edited by Hippocode
Link to comment

Do you mean that when you hover over the custom point object, or another object that's not your plugin? Or do you mean one of the objects in your plugin?

What exactly do you need to do? I get the impression it's not an custom object you need.

I'd like the following usage:

- select the tool

- hover over the drawing with the cursor

- VW should highlight the graphic elements while I hover (could be everything - not necessarily a custom object)

- I click one one of the graphic elements while it is highlighted

- my plugin object retrieves information of that element and my object is placed right there where I clicked

- the plugin object shows information of the element like a stamp (for example the area of the element)

And yes: maybe it's more like a custom tool than a custom plugin object.

Do you think, I can succeed by making a tool rather than a plugin object?

I'm not sure this is possible with VS.

What you need to do is to overwrite the tool behavior, particularly the mouse move and click events.

If there is no way of overwriting the tool, you might do it with a menu command instead or object event:

http://developer.vectorworks.net/index.php/VS:vstGetPickObject

You could trigger this by a button in the OIP.

Thank you, I will have a look at it. Maybe it works.

Link to comment

After taking a quick look at the VS function reference, there is a section for "tool events". So it might be possible after all :)

Note that you need to create the hovering part on your own. This is what I use for one of my tools in the SDK.

It will highlight any object compared with an array of object names.

void CMEPLabelToolDef_EventSink::MouseMove()
{
   if(this->GetToolPointsCount() == 0)
   {
       MCObjectHandle OverObject;
       short OverPart;
       SintptrT Code;

       gSDK->TrackTool(OverObject, OverPart, Code);
       if(OverObject != NULL)
       {
           //if(OverObject != Object)
           {
               gSDK->EmptyToolHighlightingList();
               if(VWParametricObj::IsParametricObject(OverObject))
               {
                   VWParametricObj Obj(OverObject);
                   TXString ObjName = Obj.GetParametricName();

                   // Valid object ?
                   if(std::find(fTaggableObjects.begin(),fTaggableObjects.end(),ObjName) != fTaggableObjects.end())
                   {
                       HighLightedObject = OverObject;
                       gSDK->AddToolHighlightingObject(HighLightedObject);
                   }
                   else if(std::find(fTaggableGroupObjects.begin(),fTaggableGroupObjects.end(),ObjName) != fTaggableGroupObjects.end())
                   {
                       HighLightedObject = OverObject;
                       gSDK->AddToolHighlightingObject(HighLightedObject);
                   }
               }
           }
       }
       else
       {
           if(HighLightedObject != NULL)
           {
               gSDK->EmptyToolHighlightingList();
               HighLightedObject = NULL;
           }
       }
   }

   //return VWToolDefault_EventSink::MouseMove();
}

Link to comment

Do you mean that when you hover over the custom point object, or another object that's not your plugin? Or do you mean one of the objects in your plugin?

What exactly do you need to do? I get the impression it's not an custom object you need.

I'd like the following usage:

- select the tool

- hover over the drawing with the cursor

- VW should highlight the graphic elements while I hover (could be everything - not necessarily a custom object)

- I click one one of the graphic elements while it is highlighted

- my plugin object retrieves information of that element and my object is placed right there where I clicked

- the plugin object shows information of the element like a stamp (for example the area of the element)

And yes: maybe it's more like a custom tool than a custom plugin object.

Do you think, I can succeed by making a tool rather than a plugin object?

Yes, you will need both a custom tool and a custom object. The custom tool will let the user select the object where you want the info from, then create the custom object and set the parameters based on the selection. I'm sure there are calls for you to let the user choose something, and they will highlight the objects the user hovers, as this is default VW behaviour.

Link to comment

I'd like the following usage:

- select the tool

- hover over the drawing with the cursor

- VW should highlight the graphic elements while I hover (could be everything - not necessarily a custom object)

- I click one one of the graphic elements while it is highlighted

- my plugin object retrieves information of that element and my object is placed right there where I clicked

- the plugin object shows information of the element like a stamp (for example the area of the element)

Take a look at the following procedure for the hovering functionality:

http://developer.vectorworks.net/index.php/VS:TrackObject

the definition also includes a working sample.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...