How to display Vertex and change color when selected?
-
How to display Vertex and change color when mouse over it?
Also it will be nice to change the color of edges and faces like it does when you have select tool activated.
Thanks in advance!
-
@unknownuser said:
Also it will be nice to change the color of edges and faces like it does when you have select tool activated.
Are you using the Selection set for anything else when you want to change their color ?
If not.. then just push refs to entities into the selection set.
ss = Sketchup.active_model.selection ss.add( ent )
You can also pass an array of entities into the add method.
-
@unknownuser said:
How to display Vertex and change color when mouse over it?
The API does not expose the little inferencing dots that native tools use.
You must do so within a
Tool
class, using thedraw
methods. (You draw a little circle.) -
This kinda work but only problem is that if cursor is touching nothing the edge remains selected until it touches something that is not an edge. Is there a fix for this?
select_comp=view.pick_helper selected_comp=select_comp.best_picked ss = Sketchup.active_model.selection if selected_comp.is_a? (Sketchup;;Edge) ss.add( selected_comp ) else ss.clear end
For the vertext suggestion I have yet to test this but soon I will give it a try
Thank you very much!
-
@dan rathbun said:
The API does not expose the little inferencing dots that native tools use.
@dan, where does linetool.rb draw the circle, I can't see it in the code, but this apears to be all that displays the dots...
# set the tooltip that should be displayed to this point view.tooltip = @ip1.tooltip
I can see later when you draw the line, but not the dots...@Renderiza, linetool.rb and mousetool.rb are worth looking at for tracking ideas
john
-
@driven said:
... this appears to be all that displays the dots...
# set the tooltip that should be displayed to this point view.tooltip = @ip1.tooltip
No that displays the popup box with yellow background, and says things like:
"on Face", "from Midpoint", "on Edge", etc.The inferencing "dots" are created by the
InputPoint
class.But you have no control over those... they are controlled by SU's inferencing engine.
SO actually .... @Rafael you actually could the built-in inferencing by using an
InputPoint
.
(As long as you do not care what color it is.) -
@dan rathbun said:
SO actually .... @Rafael you actually could the built-in inferencing by using an
InputPoint
.
(As long as you do not care what color it is.)Not sure about how to make what you suggested work.
I am using inputPoint already to place entities in place but there is not inferencing showing.
-
Like Dan said, you have to use the draw method.
#Your inputpoint wherever you initialize it... @ph = Sketchup;;InputPoint.new def draw(view) view.draw_points(@ph, 5, 5, "red") if @ph end
-
Thanks guys!
At first I could not make this work but after a couple (lots!) of tries it worked!
Here is what I was doing wrong...
def draw(view) ip1 = view.inputpoint x,y ; point = ip1.position ; point3 = Geom;;Point3d.new (point.x,point.y,point.z) view.draw_points (point3, 10, 1, "red") end
and here was the right way...
ip1 = view.inputpoint x,y ; @point = ip1.position ; def draw(view) point3 = Geom;;Point3d.new (@point.x,@point.y,@point.z) view.draw_points (point3, 10, 1, "red") end
Again thanks for help!
-
Don't put spaces between method names and their argument lists when you surround the list with**
( )
**Ruby generates a warning for every line that has the unneeded space.
Advertisement