2022-04-06 05:34 PM
zone_numbering.py [script from Archicad website]
Zone Numbering | Generates unique ordered zone numbers. Sets the “zone number” built-in property value for all zones in the project. The script implements a zigzag ordering. |
I want to edit the the zone_numbering.py and change the way the example provided by Graphisoft works.
Is it possible to filter out the visible zones in the aray of selected zones. So that only the items visible get a new zone number?
Thanks in advance!
Solved! Go to Solution.
2022-04-07 07:46 PM
Attached is a revised zone numbering example Python script which filters out zones on invisible layers as described above. Comment if you have any questions? Note the slow performance?
2022-04-07 02:04 AM
You did not mention by what criteria you define visibility? Is it a selection set, visible layer or story etc. In any case, the short answer is "yes".
The procedure would be to simply return all Zone Id's, as in the example, then apply a filter to create a subset then, with that subset, apply with the rest of the code as normal.
Assuming you want to filter on Layer visibility - The filter steps would be -- return the layer name for zone element, for each zone name ,iterate though all available Layers to determine if that layer is visible. If so, mark the element Id as true. Unfortunately, there is no function to select a layer by name, this the need to iterate - this makes the script relatively slow.
Other options would be handled the same, abet with a much simpler filter. However, if you want to filter on a user selection set, the Python API does not have that function ( at this time). However, on my GiyHub site I have created a AddOn to provide that ability - Archicad_Python_Training -- Data_Access.apx. Either way the above is possible.
2022-04-07 07:46 PM
2022-04-09 11:38 AM
Thank you very much! This is really helpful. The script is indeed a bit slower but it's always faster then doing it by hand. Thank you for your effort.