Jump to content

Creating a basic Object

Recommended Posts

I'm quite comfortable now creating scripts with custom dialogs that execute some kind of process and distributing them as VSMs.

But as much as I read the function reference, I can't get my head around creating a basic parametric object.


Like with menu command scripts, I think once I've got a small simple example I understand, I can expand it up to useful applications.


Is there such a think as a boilerplate example, please, that can do something simple like draw an 'example' object from a tool, that has one or two parameters to adjust in the shape pane?



Link to comment

@spettitt I'll attach 4 simple plug-in objects.


Two are examples I made for someone else for just exactly this reason.  Rect Point Example and Rect Rect Example.  They show two ways of making a rectangle tool. One is defined as a point object and one is defined as a rectangle object.  Obviously the rectangle object is better at making rectangles.


Then there is a fancier rectangle object.  RK Rectangle.


You should also have a 2D/3D Hybrid plug in so, I included a plug-in that gets bogged down when the object is too big.  Pat's Grate 3.


There is a circle of life when it comes to making your own plug-ins.  You start with scripts that get more and more complicated and useful.  Then when it comes time to make the jump to plug-ins, one of those who has gone before guides you through the steps and a vast universe of possibilities opens up.  You realize that plug-ins are easier to write and more efficient to use.  After several years of joyful plug-in creation you are horrified to learn that there is another plateau to climb:  Event Aware Plug-ins.  Again, a guide appears to walk you through the comically complicated steps.


Then someone who is successfully and happily writing scripts asks how to make a plug-in!  The circle goes on.

Rect Point Example.vso Rect Rect Example.vso Pats Grate 3.vso RK Rectangle.vso

  • Like 4
Link to comment

These are plug-ins written in VS in a forum about python.  😛


But I think the simple ones will translate directly.  Just add vs. to the functions and throw away the variable declarations.


Python IF statements are just slightly different, but I think you will be able to follow.


Post back if you have questions.

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.

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