• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

How to automatically set the attribute?

Scheduled Pinned Locked Moved Dynamic Components
sketchup
2 Posts 2 Posters 5.9k Views
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.
  • K Offline
    kostiaarh
    last edited by 2 Mar 2019, 22:31

    Hello.
    I often use the "Rename by Layer" plugin and would like to change my DC for this. How to automatically set the attribute AAA_Name name Instance? Is it possible? I hope from the picture you will understand. Sorry for my English.


    222.JPG

    1 Reply Last reply Reply Quote 0
    • P Offline
      pcmoor
      last edited by 3 Mar 2019, 04:40

      =_name returns the original component definition name, there is no instance name, I believe its part of a different definition set, you can see it when inspecting "drawing elements"

      Capture.jpg
      there is no DC way of getting the instance name, only viewing it in both the option dialog title and the attribute dialog header provided the name attribute is not used.
      Capture 2.JPG
      however you could use a script

        sel = Sketchup.active_model.selection 
          
          sel.grep(Sketchup;;ComponentInstance).each do |s|
              s.set_attribute "dynamic_attributes","aname",s.name 
              $dc_observers.get_latest_class.redraw_with_undo(s)
          end
      
      

      I use toolbar editor to store and run such scripts. In that you can create a button and assign the script.

      You then include "aname" or an attribute of your choosing an create other formula / relationships for your data, reports....

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

      Advertisement