Component attributes using Ruby

How to add attributes in a component using Ruby. Though I added in component but it is not updated

Are you trying to add an attribute for your own use, or for a Dynamic Component? They both use the attribute dictionary properties of objects, though the latter requires specific dictionaries and formats.

1 Like

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

here everything works fine while running but when going to model component attributes : the attribute is not added…###

Would you please edit your post according to:

Can you please explain it how and what are you checking?

when you use:


…the comp variable is a componentInstance. Therefore you set the attributes of that instance.
Are you checking the instance or its definition ?

I meant to say I run the code , then a cylinder is drawn successfully , I right clicked on the compoennt ,went to dynamic components> component attributes , but the attributes have not been updated

Setting an attribute does not mean that it will be a Dynamic Component.

Dynamic Components is a “similar” extension than the other user created one. It is using its special dynamic_attributes. So unless you set that you will not see in the Dynamic Components extension user interface.

Dealing with Dynamic Components is something different…Please check again my first post in this topic.

PS: Since the Dynamic Components code is not public you have to know (examine) about its attributes before you can deal with them.

1 Like

Yes, but we can understand Bikal’s confusion as the Dynamic Component dialogs are captioned simply “Component Options” and “Component Attributes”.

Sure. I tried to explain …
( Do you think “my style” was offensive or annoying…? It was not intentional… :blush:)

1 Like

No. Simple, straightforward, and matter of fact.