We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2021-08-30 04:58 PM - last edited on 2021-09-14 09:18 AM by Noemi Balogh
Solved! Go to Solution.
2021-09-05 06:22 AM
I believe I finally figured out your request. Some tines the obvious things are more difficult. At any rate. i made up a short Python script to change zone names as you requested. I only used the option list property, as the expression property would just be redundant. Attached is a demo video which demonstrates the process. The script is posted on a GitHub repository as listed in the video. BTW, because you have 1000+ rooms, you may want to further identify your room names with more identifiers as in: Story level, Suite style, special restrictions, etc. -- this is also possible in the python script with a option list.
i assume you can make the necessary language name translations in the script. Please advise if you have any questions -- hope this helps assuming i got it right?
2021-08-30 07:26 PM
2021-09-03 09:51 AM
Hi Gerry,
thanks for that, here are some screenshots to explain what I am trying to achieve so hopefully makes it clearer.
Firstly instead of entering room name in the Zone room name box (1000's of rooms being entered by different team always results in variations of the same room names in different parts of the building...) I have created a property which is a drop down list of all room names used in a project along with a shortcode (eg WC:Toilet), then I have used an expression to extract the shortcode and room name into new properties. This works well for most things I want to do like labelling rooms, extracting schedules, etc, but when I want to create a schedule that tells me what elements are in a particular zone I need to use the "related Zone name" parameter to return the name of the room along with the Zone number.
So was wanting to find a way that I could automate the process of transferring the selected room name from the property to the Zone name parameter box. I have set up a schedule where I can copy / paste from the property to the name parameter, but as this is just repetitive and I can't see anyone really wanting to sit down and repeat this process 1000's of times across a project, was wanting to make it more painless...
The red bits are currently done automatically after selecting the part in the circle, so now I want to automate the green bit.
Thanks for any help.
Tony
2021-09-04 06:14 AM
Sorry, I don't speak your native language or even know which it is? So, I have no idea what is being transferred to where in your schedules.
But, on the face of it, this seems like a simple automation application and , for 1000+ rooms, would justify a script. If you could provide more info in 'English' I might be able to help. you may want to PM me directly? I believe this could now involve a simple script
BTW: I was wrong about Python access to room name?
2021-09-05 06:22 AM
I believe I finally figured out your request. Some tines the obvious things are more difficult. At any rate. i made up a short Python script to change zone names as you requested. I only used the option list property, as the expression property would just be redundant. Attached is a demo video which demonstrates the process. The script is posted on a GitHub repository as listed in the video. BTW, because you have 1000+ rooms, you may want to further identify your room names with more identifiers as in: Story level, Suite style, special restrictions, etc. -- this is also possible in the python script with a option list.
i assume you can make the necessary language name translations in the script. Please advise if you have any questions -- hope this helps assuming i got it right?
2021-09-07 04:02 PM
2021-09-07 04:40 PM
Hi Gerry,
I have managed to put this into my file and adjust the property names and run the script (woo hoo my first attempt at Python...lol) and it works on some zones but not others.
Would the language version of Archicad have any affect ? (we are running Finnish version) I assume it doesn't as the expressions still use the standard English.
The only other thought I had so far is could it be related to the zone type ?
cheers
Tony
2021-09-07 07:27 PM
There is probably a lot of reasons why it does not work on all zones. But if it works on some, I doubt that language is the problem. Perhaps some are not configured properly, or some zones are a derivative of a zone (really a object) , perhaps a hotlink? --- i don't know.
If you can send me a small sample file (English Please) I'll take a look. It is possible that Archicad is not recognizing some zones as a "Zone" category. If that is the case, i may have a work around. Otherwise, i'll send it on to Graphisoft for future inclusion.
2021-09-08 04:01 PM
Hi I have tried again to run the script and copy the error code, which is as follows;
Traceback (most recent call last):
File "C:\Users\aw2\Desktop\Temporary Archicad Files\zone renamer.py", line 20, in <module>
buffer = str(value[index].propertyValues[0].propertyValue.value.displayValue)
AttributeError: 'UserUndefinedPropertyValue' object has no attribute 'value'
I was wondering if the splitting operation could be causing an issue ? I do have a property where the split has already been carried out, so could refer directly to this (but am not sure of which lines I would then remove if I tried this.)
I will have to save an English file from my home computer as don't have an English version of 24 loaded on my work computer at present.
Will try and get that through in the next day or 2.
regards
Tony
2021-09-08 05:24 PM
My apologizes for not explaining certain lines. In order to demo this application,I had to make certain assumptions.
The error your getting indicates Python is not finding your name property or the property is not a Option.
In line 15,you must insert the group and property name.
acc.GetUserDefinfedPropertyId('Phases','Application') -- change to your group name and property name.Group first , than name
Line 21:
buffer = buffer.split(':')[0] -- expects a colon (:) as a separator. Insert you own separator.