cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Starting August 6, 2024, TLS 1.2 will be the minimum required protocol version for Graphisoft products and services that require an online connection. Learn more…
Documentation
About Archicad's documenting tools, views, model filtering, layouts, publishing, etc.

Hack the Surface Label

RHF55
Participant

I would like to edit the Surface Label 25 to show the text of a surface before a delimiter. For example:

 

Surface Name is TC:Timber Cladding

Label to shown only TC

 

This is the code I have used to get this working on a wall label i wrote a while ago:

!======split
len = STRLEN (string)
iDotPos = STRSTR (string, sep)!sep is the seperator
code = STRSUB (string, 1, iDotPos - 1)
mat = STRSUB (string, iDotPos+1, len-iDotPos)!material
 
if display_txt = 'code' and code<>"" then
string=code
endif
 
if display_txt = 'mat' then
string=mat
endif

 

But I cant figure out where to catch the surface name and split it in this object. I think it might be happening in the macro label_content_macro. Any wizards out there that can figure this out??? @Barry Kelly ?

 

Of course this would not be required if GS would give us an ID field for surfaces the same as building materials.

 

Operating system used: Mac Intel-based 12

5 REPLIES 5
AllanP
Advocate

Yes, that is the correct place where the suface is gathered from.

from gdl

AllanP_0-1722999928375.png

 

(they are just using a parameter with SURFACE_ in front of the desired gdl code in this list...

from the macro

AllanP_1-1722999976656.png

which then gets the id of the surface

_iAvailableMaterialContent

AllanP_2-1723000044536.png

that then convert's into a name

_nameSurface

AllanP_3-1723000166689.png

which gets assigned to:

_sSegmentLocal

AllanP_4-1723000289046.png

which gets assigned to

_sSegmentGlobal

AllanP_5-1723000398703.png

 

 

which gets assigned to

sRowsOfLabel

AllanP_6-1723000629102.png

which gets assigned to

tempsRowsOfLabel

AllanP_7-1723000676445.png

 

Which gets returned from the macro using the "end returned_parameters" command...

AllanP_8-1723000724178.png

 

 

 

I love the way Graphisoft make this easy to find...

 

 

P.S.

it looks like the typed prefex is in array point 1

and the material is in array point 5

 

using the following in a copy of the surface label

 

text2 0,1,_sContentStringsHead[1][1]
text2 0,2,_sContentStringsHead[1][5]

 

AllanP_0-1723002874735.png

 

AllanP_1-1723002897795.png

 

 

 

 

 

I have been using ArchiCAD continually since ArchiCAD 4.5, 4.5.5, 5, 5.1, 6, 6.5, 7, 8, 8.1, 9, 10, 11, 12, 13, 15, 18, 21, 22, 25, now testing 27
Member of Architalk since 2003, but missed the migration to Graphisoft.
(where have all my original posts gone?)
Barry Kelly
Moderator

Having a quick look at that surface label, it seems it calls a subroutine to "collect_content".

This returns the information for the surface that is stored in the parameter array ... _sContentStringsHead

 

So I am assuming you would need to perform your SPLIT routine on that parameter value to get the part of the name that you want.

 

There are 2 GOSUBs in the label, one to get the information and one to display it.

Your split routine needs to be done between those two GOSUBs.

 

BarryKelly_0-1723000053977.png

 

The thing is that _sContentStringsHead parameter is an array, so you will have to figure out what part of that array the information is in for the surface name.

You then need to SPLIT that name and then replace it back in the array so it is then used in the 'position_and_draw_label' sub-routine.

 

At the moment I don't have the time to investigate further.

But hopefully that will give you a start.

 

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

Well I dont feel so silly not being able to trace that, now Ive seen how serpentine the structure is. Thankyou for your detective work @AllanP

I will give this a shot @Barry Kelly, thanks for your time looking into this. I'll post the hacked label if I'm able to get it to work.

Thanks for your PS @AllanP 

 

I got it to work with this. It will be a very useful label now 🙂

I just need include an IF statement to check if there is a ":" in there and it will be good to go!

 

 

! ==============================================================================
"collect_content":
! ------------------------------------------------------------------------------
! ==============================================================================
nTrans = 0
 
_nRowLabel = 0
dim _sRowsOfLabel[][]
_sRowsOfLabel[1][1] = ""
dim _sContentStringsHead[][]
_sContentStringsHead[1][1] = ""
 
gosub "call_general_label_macro"! returned text array, _nRowLabel, _sRowsOfLabel
_sContentStringsHead = _sRowsOfLabel
 
!split surface to code
string = _sContentStringsHead[1][5]
iDotPos = STRSTR (string, ":")
code = STRSUB (string, 1, iDotPos - 1)
_sContentStringsHead[1][5] = code
 
return

 

 

Setup info provided by author