It's not very hard to do, but's probably a bit too hard for most casual scripters because it is a bit of a challenge to duplicate the functionality of the native SketchUp move, rotate and scale tools. I guess I'll let one cat of the bag and say that it is planned in SDS2 to have vertex selection and transformation. However, that will be a commercial plugin and who knows when it will be released? It would be good to have a free plugin with a few simple vertex tools, though.
One of the limits in a regular SketchUp installation is the fact that it’s really a line and face editor, not a vertex editor. What this means is that you really only edit lines and faces.
You should give it a try, Remus. Remus wrote:Is there any reason why a plugin doesnt exist at the moment that allows you to modify vertices?
I was thinking of having a crack at it but was wondering if theres some technical reason why it's hard/impossible to do. There's nothing complex actually in writing any code about vertex deformations. The real issues is to know exactly what to do in real use cases, because moving one vertex is probably not really helpful as such. In my next plugin, I am for instance deforming curves based on moving an extremity (something Sketchup does natively in the Move tool, but does not propose for one single vertex).
So I would suggest the Community elaborates a little bit more on real-life examples of vertex edition. Here is an example of a fully functioning tool class Remus. Copy all of it into Jim's web dialog, then execute. Class Remus_tool def onMouseMove(flags, x, y, view) ip = view.inputpoint x,y @cursor = ip.position view.invalidate end def draw(view) view.draw_points @cursor, 10, 1, 'red' end end Sketchup.active_model.select_tool Remus_tool.new The main things to learn from it are that tools are their own class. To start a tool, you have to use Sketchup.active_model.select_tool( my_tool_object ).
Once you have the tool class, you can use all the cool tool methods defined in the in the API. So you get access to the mouse and keyboard, for example. Also, in the onMouseMove, I am calling view.invalidate.
Everytime that is called, SketchUp checks the draw method (if there is one(you need to add it like I did)). So everytime view.invalidate is called, the draw method does whatever it is told to do. It is only from within the draw method that you can call all the screen found in the. Also, the last thing I will note about the code is that the is finding the 2d mouse coordinates and returning a. Because the view.draw method draws in 3d model space, not 2d screen space (yes there is a draw2d method, but it didn't want to cooperate today). Heheehe, have fun!