SketchUp RUBY API Wishlist [way of coding wishes, please]
-
@tommyk said:
Yes, with a custom Ruby Tool. I would like to be able to change the highlight colour when the standard selection tool is used, and I believe there is no way to do this. Would you suggest that I script an alternative selection tool to mimic the native tool and add the additional functionality?
For the immediate solution with the current Ruby API that would be one way to do it. Though implementing the box selection is a challenge via Ruby - at least without performance impact of the tool.
@tommyk said:
Perhaps the Sketchup team would find that the change to the API in this way would be too much of an intrusion to Sketchup's standard tools?
It would be a concern if there was multiple extensions that modified the selection colour of objects. Which extension would get the last say? And how easy would it be for the user to read the selection if the selection color changed?
Having said that, we've had a couple of requests like this. If you would be able to mock up a real use case, a mock screenshot I can add that to a feature request in our bugtracker.
I personally think it would be nice to have some generic way to draw additional graphic to the screen to display meta data etc. Not just changing selection colour. -
It would be nice if you could retrieve a face from
Geom::PolygonMesh
. For example:` ent = Sketchup.active_model.entities
ps = [[0, 0, 0], [0, 10, 0], [10, 10, 0]]
mesh = Geom::PolygonMesh.new
ps.each { |p| mesh.add_point p }
ind = mesh.add_polygon ps
ent.add_group.entities.fill_from_mesh meshWISH
f = mesh.get_face ind
############`If you want to make a lot of manipulations on a complex piece of geometry, it is often an order of magnitude faster to recreate the manipulated geometry from scratch using
fill_from_mesh
rather than operating on the existing geometry using add/remove face. However, you often want to associate faces in the old geometry with corresponding faces in the new mesh geometry in order to copy over materials and so on, and this is wheremesh.get_face
would save a lot of time. -
Isn't it already possible to just change the highlight color in the rendering options? It could be done from a selection observer and depend on what's currentply selected. Only supports one color at a time though.
-
-
+1
But also ability to remove polygons. If I'm not misstaken one can only add polygons(?).
(This was under discussion before)It would be convienient to use polygonmesh as container at an early stage. Rather as a last step before becoming Sketchup geometry..
Transforms are ~3 times faster (due to indexing?) than transforming required n_points directly as well. Although that can be simulated with a Class.
-
@tt_su said:
@tommyk said:
Perhaps the Sketchup team would find that the change to the API in this way would be too much of an intrusion to Sketchup's standard tools?
It would be a concern if there was multiple extensions that modified the selection colour of objects. Which extension would get the last say? And how easy would it be for the user to read the selection if the selection color changed?
I've been mulling this question over these last few days, and I think the solution might be to confine Ruby plugins that manipulate the presentation of a model to a specific style. I haven't formulated exactly how this would work yet, but it makes sense to separate the manipulation of geometry from the presentation of geometry in this way. Would involve extending the Style entity API I expect. What is exciting about this approach is that Ruby can get stuck in doing some special things with the presentation of the model. Eg:
- change line thicknesses for different components (useful for presenting depths of items maybe?)
- Color lines by layer (useful for people working with complex models, and want to retain materials on faces)
This approach makes sense for me, although I am well aware how much more I am asking for compared to my original request! Not to mention compatibility with LayOut.
@tt_su said:
Having said that, we've had a couple of requests like this. If you would be able to mock up a real use case, a mock screenshot I can add that to a feature request in our bugtracker.
I personally think it would be nice to have some generic way to draw additional graphic to the screen to display meta data etc. Not just changing selection colour.I will mull over the question some more, and get back to you. And yes, additional graphic on the screen would be very handy, and would certainly improve my productivity in certain areas.
@eneroth3 said:
Isn't it already possible to just change the highlight color in the rendering options? It could be done from a selection observer and depend on what's currentply selected. Only supports one color at a time though.
I did NOT think of that! For my purposes, this may do the trick. Thanks!
-
@tommyk said:
I did NOT think of that! For my purposes, this may do the trick. Thanks!
Beware that users might not like that extensions arbitrary change the settings of the style they have set up.
-
One wish:
Model.active_path= (Array of groups/instances like in existing method: active_path)
I haven't found a way to change the context (path) elsewhere, at least. I would like it in my case, as I use Ruby to reload a Component Definition. When the user is at the path within a Component that is deleted in the script, when the script executes, it just looks rubbish.
Second wish:
ComponentDefinition.path= (String representing path)
Currently, the only way to affect thedefinition.path
of a ComponentDefinition is to useDefinitionsList.load
(which loads a new component completely, and isn't completely reliable) -
@tt_su said:
@tommyk said:
I did NOT think of that! For my purposes, this may do the trick. Thanks!
Beware that users might not like that extensions arbitrary change the settings of the style they have set up.
I think the sensible way of getting around this is setting up a new style with the extension. You would then only implement the style changes if the selected style is the extensions style with Styles.active_style.
-
I'm getting back to work on a plugin that will let you use WASD first-person shooter controls to navigate the scene, and I would love it if and active tool could programatically disable shortcut keys (or even just assign them, so I could, when the tool was active, unassign WASD, then reassign them on tool close, although that would trash the user's key bindings if SU crashed during tool use...)
-
Hello,
I am new to google sketchup with ruby script.
I have install google sketchup on my linux machine ubuntu 12.04. now able to start with ruby script. i already have ruby script. SO anyone can help to how can i run this script with google sketchup.Thanks
Advertisement