cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Autotext String Width

owen
Newcomer
I am trying to get our Drawing Title to set its width based on its text content (<DRAWINGNAME> & <DRAWINGSCALE>) however I am having difficulty finding the correct way to extract the string width to position the text and line length. I have tried:

width=STW('<DRAWINGNAME>')*A_/1000
TEXT2 0,0,'<DRAWINGNAME>'
LINE2 0, 0, width, 0

Whilst this correctly displays the drawing name, the text anchor and line length use the width of the 13 characters in <DRAWINGNAME> and not the actual drawings name.

I (think) i understand why this doesn't work - the <DRAWINGNAME> autotext conversion to the correct drawing name is done after the script is run (ie. when displayed on the layout) whereas the STW is done within the script when <DRAWINGNAME> is still just those characters.

So is there a REQUEST function to get the name of the attached drawing name? I can't find anything in the AC10 GDL Reference Guide .. is there another more extensive list somewhere else?
cheers,

Owen Sharp

Design Technology Manager
fjmt | francis-jones morehen thorp

iMac 27" i7 2.93Ghz | 32GB RAM | OS 10.10 | Since AC5
18 REPLIES 18
Frank Beister
Mentor
@ LiHigh
Where do you have the names from you can use? They are not documented anywhere, isn't it?
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
owen wrote:
Excellent ... many thanks LiHigh! Works perfectly
Owen,

Did you actually get this to work? I'm having no luck. Any advice or tricks you came across would be greatly appreciated. I think I've done exactly what's required but the line remains the same length no matter what the title of the drawing is. Here's the code:

titw=STW('<DRAWINGNAME>')*GLOB_SCALE/1000

hotspot2 -0.0085, 0
hotspot2 titw, 0
line2 -0.0085, 0, titw, 0

I think this is all fine and maybe the problem is somewhere else. Have I added the AC_DrawingName parameter correctly? See attached parameter list snapshot.

Thanks in advance for any advice.
Title parameters.png
owen
Newcomer
Ray,

You need to add AC_DrawingName to your parameter list - this is one of those undocumented blue optional parameters LiHigh and Frank are refering to. Usually the blue optionals are in the GS library documentation HTML files on their website, but they seem to have forgotten to include any documentation on the new Drawing Title subtypes. If it is there i can't find it anyway so I too would be interested to know how LiHigh found them!

Anyway this new parameter will actually return the drawing name as a string to use in your script. The autotext <DRAWINGNAME> does not work like that .. as far as the script is concerned it is literally those characters, it is only after the script is run and the object displayed that AC recognises that combination of characters as an autotext function and converts them. This is why the line remains a constant length ... it is the length of the characters <DRAWINGNAME>.

Below is the script i've used for part of our title - this finds the width of the drawing name and sets the width of the drawing title lines to match.

fjmt_mrk_len1=STW(AC_DrawingName)*(A_/1000)
LINE2 fjmt_mrk_rad1*2,-fjmt_mrk_rad1,fjmt_mrk_len1+fjmt_mrk_rad1*2+fjmt_mrk_txtoffset1,-fjmt_mrk_rad1
CIRCLE2 fjmt_mrk_rad1,-fjmt_mrk_rad1,fjmt_mrk_rad1

I've also attached our object as it stands. Its still a work in progress - for example it sets the title width based on the drawing name only. In practice this should always be the longest string but when its finished it will determine what string (Drawing Name, Scale ..) is longest and use that length. Anyway maybe it will help you.

Parameter names are a bit long i know but we like to put fjmt at the front of ours as most of our objects are just tweaked when required and this helps distinguish them from other peoples code

HTH
cheers,

Owen Sharp

Design Technology Manager
fjmt | francis-jones morehen thorp

iMac 27" i7 2.93Ghz | 32GB RAM | OS 10.10 | Since AC5
Anonymous
Not applicable
Thanks Owen,

Haven't got time to look at it at the moment, but this should help a lot. Looking in the code of a working object is usually the best way I find to work out how things are working. Before I found this thread I was opening up an old title block object "Section-detail Marker.GSM" (from an old Australian Essential Library from before ArchiCAD 8 - before layout books and autotext titles) to look at the code. And it had the line "(stw(Ttl_Txt)*(A_/1000)" to calculate the width of the string. I remembered using this object for our titles pre ArchiCAD 8 and it working perfectly for our needs. But getting this to work with Titles now in 10 and optional object parameters was the headache.

I've no idea why the OOTB library in 10 couldn't have had a title object that worked similarly to this old one. It's very basic but works perfectly for adding a title of typical working documentation standard for all drawing types: plans, elevations, sections and details. Nothing I see of the new titles provided works like this. And with version 8 & 9 it was easy to draw your own, drag and stretch as needed. Still not quite perfect but a darn sight better than what's available in 10 at the moment.

Just a bit of a vent of my frustration with titles!!!!

But thanks again Owen.
owen
Newcomer
No problem. Oh btw it doesn't work with automatic drawing cross referencing AFAIK ... we haven't used that in the past due to spliting our docs into many layout books. It is something I hope to get around to trying out soon though
cheers,

Owen Sharp

Design Technology Manager
fjmt | francis-jones morehen thorp

iMac 27" i7 2.93Ghz | 32GB RAM | OS 10.10 | Since AC5
LiHigh
Newcomer
F. wrote:
@ LiHigh
Where do you have the names from you can use? They are not documented anywhere, isn't it?
Documented somewhere? are u kidding me?

I did it the hard way. I studied GS title object codes. very time consuming..........
Howard Phua

Win 10, Archicad 19 INT
Frank Beister
Mentor
Documented somewhere? are u kidding me?
I did not really thought of.

I have found now a hard way to search for the implemented optional Parameters too. Can you compare it with your list, if I have missed some? You will find it in a few days on selfgdl.com

AC_OriginalDrawingScale
AC_Magnification
AC_DrawingScale
AC_SourceFilePath
AC_SourceFileName
AC_TitleFitMode
AC_ManualPosition
AC_DrawingGUID
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
I've been working on older v9 projects lately, so haven't used it much yet but I wanted to say a big thanks to Owen for sharing that Title Object.

At last something that works properly!

An object like this really must be included in Graphisoft's standard library or the localised libraries. It is an everyday standard way of titling drawings.

I can't imagine how someone coming new to ArchiCAD would deal with this. When automatic titling, numbering and referencing is touted as a feature but in practice is almost totally unuseable, new users may wonder 'Was I conned?'.

Older users realise it's something (titles as objects) that came out too soon - before being thouroughly resolved - and will eventually get fixed.
owen
Newcomer
Thanks for the support Ray. Its not finished yet though, i've got a few things that needed to be done and some more i wanted to do. I've just moved offices and am about to head off to South America for a month so it could be a while before i get back to it ... but i will post it again when i have done more.
cheers,

Owen Sharp

Design Technology Manager
fjmt | francis-jones morehen thorp

iMac 27" i7 2.93Ghz | 32GB RAM | OS 10.10 | Since AC5