View Full Version : Query result of PencilCurveTool
03-02-2011, 11:36 PM
For something I'm creating I need the results of the PencilCurveTool.
I initialize the tool for the user, let him draw something. When the curve is drawn I've a scriptJob do something with that curve. But I need the name of the curve that's being a created. But I can't get the result in the script of the command. This is giving me a headache.
Or is there any way to initialize my own version of the PencilCurveTool and where could I find the source code corresponding to this Run Time Command? (PencilCurveTool is a Run Time Command)
Hope someone can sort this out for me, because I don't have a clue on how to progress with this?
Thanks in advance.
03-03-2011, 09:59 AM
Hey Roy, you don't need the tool command to give you the name of the created curve, because once the tool has completed, the only thing selected will be the new curve. You could just initialise a scriptJob on "SelectionChanged" when the user enters your pencil-based tool, when they complete the curve selection changes, fires the scriptJob which then simply queries what is selected with `ls -sl` - which gives you your curve. You can always then kill the scriptJob (or make it run once only in the first place).
oh, btw, you can also start the pencil tool with this:
03-03-2011, 10:06 AM
I couldn't find the command you were talking about, but echo all commands reveals:
// curveContextEP //
curve -d 1 -p -3.048683 0 5.879469 -p -2.715299 0 1.915815 -p 2.687064 0 3.548077 -k 0 -k 1 -k 2 ;
// curve1 //
So my guess is that that the curve command actually create the curve, and escape tool returns it. There's also some script involved you should check out.
03-03-2011, 10:21 AM
That's precisely what I did. I set up a scriptJob running once when the selectionChanged. But if the user mid-process decided to not draw, but switch to another tool the actual curve will not be created. There's just no way to check if the user really finished drawing with the pencilCurveTool, right?
Than my script would run on whatever the user is going to select next.
Unless there's a way to kill my scriptJob when the user switches the tool? (another scriptJob?)
And yes. Running it with curveSketchToolScript 4; is a better choice. Than I'm sure the user will not be getting the tool options.
03-03-2011, 10:47 AM
well there's the ToolChanged event, so you could make it kill everything once the user drops the pencilTool...
03-03-2011, 10:52 AM
another possible alternative would be to ditch the pencil tool entirely and create a new tool of your own using draggerContext. This would give you back a series of points in 3d space as the user dragged which you could then use to construct a curve of your own (if that even is actually your ultimate aim..?)
03-03-2011, 11:04 AM
If I would do it with the ToolChange scriptJob I need it to kill the selectionChanged scriptjob and vice versa. If the selection changed, it would have to kill the ToolChange scriptjob I guess.
And that draggerContext seems interesting, I'll be digging into that.
I need the created curve for placement of a couple of objects.
What I did with my script is first create a nurbsPlane that is perpendicular to the camera. Position it to a certain depth (based of another objects position), make it live. Draw on that. Use the curve for placement of objects. Maybe you know a better way?
Nathan, do you by any chance know how to add function to the artisan tool (Sculpt Tool.) I want to 'move' the vertices with this tool instead of really sculpting it, but I need all of the functionalities this tool provides besides the sculpt mode. Hope you know, have been trying to find out for quite some time. AAaa! :)
03-03-2011, 11:04 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.