cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Project data & BIM
About BIM-based management of attributes, schedules, templates, favorites, hotlinks, projects in general, quality assurance, etc.
SOLVED!

How to reindex attributes (best practice)

Sam Karli
Advocate

Hi,

I'm about to work on a new template file, essentially by decimating/simpifying an old one (and later growing it).

My problem is that i can remove attributes that I don't need but cannot reindex so that there shouldn't be any gaps between them.

If i reindex them using the Attribute Manager (> Append to temp/Delete all/< Add by index) then the inedexes will be OK but the relations between the attributes will be lost (like a composite will reference a bad fill etc; not mentioning the Favorites).

 

Is there a method with I can reindex while not loosing the references?

 

Thanks in advance.

GDL/Python/C++ dev
16 REPLIES 16

Absolutely,

so I purge out the whole (template) project file, having only one attribute per type (only the ArchiCAD layer etc) and build up everything from scratch, manually maintaining/reproducing everything that ArhchiCAD does normally (including the favorites, graphic overrides, etc).

Painful at once but saves repetitive work for later times.

Yes, it would be better to write a C++ addon but that would take more time (not mentioning following ArchiCAD's version changes). 

GDL/Python/C++ dev

Reindexing means pressing the Reindex... button (many-many times).

I guess in Your approach it is a reassigning, and I do a redefining instead.

GDL/Python/C++ dev

If you are creating a brand new template from scratch where you don't want it to be (copy & paste) compatible with any other file, then I guess it does not matter how you create your attributes.

Create them one by one and they will increment in the attribute number (assuming you one attribute is set as number one).

Or create XML files that can create the attributes for you (I have never played with this, so I am unsure how that will go).

 

Personally I would use the default template as a base.

Create one attribute of each type and re-index it so the attribute number is much ( a few hundred or 1000) higher.

 

Delete the attributes you don't need or maybe re-name them to suit your needs better - but keep the attribute numbers the same.

 

Any new attributes you create, they should create with a number higher than the highest number.

When you think you have it sorted (you will always want to make future changes), create another new higher number attribute.

So you have a space to create new attributes later.

 

Now you have your template set up and it will still work with the default library objects.

 

In future when you are working on a project and you create a new attribute, it will get the next highest number.

If it is an attribute you want to have in your template, you can copy it into your template and re-index it so it has a number lower that net highest number attribute you created.

This is important because in every job you work on, any new attributes you create will have a number higher than the previous highest number.

So. in two different jobs you create a new brick surface in one and a new glass surface in the other.

They will actually create with the same attribute number in each file.

This is not good if you want to share information between files.

This is why you copy the attributes to your template and re-index the number to be lower than the highest number.

That way they can never be accidentally replace with the wrong attribute.

 

You always keep your template up to date.

Now you can import the attributes from your template into any job you have and you will get all the new  template attributes without affecting any custom attributes that have been created in that project.

 

You are basically creating a buffer for your attributes that you have complete control over (although it is a very manual task).

 

I hope I explained that well and have not totally confused you.

 

Barry.

 

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Sam Karli
Advocate

Thanks for Your insight, I have some differences in our workflow.

 

Basically I started from an overcomplex template (that I had inherited) having, like 750 layers etc, and my primary goal is to decimate it. So I went through our projects and collected the used attributes:

  • I manually purged every project
  • Then wrote a (Python) script that collects only the used attributes (puts them into a .json file). 
    (I took the opportunity to get familiarized in the AC Python API).
  • Then I took the too complex template and removed attributes that weren't among the used ones.

This way I got a template file decimated but with many holes among the indexes.

Then I made some manual adjustments (merging/renaming layers, adding some new one etc), this way I made the final structure, but still having a messy index structure.

Then I exported all attributes to an xml, reindexed them with the script, and reimported into the completely purged template. This way

  • I have the attribute structure as I wanted
  • The favorites aren't used by our architects, so its not a big problem that for now I cannot reindex them but later I want to do it
  • As a side effect, I got a (not so short) list of missing attributes that were removed manually before and forgotten

Now my tasks are:

  • Reindexing the favorites
  • Reindexing the graphical overriding styles, if possible
  • I have a tool that reindexes the ArchiCAD library for the attributes we use (to avoid, like, windows having a concrete or wooden glazing) and i have to export my data for that tool
    (This issue is kind of solved in the ArchiCAD 28, but in a wrong way. My approach bases on that, like every attrib (like, surface) is mapped from one value to another (like, 10 -> 25), everything that was, like 10 (let's suppose that this is the ArchiCAD factory glass material) becomes 25 (suppose that this is my material).

all in all, i have such a customized system 🙂

GDL/Python/C++ dev

I Found interestig your concept as it has some things in common with what I'm trying to do .. my post is here in case you want to have a look at it ... Attribute Concept for an Archicad Practice Template .

I've been trying to edit the XML files with scripts but could not manage to get them work again, if you have some detailed tricks I would be happy to know them.

To solve the problem with the missing attributes it'S always possible to correct them creating an attribute with the missing index-Nr. and afterwards deleting it and replacing it with another. This way will be relinked except for Layer-Combinations, Pen-Sets and sometimes also lines.

I modified the Library-Mapping values lately and for our solution worked well.

Gabriel

Since Archicad 11
Currently at Franz&Sue Zt GmbH
Sam Karli
Advocate

Hi,

I haven't been dealing with this for a while, but in general this is an attribute .xml skeleton. It has some internal logic.

 

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<AttributeFile Mv="1" Sv="2">
	<PlatformSign>22359</PlatformSign>
	<RegisteredAttributes>
		<NumberOfRegisteredAttributes>1</NumberOfRegisteredAttributes>
		<Attributes Type="Layers">
			<RefID>1279351090</RefID>
			<Layer Idx="1" Name="Archicad Layer">
				<OdbObj Mv="2" Sv="0">
					<OdbRef>
						<guid>D02A8E4D-93C2-4AB5-BBDF-7D6492907D59</guid>
					</OdbRef>
					<CreaTime>25542</CreaTime>
					<ModiTime>25542</ModiTime>
				</OdbObj>
				<Name>Archicad Layer</Name>
				<Index>1</Index>
				<Flags/>
				<ModiTime>1164398284</ModiTime>
				<RegMemoTable MemoNumber="0" Mv="1" Sv="0"/>
				<ReadOnly>false</ReadOnly>
				<ConnectionClassId>1</ConnectionClassId>
			</Layer>
		</Attributes>
	</RegisteredAttributes>
	<Folders>
	</Folders>
</AttributeFile>

 Some basic stuff:

  • At first, folders can be left out. If the xml importing works without <Folders>, one can start editing it.
  • <NumberOfRegisteredAttributes> must be equal to the number of the <Attributes> (Here 1, "Layers").
  • <Layer Idx="1" Name="Archicad Layer"> - here, value of Idx must be equal to the value of <Index> and value of Name must be the same as value of <Name>.
  • <OdbRef>/<guid> must be unique.

 

As far as i remember these are the rules that are needed for reading a syitactically correct attribute .xml.

 

Regarding the usual problem of indexes of parameters Archicad Generic Library's objects, I wrote another program in python that could be fed by an .xlsx spreadsheet describing conversion rules. The sheets describe various parameter types, like Pens and Surfaces, Strings etc, and a rule is used if

  • a parameter's name
  • a parameter's value
  • or an object's name
  • or any combination of the three above were met, then set the parameter to a new value.

So using this You can say to the script that

  • change every Pen 12 to 14
  • change every LineType parameter of the object "Door 27" to 5 thus the "Door 27" will be drawn all by the LineType 5 by default
  • change every "gs_trim_inside" to 0 thus switching Casing Inside off

The AC28 changed this but Graphisoft managed to create another overcomplicated system, so I modified this script to create the .json the same way.

I'm considering developing this program into a paying solution and market it later.

 

However this last modification was left in the company I've been laid off, so in a case of a new need i have to rewrite this.

GDL/Python/C++ dev

(I think I forgot to make my prevous post as a reply so this is only for seeing it)

 

See my answer down below.

 

VV

GDL/Python/C++ dev