How to set a dynamic component attribute using the API

Hi all,

I’m trying to mange some dynamic coomponents using the api. The dyn components have some attributes use as input values that I need to set before asking the dyn component instances to redraw. Actually I’am able the set the attribute values but unable to make the dyn component instance to be redrawn using them.

Here is a video exemple below :

  • Step1 | Check the dyn component attribute value using the attribute dictionary.
  • Step2 | Set the dyn component attribute value using the attribute dictionary.
  • Step3 | Confirm the value change in the attribute dictionary but not in the UI although a redraw had been triggered.
  • Step4 | No refresh of the dyn component instance even if a redraw is performed using the api.
  • Step5 | Referesh ok if attribute value set using the UI.

Any ideas ? I sure I’m not doing this the right way.

The DC definition’s “dynamic_attributes” dictionary contains the default values and formulae for ALL instances.

The DC instance’s “dynamic_attributes” dictionary contains ANY overridden dynamic attribute values for that particular instance.

Any nested DC groups have ALL attributes in the group instance’s “dynamic_attributes” dictionary, rather than the group’s definition.

@DanRathbun Perfect that’s working :slight_smile:

That was my first thought but I wasn’t able to find any “dynamic_attributes” dictionary in the instance so I was working in the definition dictionary. But there is an instance “dynamic_attributes” dictionary. Maybe I’m too tired today…

Thanks anyway Dan !

1 Like

We have an extension on EW that let you visual inspect attributes (instance and definition) for selected entities:


same problem here

Then you should use the same solution there… post #2

group_brickbats= entities.add_group“group_brickbats”
face_ =group_brickbats.entities.add_face(circle_)
comp.set_attribute ‘something1’ ,‘something2’, ‘100’

the code runs well but while going to model and checking the attributes, the attributes are not updated in the component
Please do not double post! Anyway this thread is already solved and you opened your own…

1 Like