Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Problem with REQUEST

Barry Kelly
Moderator
First I will explain what I am trying to do.
I have a 2D object placed on each storey of my plan.
In this I set default values required for energy efficiency calculations for glazing (i.e U-value, SHGC, shade overhang, shade height).
All this is fine and works well.
I REQUEST the home storey of the object and OUTPUT the values to a text file.

Here is the bit of script that does it and as I said all works well and the text (Excel) file is created.

rrr=REQUEST ("Name_of_plan", "", pname)
rrr=REQUEST ("Home_story", "", hsindex, hsname)

fspec="C:\Program Files\ArchiCAD 8.1\ArchiCAD Data Folder"+pname+"_BCA_window_default_settings.xls"
ch1 = open("data",fspec,"Separator='\t',Mode = WO")
OUTPUT ch1, hsname + " - U_value", 1, U_value
OUTPUT ch1, hsname + " - SHGC", 1, SHGC
OUTPUT ch1, hsname + " - Shade o/hang", 1, shade_ohang
OUTPUT ch1, hsname + " - Shade height", 1, shade_hgt
close ch1


The output in the file looks like this but in two tabbed columns (name and value).
Ground floor - Shade height 2.243
Ground floor - Shade o/hang 0.6
Ground floor - SHGC 0.81
Ground floor - U_value 7.9
Upper floor - Shade height 2.4
Upper floor - Shade o/hang 0.4
Upper floor - SHGC 0.95
Upper floor - U_value 8.2



Now the problem comes with my doors and windows.
These objects need to read in the default values for the storey they are located on.
So in each object I need to INPUT to read in these values.
Here is the script for that.

rrr=REQUEST ("Name_of_plan", "", pname)
rrr=REQUEST ("Home_story", "", hsindex, hsname)
fspec="C:\Program Files\ArchiCAD 8.1\ArchiCAD Data Folder"+pname+"_BCA_window_default_settings.xls"
ch1 = open("data",fspec,"Separator='\t',Mode = WA")
in1 = INPUT (ch1, hsname + " - U_value", 1, U_value)
in2 = INPUT (ch1, hsname + " - SHGC", 1, SHGC)
in3 = INPUT (ch1, hsname + " - Shade o/hang", 1, shade_ohang)
in4 = INPUT (ch1, hsname + " - Shade height", 1, shade_hgt)

close ch1

PARAMETERS U_value = U_value
PARAMETERS SHGC = SHGC
PARAMETERS shade_ohang = shade_ohang
PARAMETERS shade_hgt = shade_hgt


The problem is the "hsname" variable seems to have no value when used in the INPUT command.
There was a discussion in another post on a different subject but also involed a problem with REQUEST.
http://archicad-talk.graphisoft.com/viewtopic.php?t=8856&start=10

Franks reply at one point was
F. wrote:
Most REQUESTs and GLOBALs, which refer to environment specific status of the object do not work in the dialogue box or the object editing window. That sometimes anoying, because a placed object or window does have this relations yet, but they are not available, when the script runs for the preview.

We had this with ZONE_RELATIONS a few weeks ago in the german talk, where one wanted to take over the zone number into an object, which was placed on the zone area. We did not get it to work, because in case PARAMETERS work, the REQUEST returned a zero-result.

The big question is how can I get the windows and doors to read values from the text file based on the storey name?
I want this to be automatic - I don't want to have to set a parameter in the door/window to say which storey it is in when I know it already recognizes this with the REQUEST function.
How do I get the home storey request to work with the INPUT command?

Any ideas appreciated.
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
10 REPLIES 10
Frank Beister
Moderator
I gave it just a try and here are my results:

• Using the fieformat DATA means, that disregarding using WO or WA a certain database item will be overwritten by the next output on this record-id/field-id. If you don't control it a valid value will be overwritten by an empty one.

REQUEST ("Home_story", does work in AC8.1 too. But as in our ZONE-RELATON-problem with 8.1 not in all context. Unfortunatly not in that moment, PARAMETERS does work. See below.

• You could write your values to the file, if you check the hsname before:
IF hsname<>"" THEN
OPEN ...
OUTPUT...
ENDIF



---------
I did the following:
I added file writing commands (text type) to the master script, writing GLOB_CONTEXT, GLOB_SCRIPT_TYPE and the requested HomeStory cumulative (WA).

Then I selected the object in the settings dialog and placed it on the floor plan (for that the first few lines can not have in both cases any valid requested value). Then I activated the object, returned to settings dialog and closed window without changes.

The result in AC 8.1
5 5 »«
5 5 »«
5 5 »«
5 4 »«
5 4 »«
5 2 »«
2 2 »0. Geschoss «
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 4 »«
5 4 »0. Geschoss «
5 2 »0. Geschoss «
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«
5 5 »«

The result in AC 9.0
5 5 »«
5 5 »«
5 4 »«
5 4 »«
5 2 »«
2 2 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 4 »0. Geschoss «
5 4 »0. Geschoss «
5 2 »0. Geschoss «
2 2 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «
5 5 »0. Geschoss «


You see, as you pointed out, that the behaviour has changed to 9.0. One may call it a bug, GS will call it an improvement. Now we need the improvement for the ZONE-RELATION REQUEST too.
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