Jump to content
Carles Olle

Invoke custom tool from menu command

Recommended Posts

Hi,

 

I need some help with custom plug-ins.

 

I created a custom plug-in with a custom point object. It seems to work fine

Now I need to create a command that will be executed from a menu that invokes the tool to place the custom point object in the document.

I've been looking around but I don't seem to find how to do it.

 

My questions are

 

  1. How to invoke the tool for the custom point object from the command script
  2. How to set up the parameters for the custom tool (Height, Width, etc.) for the new object I'm about to create

 

Thanks in advance.

Share this post


Link to post

You don't need to invoke your tool to place it with a script. Since you coded the object, you know everything about it. Simply PLACE the object, ATTACH the PIO record to it, and FILL in all the record fields with values you want.

 

Here's a VS sample of a bolt object (not a custom object, but the steps are the same).

 

H := CreateCustomObject('Hex Bolt (ISO)', 0, 0.8, #0d);
Record(H, 'Hex Bolt (ISO)');
Field(H, 'Hex Bolt (ISO)', 'boltType', 'Hex Bolt');
Field(H, 'Hex Bolt (ISO)', 'size_1', 'M12 X 1,75');
Field(H, 'Hex Bolt (ISO)', '__size_2', 'M12 x 1,75');
Field(H, 'Hex Bolt (ISO)', '__size_3', 'M12 x 1,75');
Field(H, 'Hex Bolt (ISO)', '__size_4', 'M12 x 1,75');
Field(H, 'Hex Bolt (ISO)', 'length', '1.9685');
Field(H, 'Hex Bolt (ISO)', 'threadStyle', 'Simplified');
Field(H, 'Hex Bolt (ISO)', 'view', 'Front');
Field(H, 'Hex Bolt (ISO)', 'drawFillet', 'False');
Field(H, 'Hex Bolt (ISO)', 'stdLength', 'True');
Field(H, 'Hex Bolt (ISO)', 'centerline', 'False');
Field(H, 'Hex Bolt (ISO)', '__oldSize', 'M12 X 1,75');
Field(H, 'Hex Bolt (ISO)', '__oldType', '1');

 

If that is not enough, then ResetObject(H) when you're done.

 

It should be pretty easy to Pythonize this.

 

HTH,

Raymond

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×