Jump to content

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.

Link to comment

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

Link to comment
  • 4 weeks later...

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...