- Code: Select all
# Tool ID constants # Tool Name
T_3D_TEXT = 21013 # 3DTextTool
T_ARC = 21065 # ArcTool
T_CAMERA_DOLLY = 10523 # CameraDollyTool
T_CAMERA_ORBIT = 10508 # CameraOrbitTool
T_CAMERA_PAN = 10525 # CameraPanTool
T_CAMERA_POSITION = 21169 # PositionCameraTool
T_CAMERA_WALK = 10520 # CameraWalkTool
T_CAMERA_ZOOM = 10509 # CameraZoomTool
T_CAMERA_ZOOM_WINDOW = 10526 # CameraZoomWindowTool
T_CIRCLE = 21096 # CircleTool
T_COMPONENT = 21013 # ComponentTool
T_COMPONENT_AXIS = 21126 # ComponentCSTool
T_DIMENSION = 21410 # DimensionTool
T_ERASE = 21019 # EraseTool
T_FREEHAND = 21031 # FreehandTool
T_FOLLOWME = 21525 # ExtrudeTool
T_MODEL_AXIS = 21126 # SketchCSTool
T_MOVE = 21048 # MoveTool
T_MEASURE = 21024 # MeasureTool
T_OFFSET = 21100 # OffsetTool
T_PAINT = 21074 # PaintTool
T_PASTE = 21013 # PasteTool
T_POLYGON = 21095 # PolyTool
T_POSITION_TEXTURE = 21515 # PositionTextureTool
T_PUSHPULL = 21041 # PushPullTool
T_PROTRACTOR = 21057 # ProtractorTool
T_RECTANGLE = 21094 # RectangleTool
T_ROTATE = 21129 # RotateTool
T_SCALE = 21236 # ScaleTool
T_SELECTION = 21022 # SelectionTool
T_SECTIONCUT = 21337 # SectionPlaneTool
T_LINE = 21020 # SketchTool
T_TEXT = 21405 # TextTool
[Code] Tool ID Constants - Rev. 2
16 posts
• Page 1 of 1
[Code] Tool ID Constants - Rev. 2I couldn't find a list of tool IDs, so it'd be nice if people could add missing tools to the list. I've prepared the ones I've found in a list of constants associated to the ID's with a comment at the end with the string name.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: [Code] Tool ID Constants - Rev. 2Have you looked at
Object.constants for all constants and Object.constants.grep(/CMD/).join(', ') for a list of reigstered CMD or command constants? Maybe that's not what your looking for, but there you go in case its helpful. Jim showed me that. Just the constants prefixed with CMD are:
Re: [Code] Tool ID Constants - Rev. 2Hmm... interesting. But that's not the Tools. Just general references to commands.
What I had tried was looking through all the classes that existed. Thinking there'd be one for each tool as you'd do when you create a ruby tool. But there was nothing there either. Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: [Code] Tool ID Constants - Rev. 2
My experience with those "constants" are that they are not always "constant". They're actually menu ids. As long as the tool menu does not change, they'll work, but if someone inserts or changes the order of the menus, they shift around. You can find all menu ids using EventRelay and the example script at http://code.google.com/p/eventrelay/wiki/EventRelay
Re: [Code] Tool ID Constants - Rev. 2Ugh... I'm getting a bit tired now. I'm dealing with the ToolsObservers to work around some other malfunctioning observers. And now I have to a workaround for the workaround..? bleh...
Ok, tired ranting aside; This event relay; you suggest using it to work out the IDs for the tools? Problem is that it won't work on Mac. Mac compatibility was the reason I'm trying to use the IDs since Mac truncates the tool names so you can't tell PolyTool apart from MoveTool or TextTool. Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: [Code] Tool ID Constants - Rev. 2Btw, how are native menu items shifted about? Can they be modified somehow? I thought that ruby menu items where added to the bottom of the menus. But you're saying they can affect the native menu items?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: [Code] Tool ID Constants - Rev. 2
When I wrote EventRelay, I noticed that I could not depend on menu items being constant. I'm saying that native menu items shift about all on their own without the help of us script writers. Eg., the Edit menu structure menu id's even share ids depending on what's selected before the user invokes the menu. Id 41002 can be "Delete Component" or "Flip along Groups Red" depending on the selection. I'm suggesting that plugin menu id's are dynamic according to the order in which SketchUp finds them in the Plugin folder. Insert a new plugin, your old plugin menu id may change. I'm suggesting that the Tools menu id may change depending on whether I added someones C extension in the Tools menu. I know it's frustrating and annoying. But that's the way (at least in windows) menu structures work. Before EventRelay could translate a user command to a menu id, it had to ask, each time, the windows menu routines for its current menu id for a particular menu entry. It would have been so much easier had they been constant. No such luck, however. Re: [Code] Tool ID Constants - Rev. 2
Is it possible that the trucation is consistent enough that you could use a combination of the trucated name and the inspect id to create a hash to dynamically identify the tool? Don't mean to insult your intelligence. What does the trucation look like. I don't know, I don't have access to a mac. If you had a map consisting of the SketchUp version number, the OS, the ordinary sequence of the Tools menu, the Ids of the ordinary menu, the inspect id of the tools, then you might be able to hack a hash of the Tool name. If the user changes the Tools structure with a C extension or insertion, then they'll just have to punt. You still catch 99% of the users. You should be able to get the Tool id from a "Tools observer" test script while physically observing your actions plus the report of the tool id. Hope something of this helps. Re: [Code] Tool ID Constants - Rev. 2Hi all!
Chris, How do you use these CMD objects? Frenglish at its best !
My scripts Re: [Code] Tool ID Constants - Rev. 2I don't use them. But I was under the impression that SU registers these Constant variables everytime it starts. So they hold the correct ID, regardless of the OS or what have you. That might not be correct though. You guys are in quite the discussion about tool_Id's and such. I have not really needed to dig into them yet.
Re: [Code] Tool ID Constants - Rev. 2
The first four characters are truncated. I think the first think I need is to create a scenario where I can reliably cause the IDs to shift. Then I can work on and test a method to reliably identify the tools. Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: [Code] Tool ID Constants - Rev. 2For a PC CMD_LINE returns 21020
so... Sketchup.send_action(CMD_LINE) runs the 'Line' command... Don't know about Macs - any info ? Can a Mac user let us know what comes from typing CMD_LINE on their machines... If it's possible to get 'numerical values' for commands beyond the base send_actions set on PC and Mac - even if they are different - then it becomes possible to do other stuff too - like closing the Outliner window during intensive script processing on PC and Mac to avoid BugSplats ??? TIG
Re: [Code] Tool ID Constants - Rev. 2On Mac:
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: [Code] Tool ID Constants - Rev. 2Oh, sorry. Thought it belonged to the Sketchup namespace.
Here's the real deal:
Odd though, because on PC I got this:
Wonder why one system retuned a warning, and the other and error. Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: [Code] Tool ID Constants - Rev. 2When I run Sketchup.send_action(CMD_LINE) from the ruby console, I get => true
and it activates the line tool. and just typing in the constant I get 21020 as the return. My understanding of the constants was from Jim helping me figure out a way to determine if the user has hit the up arrow key. Since on a PC it returns on repsonse and on a Mac it returns another. But there is a constant called VK_UP that holds the correct ID if you are on a PC or if you are on a Mac. So instead of comparing the onkey event to a fixednum, I compare it to the VK_UP constant, and its always right on any platform. I would hope that the CMD_ constants would be along the samelines of being initialized fresh each time SU starts and configured correctly for each OS. Is that way off base?
Re: [Code] Tool ID Constants - Rev. 2When I tried tested some of the tool IDs and CMD_ constants they where identical on Mac and PC.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
16 posts
• Page 1 of 1
|
Who is online
Users browsing this forum: AmirBilu and 15 guests