Can I override the basic functionality of pushpull?
-
I'm new to plugin dev and I've created a tool - plytool - seeing some examples.
This tool allows you to use it like a rectangle tool, but instead of creating a face it will create a cuboid (a ply). If you had to do it using the basic tools you would (1) create a face (2) pushpull it to certain thickness. So now, you could simply do it in one step using the plytool.
What I'd like to do?
I'd like to restrict the user on using the pushpull tool only on some faces of the cuboid created using the tool.Question
Can I override the functionality of pushpull to do that? If yes, can you point me to some help examples. If no, it would help if you could suggest me an alternative.Thanks
-
I'm afraid that you cannot override or subclass the existing tools. You would have the create all the functionality in your own custom tool.
http://www.sketchup.com/intl/en/developer/docs/ourdoc/tool.php
-
From what you've said you don't actually want to stop the user having the PlushPull tool available to them ?
If you do then you could write an initially loaded Tools observer that always flips to Select when PushPull is chosen ?BUT to do what I think you want to do WITHIN your own Tool is very possible...
Like draw a rectangular face and then pushpull it an amount.
Limiting the user's choice within your tool of available faces for this pushpulling is a matter of testing a face for its suitability - this can be whatever you want - orientation of face.normal [e.g. only 'up' faces], or faces using a particular material or layer ?
That way your own pushpull tool will simply work in limited ways...Perhaps if you explained your code/steps more concisely we could help you advance your ideas...
-
Sounds pretty much like the thickening feature of Joint Push Pull.
-
Apologies for the delayed response.
Here is how a user would use the Plytool (the tool that creates a box/ply)
- Click on the tool icon. Now click (to mark the first point) and start drawing the ply
- Stop at another point (which is the second point). Leg go the left click and you have your ply
Coming to the questions
@tig said:
From what you've said you don't actually want to stop the user having the PlushPull tool available to them ?
Correct. I don't want to stop the user from using Push/pull but just restrict the user from pushing or pulling on certain kind of faces [e.g - vertical faces only].
@tig said:
Limiting the user's choice within your tool of available faces for this pushpulling is a matter of testing a face for its suitability - this can be whatever you want - orientation of face.normal [e.g. only 'up' faces], or faces using a particular material or layer ?
That way your own pushpull tool will simply work in limited ways...Yes, this seems like the suitable option to try. I will try this and get back if any questions. Ideally I would have preferred the ability to override pushpull tool (thereby not introducing a new limited version of pushpull tool). But this should do for now.
Thanks guys for helping me out and clarifying what is possible and what not.
- Click on the tool icon. Now click (to mark the first point) and start drawing the ply
Advertisement