How to automatically set the attribute?

How to automatically set the attribute?

Postby kostiaarh » Sat Mar 02, 2019 11:31 pm

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.
0

kostiaarh 
 

Re: How to automatically set the attribute?

Postby pcmoor » Sun Mar 03, 2019 5:40 am

=_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

Code: Select all
  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....
0

pcmoor 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Dynamic Components

Who is online

Users browsing this forum: No registered users and 6 guests

Visit our sponsors: