BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Why? Why? Why?

Anonymous
Not applicable
I have a zone object that I've programmed that contains a section of code that prefixes the room numbers with a number corresponding to the current story number. On the floor plan it works exactly as expected. However, in my room finish schedule, it always shows a "1" as the prefix -- even though it shows the correct number on the floor plan.

Here is the code:
IF pUseStory = 1 THEN 
	TempVar = REQUEST("Home_Story", "", StoryNumber)
	StoryNumber = StoryNumber + pAdjustment
	pRoomNumber = STR(StoryNumber, 1, 0) + ROOM_NUMBER
ELSE
	pRoomNumber = ROOM_NUMBER
ENDIF
PARAMETERS pRoomNumber = pRoomNumber
Note that my vars beginning with 'p' are in the parameters list, and my vars without 'p' only exist in the specific script. pRoomNumber is the var I'm referencing in my schedule.

The picture below shows you what I get on the floor plan (202), and in the schedule (102).

What is the deal?
7 REPLIES 7
Frank Beister
Advisor
AFAIR does this specific REQUEST not work in shedule environment. As it does not in settings dialog (GLOB_CONTEXT=5), I think. Because of the last circumstance you will not be able to workaround by an

PARAMETERS pRoomNumber = STR(StoryNumber, 1, 0) + ROOM_NUMBER

I can't proof now, but I remember something .... I have written on selfgdl something about it, which lets not guess good things: The REQUEST is (min.) up to AC9 only available in 2D script if you are in shedule environment. There are a few parameters and requests, which do not work in shedule mode.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
F. wrote:
There are a few parameters and requests, which do not work in shedule mode.
That's fantastic!

I tried looking for a way to prefix the room number with the number "2", but I couldn't find any way to alter a data field.

Still searching...
Frank Beister
Advisor
We discussed that kind of problem some time before in German talk. Someone wanted to set a calculated value to parameters of placed zone stamps. We didn't find a way, because in the moment the PARAMETERs - command does work inside any script, all necessary REQUESTs didn't.
I have that booked on "problematic stuff - check first before programming the environment". 😉

---

But there's a trick to change all parameter values (for people, who do know, what they do and who can operate carfully). Backups are highly recommended!! I have used this several times, but now for a longer time not. So no guarantee, that it works with AC10 and no guarantee, that the project file will not be hurt.

If you want to change one parameter of all instances of one object inside one project:

0. Backup project and library part(s)
1. Close all ArchiCADs but one
2. Open the project and switch all relevant layers visible
3. Open the object
4. Delete the relevant parameter. Note its settings before.
5. Add first line in master with parameter=defaultvalue
6. Save the object.
7. Reload the library
8. Now all stored values of the parameter in plan should be deleted.
9. Go again to the object editor and add the parameter with same name and settings!
10. Assign the preferred value
11. Delete the first line of master script
12. Save and close object
13. Reload library

If it is an array, which should be changed. Increasing or decreasing the array dimension resets the parameter after a library reload.

Again: This is an operation on open heart and can produce great data loss over all projects, the object is use inside. So don't use this, if you don't understand, what is done here.

This does, for shure, not work with GLOBALs as ROOM_NUMBER. Because they can't be deleted.

---

Have you tried it with
VALUES "ROOM_NUMBER" "2"
in parameter script.

---

BTW:
PARAMETERS ROOM_NUMBER="2"
can not work, because it is a GLOBAL "outside" the object.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
Success!

Since the ArchiCAD scheduler can only see ROOM_NUMBER and not my own pRoomNumber, I decided to figure out how to change ROOM_NUMBER and still maintain the floor-prefixing. It was easily fixed with the following:
IF pUseStory = 1 THEN
   LengthOfNum = STRLEN(ROOM_NUMBER)
   ROOM_NUMBER = STRSUB(ROOM_NUMBER, LengthOfNum - 1, 2)    [save last two digits]
   TempVar = REQUEST("Home_Story", "", StoryNumber)         [get current story number]
   StoryNumber = StoryNumber + pAdjustment                  [in US you must add 1 to the internal story number]
   IF StoryNumber >= 13 THEN StoryNumber = StoryNumber + 1  [for the superstitious ;-)]
   pRoomNumber = STR(StoryNumber, 1, 0) + ROOM_NUMBER       [create number]
   ROOM_NUMBER = pRoomNumber                                [store to global variable]
   PARAMETERS ROOM_NUMBER = ROOM_NUMBER                     [store to parameter]
ENDIF
Our room numbers always have 3 digits, therefore, if you are using the automatic prefix, the script must first save the last two digits of the current room number, and then add the prefix. This makes it impossible to get the wrong prefix because the script will always fix it.
Frank Beister
Advisor
In which script part does it run? Master/Parameter? I am very astonished, that this works. It has to be another request which did not work or GS has fixed something in the last patch(es). Anyway. Good for you to get it work.

Why can't you get the pRoomNumber in an AC-shedule? Isn't there the possibility to select it from an all-parameters-of-the-object-list?
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
F. wrote:
In which script part does it run?
It runs in the Master Script. I haven't tried it in the 2D script.
F. wrote:
Why can't you get the pRoomNumber in an AC-shedule?
I can get it into the schedule, but for some reason it always returned "1" as the first digit. So if I had zones "201", "202, and "203" on the second floor, the schedule always showed "101", "102", and "103". And if I had zones "301", "302", and "303" on the third floor, it still showed "101", "102", and "103" in the schedule.

I tried all kinds of tricks before I finally found the answer. I tend to get stuck looking at the problem in one way -- in this case, trying to make pRoomNumber work -- instead of trying to find an entirely different approach. Once I decided to see if I could get the concatenated room number into the ROOM_NUMBER parameter, it only took about 15 minutes to have functioning code.
Anonymous
Not applicable
I discovered one more strange quirk this morning. If you let Auto Increment determine your room numbers, the schedule will only show the last two digits. So instead of letting ArchiCAD choose the number "02", you need to enter "02" by hand.
Learn and get certified!