sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    Append character to component/s selection

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    13 Posts 4 Posters 1.0k Views 4 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.
    • JQLJ Offline
      JQL
      last edited by

      You're right...Sorry...

      What I use to do is add a number suffix or allow it to assign the definition numbers automatically.

      www.casca.pt
      Visit us on facebook!

      1 Reply Last reply Reply Quote 0
      • JQLJ Offline
        JQL
        last edited by

        Suggestion:

        Shouldn't your convention be letters on the prefix and #N numbers on the suffix?

        This way, you're sticking to Sketchup convention and making an unique component will work...

        www.casca.pt
        Visit us on facebook!

        1 Reply Last reply Reply Quote 0
        • Rich O BrienR Offline
          Rich O Brien Moderator
          last edited by

          It's for a grass pack I have and it has grass species with the blades cut, uncut and withered

          us-grass-690.png

          So to signify the difference in appearance the component will be suffixed with w for withered and c for cut.

          [edg3d:ihg61x36]QxaupfdO8Mt4ZJE[/edg3d:ihg61x36]

          Download the free D'oh Book for SketchUp πŸ“–

          1 Reply Last reply Reply Quote 0
          • JQLJ Offline
            JQL
            last edited by

            They're looking really nice and judging from your vegetation output they should render fast.

            My real question is... what is the Font type you used on the ad? I really like it!

            www.casca.pt
            Visit us on facebook!

            1 Reply Last reply Reply Quote 0
            • Rich O BrienR Offline
              Rich O Brien Moderator
              last edited by

              I think it's Raleway. Need to check though.

              Download the free D'oh Book for SketchUp πŸ“–

              1 Reply Last reply Reply Quote 0
              • sdmitchS Offline
                sdmitch
                last edited by

                @rich o brien said:

                I need to append a character to a selection of components each with a different name.

                eg - name-01 to become name-01w

                this would need to happen to all the components I've selected. Anyone know of a tool that does this?

                Are we talking Instance name or Definition name? If you change the definition name before making the instance unique, you change it for all instances if they are selected or not.

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

                http://sdmitch.blogspot.com/

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

                  A simple one liner copy/pasted+<enter> in the Ruby Console would do this in a trice.

                  I assume you are wanting to rename the component-definitions rather than the instances [these can have separate names], and that you want to rename all definitions in the model [it could also be done on just those selected too see below].

                  Edit the x="" part to the character[s] you want to add onto the name e.g. W or -W or -something_witty...

                  For all definitions in the model

                  x="W";Sketchup.active_model.definitions.each{|d|next if d.image?||d.group?;d.name=d.name+x}
                  

                  For selected definitions only...

                  x="W";s=[];Sketchup.active_model.selection.grep(Sketchup;;ComponentInstance).each{|i|s<<i.definition};s.uniq.each{|d|d.name=d.name+x}
                  

                  You can rename instances in a similar way...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • Rich O BrienR Offline
                    Rich O Brien Moderator
                    last edited by

                    Are we talking Instance name or Definition name? If you change the definition name before making the instance unique, you change it for all instances if they are selected or not.[/quote]

                    Hi Sam,

                    I need a global name change so all instances inherit the suffix.

                    Download the free D'oh Book for SketchUp πŸ“–

                    1 Reply Last reply Reply Quote 0
                    • sdmitchS Offline
                      sdmitch
                      last edited by

                      @rich o brien said:

                      @unknownuser said:

                      Are we talking Instance name or Definition name? If you change the definition name before making the instance unique, you change it for all instances if they are selected or not.

                      Hi Sam,

                      I need a global name change so all instances inherit the suffix.

                      That being the case, perhaps this will work for you

                      mod = Sketchup.active_model
                      sel = mod.selection
                      pos = "W"; whr = "Suffix"
                      val = UI.inputbox(["Add;","  As;"],[pos,whr],[nil,"Prefix|Suffix"],"Rename Definitions")
                      if val
                        pos,whr = val
                        cis =sel.grep(Sketchup;;ComponentInstance);cdn = [];
                        cis.each{|ci|
                          next if cdn.include?(ci.definition.name)
                          ci.definition.name = pos + ci.definition.name if whr=="Prefix"
                          ci.definition.name += pos if whr=="Suffix"
                          cdn << ci.definition.name
                        }
                      end
                      
                      

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

                      http://sdmitch.blogspot.com/

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

                        Each definition has a unique name.
                        Editable in the Component Browser etc...
                        A definition can have one or more instances placed in the model.
                        If you use 'make_unique' on one [or more] of several instances, then the instance[s] gets a new definition, duplicated from the original, with its name getting an incrementing suffix auto-appended - e.g. 'widget' becomes 'widget#1'...
                        Any instance can also have its own individual name [set in Entity Info] - these instance-names are not directly connected to their definition's name.
                        Unlike definitions instance-names can be repeated and shared by several instances, and even instances of different definitions !

                        TIG

                        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