Engineering System Design

 View Only

 Adding a struct member at a certain position

Alexander Boettger's profile image
Alexander Boettger posted Thu September 18, 2025 02:15 AM

Hello,

I am using Rhapsody 9.0.1 and am trying to identify padding in C structures via the Java API and then insert placeholder variables at exactly these positions. Using the following command, I managed to create a structure element and append it at the end.

IRPAttribute paddingAttr = structureType.addAttribute("Padding");

However, I cannot find an interface in the API documentation for inserting an element at a specific index or for changing the order of the elements afterwards. Am I overlooking something, or is this simply not possible via the API?

Andy Lapping's profile image
Andy Lapping IBM Champion

Hi Alex - you'll have to remove them all and re-add them in the order you want. Same for tags with multiplicity

Alexander Boettger's profile image
Alexander Boettger

Hi Andy,

Many thanks for your reply. The famous Andy Lapping from Merlin's Cave – I feel honoured. ;)
The proposed solution sounds rather cumbersome and may be applicable for simple structures. However, I am dealing with complex structures that have substructures, which in turn have substructures. Padding can be hidden at all levels. But if this is the way (as the Mandalorian says), I'll have to live with it.

BR Alex