BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad Python API
About automating tasks in Archicad using the Python API.
SOLVED!

Python Script to extract Property value and place in parameters

tonyfitz
Booster
I am wondering if it is possible to use Python to take a property value for a zone and place it in the Zone name parameter ?

We are trying to implement a system that reduces the potential for errors in data entry, so to acheive this we have created a property with an option list for all room names in a project along with a corresponding short-code in the format Shortcode:Room Name Then we use expressions to pull out the Room name and Short codes to use in labels, etc.

Now I would like to create room schedules showing the furniture contained within a zone grouped by zone, but the only way I can get that to work is to use the Zone Name parameter, so I want to set up a python script that will enable us to look at the Zone Name property and then copy this to the Zone Name parameter.

Thanks for your assistance in advance.
Tony Fitzpatrick
Head of BIM
www.aw2.fi

Co-Founder / CEO
www.the bimcrowd.com
13 REPLIES 13

Hi Gerry

I am pretty sure I have changed those to the correct properties.

 

How can I send you a file ?  would a pln, pla or mod file be best ?

 

Tony

 

Tony Fitzpatrick
Head of BIM
www.aw2.fi

Co-Founder / CEO
www.the bimcrowd.com

Would need both the pln & mod files -- Dropbox link via PM would be great

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
tonyfitz
Booster

Hi Gerry,

I have created a folder here for you to take a look at, containing pln and mod files of project plus the python script you sent through, modified to our needs and another I was experimenting with to redirect to the already shortened property rather than do the splitting in the python script.

 

Dropbox folder 

 

Waiting to see what you make of it.

 

best regards

 

Tony

Tony Fitzpatrick
Head of BIM
www.aw2.fi

Co-Founder / CEO
www.the bimcrowd.com

I do see how you revision #2 would work Of course, i could be wrong, but as I understand it:

GetPropertyValues require a type (class) not a string  and Elelement PropertValue value is packed with a type (class) for the value

Also SetPropertyValues should be outside and below the for loop. I believe that was my original mistake

 

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
Learn and get certified!