Hello everybody
Please is there a very detailed course on the functioning of the mouse because until now I can not control how the mouse works and how to recover the coordinates of a selected point?
something else is there small program that lets me see how the mouse buttons work when I click on them, like displaying a message telling me that the left button is clicked when I click on it.
thank you to all of you
Iâm guessing this is a developer question and not how do you use a mouse.
If it is the OP should move it to the correct category or comment here and we can do it for you.
Inside or outside SketchUp, Fred?
merci pour vous tous
je parle de lâintĂ©rieur de sketchup , par exemple comment je dois faire pour que quand je clicke sur le bouton de la souris (gauche), un texte sâaffiche dans me disant que jâai clickĂ© sur le bouton gauche de la souris ? ça câest la premiĂšre partie
la deuxiĂšme partie, comment je peux rĂ©cupĂ©rer les coordonnĂ©es 2d par rapport Ă l"ecran et 3d par rapport Ă lâespace sketchup dâun point dâune façon pure et simple ?
Merci dâavance Ă vous tous
Parlez-vous dans un script rubis? ou tout simplement en utilisant sketchup?
dans un script rubis je vais poster un exemple que je le test depuis tout à l"heure mais ça fonctionne pas
âââdef onLButtonDown
UI.messagebox(âhiâ)
end âââ
TRANSLATION in a ruby script I will post an example that I have been testing for a while ago "but it doesnât work
ââ 'Def onLButtonDown
UI.messagebox (âhiâ)
end ââ â
Je ne sais pas. je modifie le titre et la catĂ©gorie de votre question pour que quelquâun qui comprenne lâĂ©criture dâextension le remarque. bonne chance.
very old test script to play withâŠ
# Copyright 2005, @Last Software, Inc.
# This software is provided as an example of using the Ruby interface
# to SketchUp.
# Permission to use, copy, modify, and distribute this software for
# any purpose and without fee is hereby granted, provided that the above
# copyright notice appear in all copies.
# THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#-----------------------------------------------------------------------------
require 'sketchup.rb'
class ToolTests
# Called when you select the tool
def activate
puts "activate called"
end
# Called when I select another tool or quit SketchUp
def deactivate(view)
puts "deactivate called"
end
# Called when I roll middle mouse button?
def draw(view)
puts "draw called"
end
# Called when I roll middle mouse button?
# Called when I bring SketchUp into view. Followed directly by draw
def getExtents
puts "getExtents called"
end
# This is called followed directly by onRButtonDown
def getMenu(menu,flags, x, y, view)
# add a menu_items here and the call comsumes both Down and up
menu.add_item("eats onRButtonDown?"){
puts "'getMenu called', is onRButtonDown above and onRButtonUp below? "
}
menu.add_item("capture onRButtonUp"){
puts "call onRButtonUp from getMenu item{}... "
onLButtonUp(flags, x, y, view)
}
end
# Called when I press the Esc key. Followed directly by onKeyDown
def onCancel(reason, menu)
puts "onCancel called"
end
def onKeyDown(char, rpt, flags, view)
puts "onKeyDown called"
end
def onKeyUp(char, rpt, flags, view)
puts "onKeyUp called"
end
# NOTE: Called after onLButtonDown and onLButtonUp.
def onLButtonDoubleClick(flags, x, y, view)
puts "onLButtonDoubleClick called"
end
def onLButtonDown(flags, x, y, view)
puts "onLButtonDown called"
end
def onLButtonUp(flags, x, y, view)
puts "onLButtonUp called"
end
# Called a lot so I did not put a puts message in
def onMouseEnter(view)
end
# Called a lot so I did not put a puts message in
def onMouseLeave(view)
end
# Called a lot so I did not put a puts message in
def onMouseMove(flags, x, y, view)
end
# NOTE: Called after onrButtonDown and onRButtonUp.
def onRButtonDoubleClick(flags, x, y, view)
puts "onRButtonDoubleClick called"
end
def onRButtonDown(flags, x, y, view)
puts "onRButtonDown called"
end
# Called not only right after a onRButtonDown, but after a onRButtonDoubleClick?
def onRButtonUp(flags, x, y, view)
puts "onRButtonUp doubleclick called"
end
# NOTE: onReturn is followed directly by onKeyDown
def onReturn(view)
puts "onReturn called"
end
def onUserText(text, view)
puts "onUserText called"
end
# Called when I double-click middle mouse button (exits out of orbit)
def resume(view)
puts "resume called"
end
# Called when I press middle mouse button (goes into orbit)
def suspend(view)
puts "suspend called"
end
end # end of class ToolTests
Sketchup.active_model.select_tool ToolTests.new
john
merci beaucoup jâai testĂ© sur le console ruby et ça marche super bien , je vais lâĂ©tudier ligne par ligne, par contre auriez vous un exemple concernant la rĂ©cupĂ©ration des coordonnĂ©es 2d(par rapport Ă lâĂ©cran) et 3d dâun point quand je clique nâimporte oĂč sur la fenĂȘtre sketchup
merci beaucoup
Within the test tool change onLButtonUp
to âŠ
def onLButtonUp(flags, x, y, view)
puts "onLButtonUp called. User clicked at [#{x},#{y}]"
end
Within the test tool change onLButtonUp
again and create an inputpoint âŠ
def onLButtonUp(flags, x, y, view)
puts "onLButtonUp called. User clicked at [#{x},#{y}]"
@ip = view.inputpoint(x,y)
end
REF:
merci beaucoup grand dan
mais le deuxiÚme exemple ne me donne pas les coordonnées en 3d , il me donne toujours les coordonnées 2d , y a t elle une chose à modifier ?
merci
re grand dan
jâai rĂ©ussi Ă rĂ©cupĂ©rĂ© les coordonnĂ©es 3 d en ajoutant "point= @ip.position "
nĂ©anmoins , merci beaucoup Ă vous tous, grĂące Ă vous tous jâai appris des choses
merci beaucoup
Yes, this is why I gave you the link to the Sketchup::InputPoint
class, so thta you could use the #position
instance method.
You are most welcome.
Vous ĂȘtes les bienvenus.
For more on using the mouse within a tool, see the SketchUp Development Teamâs example "linetool.rb"
file âŠ
Pour en savoir plus sur lâutilisation de la souris dans un outil, consultez lâexemple de fichier "
linetool.rb
ââ de lâĂ©quipe de dĂ©veloppement SketchUp âŠ