michaelk Posted August 20, 2016 Share Posted August 20, 2016 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 Quote Link to comment
Hippocode Posted August 21, 2016 Share Posted August 21, 2016 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 1 Quote Link to comment
michaelk Posted August 21, 2016 Author Share Posted August 21, 2016 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 Quote Link to comment
Hippocode Posted August 21, 2016 Share Posted August 21, 2016 (edited) 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 August 21, 2016 by Hippocode Quote Link to comment
michaelk Posted August 21, 2016 Author Share Posted August 21, 2016 Thanks Hippocode. The rest of my Sunday is now ruined. :-) I'll have to learn fast to be ready to understand your SDK work. I spent a month in Belgium a few years ago for work and loved it. I'm looking for any excuse to go back. mk Quote Link to comment
michaelk Posted August 21, 2016 Author Share Posted August 21, 2016 …getting closer. (I think) What's the trick for getting the handle to the path? Thanks mk Quote Link to comment
Hippocode Posted August 22, 2016 Share Posted August 22, 2016 GetCustomObjectPath Quote Link to comment
michaelk Posted August 22, 2016 Author Share Posted August 22, 2016 Arrggg.. So GetCustomObjectPath(H); assigns the path to the handle H? What's the syntax? Does there need to be a H1 := GetCustomObjectPath… or does GetCustomObjectPath(H); just assign the path object to the handle H? Thanks!! mk Quote Link to comment
Hippocode Posted August 22, 2016 Share Posted August 22, 2016 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. Quote Link to comment
michaelk Posted August 22, 2016 Author Share Posted August 22, 2016 Thank you! GetCustomObjectInfo was the step I was missing. mk Quote Link to comment
Recommended Posts
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.