Use of tools within tools?
-
You can use
Sketchup.send_action()
to call a built-in tool in your tool [once], but it's the getting back into your tool that's awkward... -
I always guessed this might be what Tools.push_tool and Tools.pop_tool were used for, although I have never attempted to use either method.
Although I don't think you can push/pop the built-ins. You would need to create your own alternatives.
-
has anyone created a set of "custom" standard tools that could be used within other tools?
It really seems silly that we can't activate a standard tool and then get back to the custom tool.
-
@kwalkerman said:
Say, use select to have the user select a bunch of objects, and on return, use move to let the user move them, then on return, use another tool to let the user do something else?
maybe i'm missing something but if that's the example then you can already do exactly that.
what's the problem you're having doing these steps with the standard tools?[edit] well, you don't use the return key but...
-
The problem is that there are certain things I do all the time, in the same order, and I want to make it faster.
Right now, I'm trying to create a "Slippery Move" tool, where you can move things without having them stick, or have them stick only to selected objects. The sequence for the basic Slippery Move is to select some things, make a group out of them, move the group, and then explode the group. The sequence for selected Slippery Move is to select some objects to move, then select which things you want it to stick to. The tool will make a group out of the "slippery" objects, allow the user to move the objects selected for the move, and then explode the group.
For obvious reasons, being able to say "use select tool until... (enter or keystroke)" or "use move tool until... (enter or keystroke)" would be extremely useful in this situation. I really want to have all the functionality of the built-in select and move tools so that the Slippery Move tool operates in ways that the user expects. Having to re-create all that functionality seems ridiculous.
-
There is no reason you can't do this (to some degree).
Just make your tool and have it remember what state it is at when the user exits to switch over to the select tool. Then when the user switches back to your tool, it should remember what steps have already been done. I think the hardest thing is going to be the move tool. Since you are looking for functionailty that is not a part of the move tool, you obviously will not be able to use the built in move tool. That you will have to write from scratch.
I think you would be better off to just write it all from scratch though. Making a select tool is not terribly hard. I wrote an example for August a couple of days ago in just a couple of linesa of code that draws a line to whatever is clicked on. So the select tool is returning the x,y,z position from wherever the mouse is. It is not much different to have it return an object id. Then your tool would store an array of objects to move. And an array of objects to stick to. Then you have the fun of writing the move tool. I don't think I've ever written something that moves objects in real time with the mouse. So that would is new territory for me, but I'm sure you can figure it out!
Chris
-
@kwalkerman said:
The problem is that there are certain things I do all the time, in the same order, and I want to make it faster.
Right now, I'm trying to create a "Slippery Move" tool, where you can move things without having them stick, or have them stick only to selected objects. The sequence for the basic Slippery Move is to select some things, make a group out of them, move the group, and then explode the group. The sequence for selected Slippery Move is to select some objects to move, then select which things you want it to stick to. The tool will make a group out of the "slippery" objects, allow the user to move the objects selected for the move, and then explode the group.
For obvious reasons, being able to say "use select tool until... (enter or keystroke)" or "use move tool until... (enter or keystroke)" would be extremely useful in this situation. I really want to have all the functionality of the built-in select and move tools so that the Slippery Move tool operates in ways that the user expects. Having to re-create all that functionality seems ridiculous.
i sort of get where you're coming from but i also suspect you don't use shortcuts. with shortcut keys, that exact operation is nothing.. even if you have to do it a lot.
the most time consuming part of that whole thing is selecting the multiple objects (especially if you're talking a bunch of littler lines and/or faces).. a select tool plugin that would select exactly what i want -- now that would be a winneranother thing you might try is drawing in groups/components to begin with.. maybe foresee the geometry you're going to move later and make sure to draw that in it's own group.. another benefit of doing it like that is you will somewhat get the functionality you're asking for with the select tool except it will be with the move tool.. the move tool can select a group and you can also use it to rotate. in other words, if you're working with groups, is actually
i dunno, just some ideas and maybe i'm not seeing the real possibilities here.
[edit] i might of missed part of your post implying that you would like to create the plugin? go for it! i think these guys that are already in the thread will help you out along the way.
i'll surely try it out when you're finished[edit2] or, maybe i'll wake up in the morning and see that chris already wrote it last night
-
To make a 'move tool' you simply transform! the selection to match the cursor position as you move and when you finally click it's frozen... The selection appears on the end of the cursor as you move it...
-
@kwalkerman said:
Right now, I'm trying to create a "Slippery Move" tool, where you can move things without having them stick, or have them stick only to selected objects. The sequence for the basic Slippery Move is to select some things, make a group out of them, move the group, and then explode the group. The sequence for selected Slippery Move is to select some objects to move, then select which things you want it to stick to. The tool will make a group out of the "slippery" objects, allow the user to move the objects selected for the move, and then explode the group.
I'm just wondering, why not just keep the object you don't want to "stick" (merge with other geometry?) grouped? You say it's something you often do - trying to prevent geometry from merging?
What kind of models are you making? -
-
I use shortcuts, all the time. The idea is that the tool would take care of some of the stuff automatically, and then give you the next tool you need, taking fewer keystrokes.
-
I generally use the program for architecture, currently I'm designing a post and beam barn. I often find myself copying lines, and deleting the original (another way to accomplish a "slippery move"), especially when creating the roof geometry with dormers, etc. This is partly because I'm stubborn and I like my walls and roofs to be thick, ie have two sides.
-
I'm learning to program ruby, and I figured this would be an "easy" first plugin I could create in order to facilitate learning (and that would be useful later on). Am I really the only one who thinks being able to call tools within tools would be useful?
-
I thought that calling an already existing tool would be the easiest way to do what I'm looking to do, but I guess I'll need to re-create the move and select tools. Chris - can you send me a link to the sample code you created for August? I'd really appreciate it.
Thanks for all your help and comments.
--
Karen -
-
@kwalkerman said:
- I use shortcuts, all the time. The idea is that the tool would take care of some of the stuff automatically, and then give you the next tool you need, taking fewer keystrokes.
well, you're suggesting using the return key to change to the next step so there are still keystrokes in there. seems just the same to me to push 'M' to switch to as pushing return.
@unknownuser said:
- I generally use the program for architecture, currently I'm designing a post and beam barn. I often find myself copying lines, and deleting the original (another way to accomplish a "slippery move"),
cmmd X then cmmd V will do exactly that.. try it.
i'm pretty sure i know what you're after here and it's something i used to want as well.. you pretty much just want to move stuff around without it sticking to other geometry?. i guess i've just become used to doing this in a manner that sketchup already allows.
-
one thing you will probably encounter along the way of making the script is deciding what to do with geometry that is shared by the objects you'd like to move and the ones that you are moving.. this is probably the reason why sketchup doesn't allow this natively because once you start thinking about it, this could cause problems depending on what you're trying to move.
i guess the best way to do it would be to have anything that is shared to be duplicated upon moving
-
Jeff,
yes, this is what happens when you create a block, and then move the block (which is why I chose that method of executing the slippery move). You can also copy something, move the copy and delete the original, which would result in a hole in your yellow box (front face still existing).
--
Karen -
is this possible with ruby?
-
make your selections with the standard select tool..
-
activate the plugin which immediately groups the selection then switches to the move tool.. upon moving/placing the newly created group, it explodes?
i'm suggesting using the standard select tool instead of making that part of the slippery slide because it may simplify the coding while not adding any additional steps to the operation (because you'll still have to tell SU when your selection is complete.. might as well just do the selection using then activate the plugin)
-
-
@unknownuser said:
- activate the plugin which immediately groups the selection then switches to the move tool.. upon moving/placing the newly created group, it explodes?
Yes - by using the
ToolsObserver
http://code.google.com/apis/sketchup/docs/ourdoc/toolsobserver.html you can detect Tool activity. Though you need to find out what state in the tool to look for.
Advertisement