• Login
sketchucation logo sketchucation
  • Login
πŸ”Œ Quick Selection | Try Didier Bur's reworked classic extension that supercharges selections in SketchUp Download

Kill dynamic components?

Scheduled Pinned Locked Moved SketchUp Discussions
sketchup
14 Posts 9 Posters 3.8k Views 9 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.
  • M Offline
    Marron
    last edited by 7 Oct 2011, 09:15

    How do I make a dynamic component non dynamic. Sometimes I want to make some changes in the dynamic component, but the "settings" of the groups make the components unmovable. For example move the legs of a table to another position. I want to keep the groups of the object that the dynamic component exists of, but clear all settings.

    Thanks in advance.

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 7 Oct 2011, 09:39

      This one-liner copy+paste+<enter> in the Ruby Console will stop a selected DC from being dynamic

      Sketchup.active_model.selection[0].definition.attribute_dictionaries.delete('dynamic_attributes')
      

      use wisely... 😲

      TIG

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by 7 Oct 2011, 21:11

        I have a plugin that can "strip DC attributes", optionally delete sub-components which are hidden, and reset the scale mask. I wrote it for a business that uses DC's internally but wanted to protect their IP and reduce file size before making their models public. I have been meaning to get it posted.

        Hi

        1 Reply Last reply Reply Quote 0
        • A Offline
          Anssi
          last edited by 8 Oct 2011, 21:03

          How about exploding and immediately creating a new component?

          Another way is to insert the DC in a new model, save it and import that. The DC attributes won't be usable until you explode the component once. Exploiting a common error with DCs.

          Anssi

          securi adversus homines, securi adversus deos rem difficillimam adsecuti sunt, ut illis ne voto quidem opus esset

          1 Reply Last reply Reply Quote 0
          • M Offline
            Marron
            last edited by 11 Oct 2011, 08:21

            @jim said:

            I have a plugin that can "strip DC attributes", optionally delete sub-components which are hidden, and reset the scale mask. I wrote it for a business that uses DC's internally but wanted to protect their IP and reduce file size before making their models public. I have been meaning to get it posted.

            I'm very interested, could you send it to me in some way? πŸ˜ƒ

            1 Reply Last reply Reply Quote 0
            • M Offline
              Marron
              last edited by 11 Oct 2011, 08:26

              @tig said:

              This one-liner copy+paste+<enter> in the Ruby Console will stop a selected DC from being dynamic

              Sketchup.active_model.selection[0].definition.attribute_dictionaries.delete('dynamic_attributes')
              

              use wisely... 😲

              Hm, yes it worked. But I want to keep the groups in the component. Now I get the same problem as when exploding the component as many times as possible and then making a new component.
              Thanks anyway πŸ˜ƒ

              1 Reply Last reply Reply Quote 0
              • C Offline
                Chris Fullmer
                last edited by 11 Oct 2011, 08:32

                You asked to "kill dynamic components" - thats what his one line script does.

                So what do you REALLY want to do?

                Lately you've been tan, suspicious for the winter.
                All my Plugins I've written

                1 Reply Last reply Reply Quote 0
                • M Offline
                  Marron
                  last edited by 11 Oct 2011, 09:24

                  @chris fullmer said:

                  You asked to "kill dynamic components" - thats what his one line script does.

                  So what do you REALLY want to do?

                  In my first post I wrote: "I want to keep the groups of the object that the dynamic component exists of, but clear all settings."

                  I just want the component attributes to be cleared. But I want to keep the groups in the component.

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    TIG Moderator
                    last edited by 11 Oct 2011, 11:27

                    Sketchup.active_model.selection[0].definition.attribute_dictionaries.delete('dynamic_attributes')
                    

                    just stops the selected DC from being a DC!
                    If you have nested DC's within a DC you'll need to run the tool recursively like this

                    def dck(c);c.definition.attribute_dictionaries.delete('dynamic_attributes');c.entities.each{|e|dck(e)if e.class==Sketchup;;ComponentInstance};end;dck(Sketchup.active_model.selection[0])if e.class==Sketchup;;ComponentInstance
                    

                    where the method 'dck' is the 'dc_killer' applied to a selected component AND all of its nested DCs down to any depth... use with care

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      skavan
                      last edited by 13 Jan 2015, 06:17

                      @jim said:

                      I have a plugin that can "strip DC attributes", optionally delete sub-components which are hidden, and reset the scale mask. I wrote it for a business that uses DC's internally but wanted to protect their IP and reduce file size before making their models public. I have been meaning to get it posted.

                      Hi, I know this was a while ago - but any chance I could snag the plugin you reference? Thanks.

                      s.

                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        skavan
                        last edited by 13 Jan 2015, 06:20

                        @tig said:

                        Sketchup.active_model.selection[0].definition.attribute_dictionaries.delete('dynamic_attributes')
                        

                        just stops the selected DC from being a DC!

                        If you have nested DC's within a DC you'll need to run the tool recursively like this

                        def dck(c);c.definition.attribute_dictionaries.delete('dynamic_attributes');c.entities.each{|e|dck(e)if e.class==Sketchup;;ComponentInstance};end;dck(Sketchup.active_model.selection[0])if e.class==Sketchup;;ComponentInstance
                        

                        where the method 'dck' is the 'dc_killer' applied to a selected component AND all of its nested DCs down to any depth... use with care

                        I tried pasting this into the ruby editor - but it didn't work 😞

                        "Error: #<NameError: undefined local variable or method `e' for main:Object>"

                        I'm in SU15. The single line top-level version did work....but I'm really trying to zap the tree.

                        s.

                        1 Reply Last reply Reply Quote 0
                        • halroachH Offline
                          halroach
                          last edited by 6 Apr 2016, 12:06

                          @skavan said:

                          I tried pasting this into the ruby editor - but it didn't work 😞

                          "Error: #<NameError: undefined local variable or method `e' for main:Object>"

                          I'm in SU15. The single line top-level version did work....but I'm really trying to zap the tree.

                          s.

                          I'm getting the same error. Ideas?

                          FlexTools - Super Quick Windows, Doors, Slats...

                          1 Reply Last reply Reply Quote 0
                          • sdmitchS Offline
                            sdmitch
                            last edited by 6 Apr 2016, 16:18

                            @halroach said:

                            @skavan said:

                            I tried pasting this into the ruby editor - but it didn't work 😞

                            "Error: #<NameError: undefined local variable or method `e' for main:Object>"

                            I'm in SU15. The single line top-level version did work....but I'm really trying to zap the tree.

                            s.

                            I'm getting the same error. Ideas?

                            Try

                            def dck(c);c.definition.attribute_dictionaries.delete('dynamic_attributes');c.definition.entities.each{|e|dck(e)if e.class==Sketchup;;ComponentInstance};end;dck(Sketchup.active_model.selection[0])
                            

                            after selecting the dynamic component.

                            Nothing is worthless, it can always be used as a bad example.

                            http://sdmitch.blogspot.com/

                            1 Reply Last reply Reply Quote 0
                            • O Offline
                              Oly80
                              last edited by 26 Jun 2017, 15:15

                              I'm not sure what other aspects of sketchup may be lost?...But saving as sketchup version 6 or below removes dynamic attributes, retaining the component and sub components.

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

                              Advertisement