Plugin for adding Dynamic Components attributes automatically

Hi, first time posting on the forums. I hope somebody has a solution to this problem.

For my work we use a lot of standard components that have dynamic components attributes so you can select the fixings required. For example on a certain bracket we use a drop down list to select ‘M12 x50mm bolt’. We then use the ‘generate report’ feature to collate the total number of bolts etc. required for the project.

The problem occurs when we design bespoke brackets in Solidworks and import them as STLs. It takes too much time to add dynamic component attributes manually to each one.

Is there a plugin or some ruby script to mass add a group of attributes to a component easily? They would be the same attributes every time.

It would be great to hear if someone has a solution to this!

Thanks.

Perhaps:

SketchUp Plugins SJ Add DC Attribute | PluginStore | SketchUcation

4 Likes

Hello
I have developed and shared a plugin named SJ Add DC Attribute.
It allows you to create, copy attributes of dynamic components from a list of favorites or from a source component.
You can consult the documentation and download it on my website
https://sketchup.simjoubert.com/my-plugins/sj-add-dc-attribute.html

or on Sketchucation plugin store
https://sketchucation.com/plugin/2537-sjadddcattribute

Thank you for your feedback

5 Likes

Thanks for your reply Simon. Your plugin is exactly what I was after! Thanks so much for developing that.

Just a couple of suggestions/questions:

  • Would it be possible to select all ‘favorite’ attributes so that you can add them in one go, rather than clicking add individually.? (I’ve got 10+ attributes to add)

  • Is it possible to save favorite attributes so they transfer between skp models?

Thanks again :slight_smile: !

John

1 Like

Hi! Why it shows nothing? :grimacing: Sketchup 2022

Hello Ivaaannnnnn

You need to tell me a little more so that I can help you.

To work, the plugin needs components to be selected before launching the plugin.
Has the plugin ever worked on your installation or is it bugged only for this session? This model ? This component?

Version 3.2 does not support being installed in a folder other than the standard SketchUp plugins folder. The next version will fix this

Simon

Sorry,

this is the first running of your extension. I just installed it using the Extension Manager.
Yes, I select a component firstly, then push the component’s button.

For me it does not work with any of components.

I see you are on MAC.
I couldn’t test the plugin on this platform due to lack of hardware, but you’re the first to report such a bug.

Can you do the following procedure:

  • Close the plugin window
  • Open the Ruby Console
  • Past the following code :
    SimJoubert::SJ_Add_DC_Attribute::SESSION[:showputs]=true
  • Select your component
  • Launch the plugin
  • And send me the text that is displayed in the console
`**************************************************************
***************************** CONSOLE AD DC Attribut *********
**************************************************************


SELECTION COLLECTION 
 collection = [#<Sketchup::ComponentInstance:0x000000013b2953d8>]


***************************** START AD DC Attribut *********

COLLECTE 
L'unité du modèle length_units = "INCHES"

 Collecte des définitions dans la sélection => listeAttributsDefinitions = "[{\"name\":\"СБ:Стойка угловая\",\"attributs\":[{\"label\":\"onClick\",\"state1\":3,\"name\":\"onclick\",\"formulaunits\":\"STRING\",\"value\":\"ANIMATE(\\\"RotZ\\\",0,90,180,270)\"}]}]"

 Collecte des favoris => listeAttributsFavoris = []

 Collecte des préférences d'affichages des infobulles => preferenceInfobulle = true

 Initialisation de la liste des attributs => listeAttributs = []
On récupère la langue de Sketchup => langue = "ru"
# L'unité du modèle => length_units = "INCHES"


INITIALISTAION DE LA BOITE DE DIALOGUE

# Javascript à exécuter une fois la boîte de dialogue affichée => 
 js = "Simjoubert.listeAttributsDefinitions = [{\"name\":\"СБ:Стойка угловая\",\"attributs\":[{\"label\":\"onClick\",\"state1\":3,\"name\":\"onclick\",\"formulaunits\":\"STRING\",\"value\":\"ANIMATE(\\\"RotZ\\\",0,90,180,270)\"}]}];\n      Simjoubert.listeAttributsFavoris = [];\n      Simjoubert.listeAttributs = [] ;\n      Simjoubert.version = '0.3.3';\n      Simjoubert.showtooltips = true;\n      Simjoubert.lenght_units = '';\n      Simjoubert.traduction('ru');"

# URL du fichier HTML => url = "/Users/ivan/Library/Application Support/SketchUp 2022/SketchUp/Plugins/sj_Add_DC_Attribute/html/DialogueAddDCAttribut.html"


OUVERTURE BOITE DE DIALOGUE
`

but in real the model is in CM (metric units)

Hello Ivan
Have you tried on a selection with another component, another component in another model?
Do you have several open models?
The report looks correct!
Can you check if the HTML file whose URL appears in the report exists on your machine.

Hello!
Yes, I tried with another components in different models. - the same.
I tried with only one simple new model.
Yes, it has HTML file on those folders.

Hello Ivan
Can you do a right clic on the blank dialog that appear and click on the option dev tools to see if there somme JavaScript error.

how to get this “option dev tool”? :person_shrugging:

To show dev tools
Right click on the dialog box
SketchUp_7TYeqOlzXf

1 Like

I see, but I haven’t any menu on right (or left) click on the empty field. And by the way I have only one button on the extension pallet.

Good evening Ivan
I can’t figure out what’s wrong.
I suggest you uninstall and reinstall the plugin with a reboot in between.
The other buttons on the toolbar are other features that are still in testing and not released

What is your OS version and Sketchup version ?

Not 100% sure if this is the problem, but I know when I am working with Dynamic Components that are inserted in from outside the active drawing, they are placed in a Component Container. In order to edit the DC you need to either go into the “Insert Container”, or Explode the “Insert Container” to have your DC is the first level of selection.