• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Global/Local (component) axis

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 3 Posters 2.7k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    alz
    last edited by alz 17 Mar 2008, 20:33

    I'm trying to create a keystroke (or context menu command) to call the "Show Component Axes" option under Model Info/Components.

    Does anyone know what this is?

    By sorting out the current Axis-related items, I created this reference list:

    Move Global Axes
    desc: moves axis
    key: "Tools/Axes"
    code: { Sketchup.send_action "selectAxisTool:" }

    Toggle Global Axes
    desc: show/hide global axis
    key: "View/Axes"
    code: { Sketchup.send_action "viewShowAxes:" }

    Reset Global Axes
    desc: reset global axis to 0,0,0
    key: "View/Reset axis (World)"
    code: ?

    Context Menu (over global axis):
    - Place= desc: see "Axes tool" above
    - Move= desc: Dialog Box (X,Y,Z)
    ...code: ?
    - Reset= desc: see "Reset Axes" above
    - Align= desc: Top view, centered on global axis
    ...code: ?
    - Hide= desc: see "View Axes" above

    Move Local Axes
    desc: move component axis
    key: "Edit/Item/Change Axes"
    code: ?

    "Toggle Local Axes"
    desc: show component axis (in Model Info/Components)
    key:
    code: ?

    Toggle Edges Axis
    desc: color X,Y,Z axis-aligned edges
    key: "View/Rendering/Edge/By Axis"
    code: ?

    Display Tool Crosshairs
    desc: show/hide Tool crosshairs (in Preferences/Drawing)
    key: "Drawing/Display Crosshairs"
    code: ?

    1 Reply Last reply Reply Quote 0
    • D Offline
      Didier Bur
      last edited by 17 Mar 2008, 21:53

      Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=true
      will display components axes, and guess what
      Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=false
      will do ?

      DB

      1 Reply Last reply Reply Quote 0
      • A Offline
        alz
        last edited by 18 Mar 2008, 00:18

        Thanks Didier!

        I was able to generate a quick test menu for these options with your direction:

        require 'sketchup.rb'
        
        #########################################
        if( not file_loaded?("Menu_Axis.rb") )
        
        ### CONTEXT MENU
        
          UI.add_context_menu_handler do | menu |
            submenuz=menu.add_submenu("Axis...")
            
            submenu01=submenuz.add_item("Move Global Axis") { Sketchup.send_action "selectAxisTool;" }
            submenu02=submenuz.add_item("Toggle Global Axis") { Sketchup.send_action "viewShowAxes;" }
            submenu03=submenuz.add_item("Reset Global Axis ...?") { UI.messagebox("Missing Command!") }
            submenu04=submenuz.add_item("XYZ Global Axis ...?") { UI.messagebox("Missing Command!") }
            submenu05=submenuz.add_item("Align to Global Axis ...?") { UI.messagebox("Missing Command!") }    
        	    submenuz.add_separator
            submenu06=submenuz.add_item("Move Local Axis ...?") { UI.messagebox("Missing Command!") }
            submenu07=submenuz.add_item("Toggle Local Axis") { if Sketchup.active_model.rendering_options["DisplayInstanceAxes"]
                        Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=false
                    else
                        Sketchup.active_model.rendering_options["DisplayInstanceAxes"]=true
                    end }
        	    submenuz.add_separator
            submenu08=submenuz.add_item("Toggle Edge Axis") { if Sketchup.active_model.rendering_options["EdgeColorMode"]
                        Sketchup.active_model.rendering_options["EdgeColorMode"]=1
                    else
                        Sketchup.active_model.rendering_options["EdgeColorMode"]=2
                    end }
            submenu09=submenuz.add_item("Toggle Tool Crosshairs ...?") { UI.messagebox("Missing Command!")  }
        
        
           end #do
        
        end #if
        
        #-----------------------------------------------------------------------------
        file_loaded("Menu_Axis.rb")
        ###
        

        ...although the EdgeColorMode doesn't want to toggle back and forth (hm!)

        I poked through the API, but didn't find anything immediate that suggested the RESET, or TOOL CROSSHAIRS.


        Menu_Axis.rb

        1 Reply Last reply Reply Quote 0
        • D Offline
          Didier Bur
          last edited by 18 Mar 2008, 08:32

          Maybe a "view.invalidate" instruction will refresh the view after edges mode toggle ?

          DB

          1 Reply Last reply Reply Quote 0
          • A Offline
            alz
            last edited by 18 Mar 2008, 20:19

            Hmm, didn't do the trick.

            Looks like I have to code a function that gets the value then checks it before changing it. I thought I could skip this bit (based on the above example for ["DisplayInstanceAxes"]=false/true).

            1 Reply Last reply Reply Quote 0
            • R Offline
              RickW
              last edited by 22 Mar 2008, 19:42

              You have a line near the end of your code:

              if Sketchup.active_model.rendering_options["EdgeColorMode"]
              

              Since that will always return true (non-nil), then it always evaluates the first conditional. That's why it doesn't ever toggle.

              RickW
              [www.smustard.com](http://www.smustard.com)

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                1/6
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement