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

Bulk Layer Change on Folder of Components

Scheduled Pinned Locked Moved Newbie Forum
sketchup
4 Posts 3 Posters 3.3k 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.
  • D Offline
    dgorman3
    last edited by 25 Mar 2021, 15:53

    I have a folder of dozens of components that are on 2 separate layers. I would like to be able to process them to change each layer name to match a new template that I will be using.

    Anyway to do this in bulk without having to edit each one?

    Ex. Layer Name --> New layer name

    02IR - Heads ---> 4.2 IR Heads
    02IR3 - Spray Patterns --> 4.2 Spray Pat
    02IR2 - GPM --> 4.2 IR Heads GPM

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dave R
      last edited by 25 Mar 2021, 16:14

      Do you mean you want to change the names of the tags assigned to the components in your collection? You could insert all of those components into a single model, edit the tag names as desired and then save the components as a new local collection.
      Screenshot - 3_25_2021 , 11_15_47 AM.png

      FWIW, SketchUp doesn't have Layers anymore and nothing in SketchUp was ever put "on" a layer when it did. Layers, and now Tags are given to or put on objects.

      Etaoin Shrdlu

      %

      (THERE'S NO PLACE LIKE)

      G28 X0.0 Y0.0 Z0.0

      M30

      %

      1 Reply Last reply Reply Quote 0
      • T Offline
        TIG Moderator
        last edited by 25 Mar 2021, 16:28

        As Dave R says you could do it manually 'once' and be done, or if you're up to dabbling in Ruby...
        There are several 'batch/bulk' scripts around, e.g. my own
        https://sketchucation.com/pluginstore?pln=TIG-batchpurge
        It'd be relatively straightforward to redo the code to open each of the SKPs in the chosen folder in turn and then instead of purging them, rename layers [tags] based on a look up hash list like this...

        rename_hash={
          "02IR - Heads" => "4.2 IR Heads",
          "02IR3 - Spray Patterns" => "4.2 Spray Pat"
          ### etc
        }
        

        then something like:

        rename_hash.each_pair{|key,value|
          if layer=Sketchup.active_model.layers[key]
            layer.name=value
          end  
        }
        

        Save the SKP and do the next one etc...

        TIG

        1 Reply Last reply Reply Quote 0
        • D Offline
          dgorman3
          last edited by 25 Mar 2021, 16:31

          Awesome! Thanks to both of you! The manual version is immediately helpful as a short term solution, but I really appreciate the discussion of the ruby. That might be incredibly helpful in the future.

          Take care

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

          Advertisement