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

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

Split Home Story info

JGoode
Expert
Hello,

I was wondering how to split the home story info so instead of GF-Ground Floor it would just read GF?

Thanks
ArchiCAD 23

Windows 10
7 REPLIES 7
Erwin Edel
Rockstar
Autotext string is #DrawingID, assuming you are using the ID field for 'GF'.
Erwin Edel, Project Lead, Leloup Architecten
www.leloup.nl

ArchiCAD 9-26NED FULL
Windows 10 Pro
Adobe Design Premium CS5
JGoode
Expert
Erwin wrote:
Autotext string is #DrawingID, assuming you are using the ID field for 'GF'.
Sorry, I don't quite understand. How do I implement this? I want my object to read whatever the home story is and then instead of outputting the entire text e.g "GF-Ground Floor", just output GF.
ArchiCAD 23

Windows 10
Erwin Edel
Rockstar
If you place text (or object with text) on a story and use Autotext #DrawingID in the textfield, it will display the Drawing ID on layout, which would be GF instead of 0 I guess for your project. If "GF" is part of the the DrawingName field, you would have to split up the text string or make a range of IF ... THEN statements to setup a custom parameter based on the story number.

Look at SPLIT command (page 295 in GDL Reference Guide) on how to split up a single string into multiple variables.

Edit: as an example, I use an autotext textblock with #DrawingName in favour of drawing title on layout. All I want is a simple 'ground floor' 'east elevation' etc text at my gridmarker. When looking at my project in project or view map I just see that "#DrawingName" textfield, but when you place the view on layout it converts to the name of the view.
Erwin Edel, Project Lead, Leloup Architecten
www.leloup.nl

ArchiCAD 9-26NED FULL
Windows 10 Pro
Adobe Design Premium CS5
JGoode
Expert
Erwin wrote:
If you place text (or object with text) on a story and use Autotext #DrawingID in the textfield, it will display the Drawing ID on layout, which would be GF instead of 0 I guess for your project. If "GF" is part of the the DrawingName field, you would have to split up the text string or make a range of IF ... THEN statements to setup a custom parameter based on the story number.

Look at SPLIT command (page 295 in GDL Reference Guide) on how to split up a single string into multiple variables.
#DrawingID doesn't seem to do anything. I tried <DRAWINGID> which gave me an output of #DrgID which is obviously not what I would like. The SPLIT command doesn't make much sense to me.

I am trying to "split" the variable from this request command
x = REQUEST ("Home_story", "", index, story_name)
I just don't know how to do it.
ArchiCAD 23

Windows 10
JGoode
Expert
I am basically after the home story but just a shortened version of it so GF instead of GF-Ground Floor or 01 instead of 01-First Floor. I need it to add it to a pre-defined zone name. I don't know if split is what I need but I need it to be automatic. So it needs to include the request home_story command.
ArchiCAD 23

Windows 10
JGoode
Expert
I have gotten this far
n = SPLIT (story_name, "%s", num) 
IF n = 1 THEN
    text2 0, 0, num
ENDIF
it is currently showing as GF-Ground rather than GF-Ground Floor which is a step in the right direction but I can't get any further. I need the string to stop after the GF part.
Any guidance would be appreciated,
Thanks
ArchiCAD 23

Windows 10
Barry Kelly
Moderator
I have answered in the GDL Center forum.

http://gdl.graphisoft.com/forums/topic/split-function-problem

But I will copy the post here as well.

If your storey name is “GF-Ground Floor” then you will find that “GF-Ground” is one part of the string and “Floor” is another.
So …
x = REQUEST (“Home_story”, “”, index, story_name)
n = SPLIT (story_name, "%s %s", split1, split2) 
IF n THEN
    text2 0, 0.5, story_name
    text2 0, 0, split1
    text2 0, -0.5, split2
ENDIF
What you actually need to do is search for the “-” character.
Assuming this is the same for all your storeys.
Then output the required number of characters.
pos = STRSTR (story_name, "-")
!    text2 0, 0, pos

prefix = STRSUB (story_name, 1, pos-1)
    text2 0, -2, prefix
Of course if the prefix is always 2 characters you know this already so you can just output the first 2 characters with STRSUB.

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