We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.

Access Layout Properties from Master Lyout

jan_filipec
Booster
Is there a way to access layout data in an object placed in a master layout? I need to create an object that looks different on each layout, depending on the layout's id.

Autotexts - work from masterlayout but can't be used to drive a script
n = request ("HomeDB_info", "", n, LayoutNumber, LayoutName, n) works only when placed directly on the layout, but not from masterlayout
LAYOUT_CHANGE_HISTORY works from masterlayout but does not contain layout id.

Thanks
17 REPLIES 17
Podolsky
Ace
Solve it differently. Place your object (I guess title block) to layout and leave master layout empty. This way user can access to title block settings and change settings - for example title block style, show/hide north symbol and scale and similar. This method also potentially reduces amount of master layouts to paper sizes (because usually people have huge list of masters: A1 horizontal - presentation, A1 vertical - construction, A1 horizontal - planning application etc).
jan_filipec
Booster
Yeah, well this is what I am doing now. The problem is, that this is a typical masterlayout problem - I need the properties of the blocks to be exactly same on all layouts, only the content to change. (for example: I have a house with 200 flats. I have one layout for each flat and they all have to be identical. I need to place one of two logos on the layout according to a list. Normaly you would make two master layouts and manually pick the 100 flats and change to the masterlayout with the right logo - I want this to happen automatically)
So what I am doing is defining these parts of layout through gdl (position, size of the logo) which is fine for me, but doesn't really work as a user solution - I can't expect everyone in the office to be able to open the gdl script of the object to change the font size or position everytime they want to change the layout.
Peter Baksa
Graphisoft
Graphisoft
It is possible to code parameters that control the font size or position with a simple UI. The position could even be a moveable hotspot.
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest
jan_filipec
Booster
Yeah, but the original problem still remains:
I can program these things in GDL and place the object on a master layout, but then I can't have the object change according to the layout number, because I can't access it from master layout.
Or I can place the object on each layout, but then I can't change the position on all layouts at once, as the parameters are saved per object.
I just tried using MVO but that obviously also doesn't work in layouts.

A slightly different example of what I want: the object opens a file and displays data read from the file. I need a different part of the file on each layout, but I want to be able to set the path to the file in one place, not per layout.
Podolsky
Ace
What do you mean by changing position of layout?

In my research I finally came to conclusion, that placing title block as an object on each layout and keep master empty more beneficial in any case - it just gives more options to control. Also you can program the title block the way that user would not able move, rotate or mirror the object, only place or delete. Well, you actually do move the object, but GDL returns position of the object back.
Also you can use txt files (or files with GDL extension, that is txt file but can be a macro), or XML, placed into embedded library as small data base and point if exchanging information between library parts. This way you can control change of several objects by changing only one of them.

And don't forget - you can develop a tool, that is working, but not completely perfect because of GDL limitations - but later you can infill the gaps with new GDL commands and possibilities, when they will be introduced in the future or using C++ or Python.
runxel
Legend
What I do myself is, that I neither have my title blocks on the layout or the master layout.
Instead I have them in worksheets and I place them.
Mostly on the master layouts, still. But on the other hand I really don't need to have every layout be different.
Maybe this is an XY Problem?
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
jan_filipec
Booster
runxel wrote:
What I do myself is, that I neither have my title blocks on the layout or the master layout.
Instead I have them in worksheets and I place them.
Mostly on the master layouts, still. But on the other hand I really don't need to have every layout be different.
Maybe this is an XY Problem?
I apreciate your comments, but have you read my description of the problem? I need every layout to be different, that is the task, that is what I am paid to do. I want to automate this, because it seems simple enough - I have a database mit data and a large number of layouts with unique IDs. I need to show different data from the database on each layout - depending on the layout ID. (Layout 1 - row 1 from the database, Layout 2 - row 2 from the database and so on.)
I know how to do this, but here comes the real issue: I need the displayed information to be configured in a user friendly way, because it changes from project to project. The suggestion from @podolsky with the configuration file is the closest thing to what I am trying to achieve. I will try it out and see how the users in our office ract to this.
runxel
Legend
jan.filipec wrote:
I apreciate your comments, but have you read my description of the problem?
I did, but it was not comprehensible. 🙂
See, I think you have a bunch of different problems there which you're conflating into one.

Of course you know your problem best. But we can't this easily see all the possible caveats. So sometimes the forum is more of a collective "brainstorming" to get you to have the right idea. 😉

Back to the multiple problems:
So, you need something, that is the same, except for the parts that aren't. Also it needs to be flexible.

You already discovered that there is no easy solution.
And you really want this to be one object? Otherwise a first step before a final solution would obviously to split the dynamic part from the static part and put that on every layout.

One clean solution, until the Python connection can place elements, I can see is a custom made add-on.
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
jan_filipec
Booster
Podolsky wrote:
Also you can use txt files (or files with GDL extension, that is txt file but can be a macro), or XML, placed into embedded library as small data base and point if exchanging information between library parts. This way you can control change of several objects by changing only one of them.
(I said position ON the layout-sometimes we have to add some information to the layout and move the block a bit-that means clicking through hundreds of layouts and moving them manually right now)

I tried to work with your solution and it seems to be pretty much exactly what I need, but I would appreciate some help still.
  • I can imagine building this in a one of two ways:
    Either one master object, placed somewhere being invisible, in which I set the variables, it writes them to the config file and a different object placed on every layout, reading the config file. I tried this and it seems to work ok.
    Or only one object, placed on all layouts, always writing any change to the variable to config first and then changing everywhere. I tried this but it seems to lead to conflicts and crashing archicad.
    Can the single object version work?
  • I tried the text and data add-ons, the both remove \t from any text, even if I set the separator to ";" is there a way around this? (I need to pass directory path i.e. "C:\temp")
  • I created an empty config file and manually added it to the library first, is there a way to check if the config file exist in the library and create it if it doesn't?