sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Automatically load a component.

    Scheduled Pinned Locked Moved Developers' Forum
    70 Posts 5 Posters 5.6k Views 5 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      $dc_observers.get_latest_class.methods.sort

      .!
      .!=
      .!~
      .<=>
      .==
      .===
      .=~
      .id
      .send
      .apply_instance_cache
      .apply_relative_move
      .attribute_dictionary_to_json
      .can_be_configured
      .children_have_behaviors
      .chop_quotes
      .class
      .clean_entity_name
      .clean_for_json
      .clean_for_xml
      .clean_up_report_data
      .clear_forced_config_values
      .clear_highlight
      .clear_instance_cache
      .clone
      .clone_attributes
      .close_configure_dialog
      .close_manager_dialog
      .close_reporter_dialog
      .configure_dialog_is_visible
      .convert
      .copy_number_of
      .copyless_name
      .define_singleton_method
      .delete_all_attributes
      .delete_attribute
      .delete_cascading_attribute
      .delete_onclick_state
      .delete_template
      .destroy_highlight_instance
      .determine_movetool_behaviors
      .display
      .display_attribute?
      .dup
      .entity_to_json
      .enum_for
      .eql?
      .equal?
      .escape
      .explode_if_3d_warehouse
      .extend
      .find_entity_by_sheet_name
      .fix_float
      .freeze
      .frozen?
      .generate_report
      .generate_report_string
      .get_attribute_access
      .get_attribute_base_units
      .get_attribute_error
      .get_attribute_formlabel
      .get_attribute_formula
      .get_attribute_formulaunits
      .get_attribute_label
      .get_attribute_list
      .get_attribute_options
      .get_attribute_units
      .get_attribute_value
      .get_cascading_attribute
      .get_classifier_data
      .get_configure_dialog
      .get_decimal_delimiter
      .get_default_authoring_units
      .get_default_units
      .get_definition_attribute
      .get_entity_formula_name
      .get_entity_lengthunits
      .get_forced_config_value
      .get_formula_result
      .get_instance_attribute
      .get_instance_attribute_list
      .get_instance_cache_list
      .get_length_format
      .get_length_unit
      .get_live_value
      .get_nested_attribute
      .get_temp_path
      .get_template_dictionary
      .handle_place_component
      .has_behaviors
      .has_dc_attribute_dictionary
      .has_forced_config_values
      .has_instance_cache
      .has_movetool_behaviors
      .hash
      .inspect
      .instance_eval
      .instance_exec
      .instance_of?
      .instance_variable_defined?
      .instance_variable_get
      .instance_variable_set
      .instance_variables
      .is_3d_warehouse
      .is_a?
      .is_free?
      .is_mac
      .is_online
      .kind_of?
      .make_unique_if_needed
      .manager_dialog_is_visible
      .method
      .methods
      .name_of_copy
      .name_of_entity_is
      .nil?
      .object_id
      .parse_attribute_path
      .parse_formula
      .parse_reference
      .parse_subformula
      .private_methods
      .protected_methods
      .public_method
      .public_methods
      .public_send
      .pull_attribute_tree
      .pull_information
      .pull_selection_ids
      .push_attribute_set
      .query_to_hash
      .read_templates
      .redraw
      .redraw_with_undo
      .refresh_configure_dialog
      .refresh_dialogs
      .refresh_manager_dialog
      .refresh_thumbnails
      .remove_instance_variable
      .rename_attribute
      .replace_formula_references
      .reporter_dialog_is_visible
      .reset_last_highlight
      .respond_to?
      .run_all_formulas
      .run_facearea_formulas
      .run_formula
      .save_configure_thumbnail
      .save_report
      .save_report_to_file
      .second_if_empty
      .second_if_nan
      .send
      .set_attribute
      .set_attribute_error
      .set_attribute_formula
      .set_dialog_properties
      .set_forced_config_value
      .set_nested_attribute
      .show_configure_dialog
      .show_dialog
      .show_dialog_orig
      .show_manager_dialog
      .show_reporter_dialog
      .singleton_class
      .singleton_methods
      .store_instance_cache
      .store_instance_cache_attribute
      .store_nominal_size
      .strip_operator
      .swap_component
      .taint
      .tainted?
      .tap
      .to_enum
      .to_json
      .to_s
      .translate
      .trust
      .unescape
      .untaint
      .untrust
      .untrusted?
      .update_last_sizes
      .update_template
      .url_escape
      .url_unescape

      TIG

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Sketchup.active_model.select_tool(DCInteractTool.new($dc_observers))

        Perhaps ?

        TIG

        1 Reply Last reply Reply Quote 0
        • TNTDAVIDT Offline
          TNTDAVID
          last edited by

          TIG thank you for having brought clarity! 😉

          I will try to pass the exam of the extension warehouse with the "$" symbol.

          @tig said:

          The obvious candidate for closing it is...
          $dc_observers.get_latest_class.close_configure_dialog

          The closing code of the window components options, works fine. 👍

          @tig said:

          $dc_observers.get_latest_class.methods.sort
          prints a long list of ALL methods accessed by that DC class's function...

          I tried all the methods, but none can activate the tool "Interact with Dynamic Components". 😲

          Do you know how to activate this tool?

          For information, here the line of code to open the reports window:

          $Dc_observers.get_latest_class.show_reporter_dialog

          To see all of the methods, this code also works:

          $Dc_observers.get_latest_class.methods

          Thank you

          [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

          1 Reply Last reply Reply Quote 0
          • TNTDAVIDT Offline
            TNTDAVID
            last edited by

            Component Option

            result = Sketchup.send_action 50168

            Component Attribute

            result = Sketchup.send_action 50170

            Do not ask me how I found the ID, because you will not believe me. 💚


            Edit : I just noticed that the ID of the toolbar "Dynamic Component" is random and changes each computer.

            I must again begin my research. 😢

            [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

            1 Reply Last reply Reply Quote 0
            • TNTDAVIDT Offline
              TNTDAVID
              last edited by

              To turn the tool "Interact with the Dynamic Component", it is very easy:

              result = Sketchup.send_action 50167

              As against the "Component Options" is much more difficult!

              Someone has a solution? 😲

              Thank you

              [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

              1 Reply Last reply Reply Quote 0
              • TNTDAVIDT Offline
                TNTDAVID
                last edited by

                @tig said:

                Please don't capitalize code inappropriately, it can break it.

                Sorry, this is due to my translator and my lack of attention!
                I edited several of my messages to correct these silly mistakes.

                @tig said:

                Sketchup.active_model.select_tool(DCInteractTool.new($dc_observers))

                Wooow gorgeous, this code it works great!

                How did you find this solution?

                I have some beginner questions:

                1 - How to activate several actions if a condition is met?

                Example:

                	  if new_layer.visible?
                	  puts new_layer.visible = false # action 1A
                	  puts Sketchup.send_action "selectSelectionTool;" # action 2A
                	  elsif
                	  puts new_layer.visible = true # action 1B
                	  puts Sketchup.active_model.select_tool(DCInteractTool.new($dc_observers)) # action 2B
                	  end
                

                Two "puts", it does not work!
                Is there a way to acomplire both A shares, if the layer is visible or both B shares, otherwise?

                2 - How to check if a tool is selected?

                For example :

                Sketchup.active_model.select_tool (DCInteractTool.new ($ dc_observers))

                3 - How to check if an " Existing " layer is visible?

                For example:

                The layer, "Click-Window 3D".

                In advance, thank you for your answers.

                [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  1. I messed on until I found some DC related code that worked - it was NOT simple...
                  2. Try this alternative...
                   puts vis = new_layer.visible?
                  if vis # 'true' = visible so we switch it off...
                    new_layer.visible = false # action 1A
                    puts Sketchup.send_action("selectSelectionTool;") # action 2A
                  elsif # 'false' = not visible so we switch it on...
                   new_layer.visible = true # action 1B
                   puts Sketchup.active_model.select_tool(DCInteractTool.new($dc_observers)) # action 2B
                  end
                  

                  It should return true OR false, then toggle the layer's visibility on/off, and exit to the select-tool or interact-tool as appropriate.
                  2. You could get the active_tool... BUT if it's Ruby based, just that - not it's name...
                  3. layer = Sketchup.active_model.layers.add("Click-Window 3D") sets layer to be the layer of that given name, and it makes it IF it doesn't already exist.
                  Then use
                  vis = layer.visible?
                  which as we have seen in 1. above vis returns true or false...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • TNTDAVIDT Offline
                    TNTDAVID
                    last edited by

                    @tig said:

                    puts vis = new_layer.visible?
                    if vis # 'true' = visible so we switch it off...
                      new_layer.visible = false # action 1A
                      puts Sketchup.send_action("selectSelectionTool:") # action 2A
                    elsif # 'false' = not visible so we switch it on...
                     new_layer.visible = true # action 1B
                     puts Sketchup.active_model.select_tool(DCInteractTool.new($dc_observers)) # action 2B
                    end

                    TIG thank you, your code works very well! 👍

                    Out of curiosity, I tested variants to see if I could simplify your example.

                    I finally found it:

                    
                       if new_layer.visible?
                          new_layer.visible = false 
                          Sketchup.send_action("selectSelectionTool;")
                          elsif
                          new_layer.visible = true 
                          Sketchup.active_model.select_tool(DCInteractTool.new($dc_observers))
                          end
                    

                    The error in my first example is:

                    puts new_layer.visible = false

                    You just had to remove the "puts", which does not work with "=".

                    Through your example, I found my main mistake. 😉

                    1.For another tool, such as "Move", how to tell if it is selected?

                    2.Even if the existing layer is, we are forced to use the "layers.add" method, to know whether the layer is visible?

                    3.If the layer exists, layers.add replaces the layer or it is ignored?


                    Come on we will move to supperior level. 😄

                    In the sample code below, we will add 2 attributes to a component box.

                    The first defined a color for the "Material" attribute.

                    The second adds a fonctione "REDRAW" to attribute "Onclick".

                    Here is the example GIF:

                    http://i.imgur.com/OTo1eLw.gif

                    Here's the code:

                    UI.menu("Plugins").add_item('MyBox Red') {
                    	  
                          sang = Sketchup.active_model
                          sang_definition = sang.definitions
                          sang_def = sang_definition['box']
                    	  
                          sang_def.set_attribute 'dynamic_attributes','material', 'red' 
                          sang_def.set_attribute 'dynamic_attributes','_material_formula', '"red"'
                    
                          sang_def.set_attribute 'dynamic_attributes','onclick', 'REDRAW()'
                          sang_def.set_attribute 'dynamic_attributes','_onclick_formula', '"REDRAW()"'
                    	  
                          dcs = $dc_observers.get_latest_class
                          dcs.redraw_with_undo(sang_def) 
                          }
                    

                    The "REDRAW" in OnClick, is the best way I've found to redraw the attributes of my component.

                    To redraw a dynamic component in ruby, I found this code written by DanRathbun in this forum:

                    def recalc_dc(inst)
                    return nil unless defined?(DCObservers)
                    if inst.is_a?(Sketchup;;ComponentInstance) &&
                    inst.attribute_dictionary('dynamic_attributes')
                    if @dc_observers.nil?
                    ObjectSpace.each_object(DCObservers) {|o| break @dc_observers = o }
                    end
                    return nil unless @dc_observers.respond_to?(;get_latest_class)
                    latest_dc_class = @dc_observers.get_latest_class
                    return nil unless latest_dc_class.respond_to?(;redraw_with_undo)
                    latest_dc_class.redraw_with_undo(inst)
                    end
                    nil # (there is no particular return value)
                    end
                    

                    4.How to use the code of DanRathbunwith my example?

                    5. How to integrate my code in a method?

                    I tried this:

                    def Mybox
                          sang = Sketchup.active_model
                          sang_definition = sang.definitions
                          sang_def = sang_definition['box']
                    	  
                          sang_def.set_attribute 'dynamic_attributes','material', 'red' 
                          sang_def.set_attribute 'dynamic_attributes','_material_formula', '"red"'
                    
                          sang_def.set_attribute 'dynamic_attributes','onclick', 'REDRAW()'
                          sang_def.set_attribute 'dynamic_attributes','_onclick_formula', '"REDRAW()"'
                    	  
                          dcs = $dc_observers.get_latest_class
                          dcs.redraw_with_undo(sang_def)
                          end	
                    

                    But it does not work!

                    Thank you in advance for your help.

                    PS: We are on a completely different subject, is it a good idea to open a new topic?

                    [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

                    1 Reply Last reply Reply Quote 0
                    • TIGT Offline
                      TIG Moderator
                      last edited by

                      1. The active_tool etc should spot 'Move', but why do you need to find it ?

                      2. You do not need to use the layer = layers.add("layer_name") method, BUT it is a simple way to either add a new layer by that name, and get a reference to it, OR, if it already exists then it returns a reference to that existing layer...

                      3. See 2. above - that does NOT 'replace' the layer, it simply returns a reference to that layer by name - either if it's newly made, or it's preexisting...

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • TNTDAVIDT Offline
                        TNTDAVID
                        last edited by

                        @tig said:

                        1. Le active_tool etc devrait repérer 'Move', mais pourquoi avez - vous besoin de le trouver?

                        For my general culture ruby script. 💚

                        I have the same question but an icon from my toolbar:

                        I need to check or uncheck a icon!

                        1. If the icon in "command18" and is checked, the icon "command17" is automatically unchecked.

                        We see the example in the SketchUp toolbar "styles".

                        2. I want to check the icon of the "command1" with the first click, then uncheck the 2nd click. And so on ...

                        Here is my code:

                              command17 = UI;;Command.new("Opens Settings Panel"){ CW_Pro_mm.panel }
                        
                              command17.small_icon = File.join(@@path_to_resources,"add_17.png")
                        
                              command17.large_icon = File.join(@@path_to_resources,"add_17.png")
                        
                              command17.tooltip = %Q(Opens Settings Panel)
                        
                              command17.status_bar_text = %Q(Opens Settings Panel)
                        
                              command17.menu_text = %Q(Opens Settings Panel)
                        	  
                              command17.set_validation_proc {
                        	  
                              if Sketchup.active_model # ..... ???
                              MF_ENABLED
                              else
                              MF_CHECKED
                              end
                             }
                        

                        Thank you for your help.

                        David

                        [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

                        1 Reply Last reply Reply Quote 0
                        • TNTDAVIDT Offline
                          TNTDAVID
                          last edited by

                          I'm looking everywhere, I can not find a solution.

                          Like my icons have no name, should I use the method in my code?

                          By exeple:

                          if Sketchup.active_model.selection.panel?

                          Reminder, I wish to know the code to verify if my icon " command17 " which call the " panel " method, is "on" or "off"?

                          It is certainly not difficult, but I find the answer anywhere. 😲

                          I need your helps.

                          Thank you

                          [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

                          1 Reply Last reply Reply Quote 0
                          • TIGT Offline
                            TIG Moderator
                            last edited by

                            You are muddling up functions and methods again.
                            The ' selection' has no method .panel?

                            I don't quite understand your terminology or what it is you hope to achieve.

                            If you have a toolbar with let's say two buttons and you want only one to be enabled at a time...
                            You have already found the set_validation_proc method...
                            http://www.sketchup.com/intl/en/developer/docs/ourdoc/command#set_validation_proc
                            In the example in the API usage it checks:
                            if Sketchup.active_model.selection.length == 0
                            i.e. that nothing is selected.
                            If so, then it disables that command, otherwise it is enabled...
                            This works in menus and toolbars alike...

                            To make a working example of this make your two commands and add set_validation_proc code to each command, make the test a simple one like if something is selected in the model [as in the API example] but reverse the logic in the second command...
                            there are several ways to do that...
                            The if becomes unless or if ! or if not, OR change the test from == 0 to != 0

                            This way your menu/toolbar buttons are enabled/disabled depending on a selection...
                            You can of course make lots of different tests, what is it you need ??

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • TNTDAVIDT Offline
                              TNTDAVID
                              last edited by

                              I do not want to enable or disable a button, depending on a selection in the model.

                              I want to enable or disable a button, depending on the selection of another button.

                              Example Image:

                              http://i.imgur.com/Q3gE9pf.gif

                              [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

                              1 Reply Last reply Reply Quote 0
                              • TIGT Offline
                                TIG Moderator
                                last edited by

                                You have started another thread and I've replied there.
                                I know you do not want to trigger it depending on a selection - I just used that as an example...
                                In the example you show the other buttons are not disabled.
                                When one is active it's shown 'depressed', when another is click that takes the focus and appears depressed.
                                It the other buttons were actually 'disabled', then they would not be clickable and you'd never get out of the first clicked button's state !

                                TIG

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

                                Advertisement