Jump to content
Developer Wiki and Function Reference Links ×

creating a custom tool


michaelk

Recommended Posts

OK. Thanks to everyone in this little corner of the forum, I've managed to make a bunch of small, poorly written scripts that have sped up my workflow considerably.

Now I'd like to take the next step. I want to turn one of my scripts into a (path based) tool. (.vst?)

I've read the help section. I've looked at the on line examples. But some bit in my brain hasn't flipped into place yet.

Can someone point me to an example of a minimal script and how the variables get connected to parameters in the oip?

I'm sure I'm not even asking all the right questions yet. I'd just like to see the steps from script to tool so I can get it into my head.

thanks

mk

Link to comment

Lucky you it works the other way around.

If you create a plug-in you have to choose a standard tool that will be assigned to it. When you create the plug-in in the editor you can choose the path type (2D or 3D) and boom your tool is ready. ( assuming you don't want any special stuff)

Just make sure that your plug-in draws something based on the path of the object. The tool will create the path for you.

I never customized tools using VS myself, only using the SDK. No samples to give :)

  • Like 1
Link to comment

Thanks, Hippocode

I do see that when creating the tool there are options for point based or path based.

What I don't get is the next step.

Let's say I have a script like this:


Procedure QuickExtrude;

VAR
LineLength                                                    : REAL;
p1X, p1Y, p2X, p2Y,p1Z, p2Z                        : REAL;
V                                                                     : VECTOR;	
RectDepth, XtrdBottom, XtrdTop	                : REAL;

Begin

DSelectAll;

GetLine3D( p1X, p1Y, p1Z, p2X, p2Y, p2Z, TRUE);			

V.x := p2X - p1X;   									
V.y := p2Y - p1Y;   
V.z := 0;

LineLength := Norm(V);									

RectDepth := RealDialog('How Wide?','50');
XtrdBottom := RealDialog('Bottom of Extrude?','10');
XtrdTop := RealDialog('Top of Extrude?','100');

BeginXtrd(XtrdBottom, XtrdTop);

RectangleN(p1X, p1Y, V.x, V.y, LineLength, RectDepth);

EndXtrd;								

End;

Run(QuickExtrude);

I would like the extrude to be created with a tool and have the values for RectDepth, XtrdBottom, and XtrdTop be parametric.

The tool will get the path for me. How do I write the script in the way the tool wants, where do I put this script, and how do I link the variables to parameters?

I'm just trying to see the whole path of what's involved creating a parametric object with VS or Python.

But look out. One of these days I'm going to crack open the SDK and give it a try. When that happens I'll come to Belgium for a month or two and drive you crazy with questions.

thanks

mk

Link to comment

I think you are mixing up the part 'tool' and 'parametric object'.

As I've said earlier, when you create an object with the VS editor you choose a type and it will automatically bind the tool for it. You don't need to alter the tool as it will work just like that.

The tool will, once completed, create an instance of your object and insert the path you just created. It is your task to have your object load that path, and use it to draw something.

Easiest way is to duplicate the path and use that as a base for your extrude.

You can retrieve parameter values by preceding them with a P. Parameters itself are added uding the editor.

I'll mail some sample code of an old path based plug-in.

But look out. One of these days I'm going to crack open the SDK and give it a try. When that happens I'll come to Belgium for a month or two and drive you crazy with questions.

The 2017 version of my module will have a partially open source SDK project available to extend/tweak my module. Very cool, be sure to look at it.

Sounds great, always welcome ;)

Edited by Hippocode
Link to comment

The function reference always clearly explains which variables it takes and which it returns.

Parameters

objectHand HANDLE Handle to object.

Return Value

Returns a HANDLE to the path polygon.

You can get a handle to your object using GetCustomObjectInfo. Look it up on the function reference as it returns multiple parameters. You'll see I also use that function in the example I've sent you.

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