Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

xml pen-set attribut-number

bimdo
Enthusiast

Hello together

 

Following Use-Case: We want to change the order of our pens in a pen-set. It's possible to change the index of a pen-set directly in the attribute manager, why not the index of pens? Anyway we saved an xml and changed all the indexes and names, then reimport it, nothing happens.

 

Problem: We changed all the indexes, but in the xml the order of all the pens are the same, when we change the order in the xml (physical order) then there's a change in Archicad. Is it true, that Archicad ignores the index completly?

 

Thanks a lot.


06-03-_2023_11-47-15.png

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi,


TL;DR: There are 2 indices. Try to keep them identical to avoid confusion. I've developed an Add-On which might help you: https://www.bschwb.com/add-ons/pen-manager/ But it depends on what you actually want to achieve. More explanation below.


I had a look into your problem in more detail and I think I've figured it out (but still take it with a grain of salt):

There are two different indices!
- One is displayed in the Attribute Manager under the Column '#'. This corresponds to the "physical" ordering in the .xml file you were describing.
- The other one is an internal Index which in the xml is placed in the tag '<Index>'

A small demonstration that hopefully illustrates the point a bit:
1. Export a pen set via the Attribute Manger to an .xml file

2. Reorder the first pen to the 5th 'physical' place but keep the <Index>1</Index> tag.

3. Import the pen set again via the Attribute Manager

4. Using the pen e.g. in the "Wall Settings" shows the two different indices (See annotated screenshot)

To avoid confusion, I would keep the two indices identical all the time. So if you manually reorder the list, I would also change the <Index> tag accordingly.

What my 'Pen-Manager' Add-On does:
When copying one pen to a different pen it keeps both indices of the target pen but changes the Color, Width and Description of the Target Pen!


Screenshot 2023-03-08 090704.png

EXTRA NOTE for Add-On developers:
In the API_PenType the field 'index' stores the internal index, but elements seem to store the 'physical' index (e.g. element.wall.contPen).

I hope this helps!
Bernd

View solution in original post

2 REPLIES 2
Solution

Hi,


TL;DR: There are 2 indices. Try to keep them identical to avoid confusion. I've developed an Add-On which might help you: https://www.bschwb.com/add-ons/pen-manager/ But it depends on what you actually want to achieve. More explanation below.


I had a look into your problem in more detail and I think I've figured it out (but still take it with a grain of salt):

There are two different indices!
- One is displayed in the Attribute Manager under the Column '#'. This corresponds to the "physical" ordering in the .xml file you were describing.
- The other one is an internal Index which in the xml is placed in the tag '<Index>'

A small demonstration that hopefully illustrates the point a bit:
1. Export a pen set via the Attribute Manger to an .xml file

2. Reorder the first pen to the 5th 'physical' place but keep the <Index>1</Index> tag.

3. Import the pen set again via the Attribute Manager

4. Using the pen e.g. in the "Wall Settings" shows the two different indices (See annotated screenshot)

To avoid confusion, I would keep the two indices identical all the time. So if you manually reorder the list, I would also change the <Index> tag accordingly.

What my 'Pen-Manager' Add-On does:
When copying one pen to a different pen it keeps both indices of the target pen but changes the Color, Width and Description of the Target Pen!


Screenshot 2023-03-08 090704.png

EXTRA NOTE for Add-On developers:
In the API_PenType the field 'index' stores the internal index, but elements seem to store the 'physical' index (e.g. element.wall.contPen).

I hope this helps!
Bernd

Thank you Bernd for this really great answer, now I understand it!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!