BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Custom Property Label - Text Orientation

TJ Admin
Booster

Can someone please show me how to change the script to the existing Property Label so I can use it in a vertical application please. I just want to be able to keep the text horizontal. And the leader in the centre.

TJAdmin_0-1694070440651.png

I tried all these settings in the parameters (variables), but it made no change.

TJAdmin_1-1694070786340.png

 

2 REPLIES 2
Kevin Lee
Enthusiast
I think the script below will help keep the text in horizontal orientation.
 
rrr= REQUEST ("view_rotangle", "", angleViewRotation)
ww=angleViewRotation

IF ww>90 and ww<=180 then
ROT2 180-ww
ENDIF

IF ww<=270 and ww>180 then
ROT2 180-ww
ENDIF

IF ww>270 and ww<=360 then
ROT2 -ww
ENDIF

IF ww>0 and ww<= 90 THEN 
ROT2 -ww
ENDIF
Kevin Lee

Director of Technology | BIM

TZG Architects

In my script, what position do I add your addendum to? Still a bit green with GDL. Do I have to add a parameter  (variable)?

I used the Archicad 26 and re-saved it as a custom label. Thanks so much for your input!

TJAdmin_0-1694076694651.png

 

! ==============================================================================
! Functions:
! - Offered Tools: all
! - Content: Name and ID and Material
! - Size: paper size
! ==============================================================================
_isPreview = (GLOB_CONTEXT = 5)
_paperToModel = GLOB_SCALE/1000

! resizing paper size parameters values to model length
widthTextBoxContent_mm = widthTextBoxContent_mm * _paperToModel
widthHead_mm = widthHead_mm * _paperToModel
heightHead_mm = heightHead_mm * _paperToModel
distanceLabelHead_mm = distanceLabelHead_mm * _paperToModel
thkLeaderLine_mm = thkLeaderLine_mm * _paperToModel
lengthExtensionLine_mm = lengthExtensionLine_mm * _paperToModel
thkExtensionLine_mm = thkExtensionLine_mm * _paperToModel

gosub "install_label_position"

gosub "collect_content"

gosub "position_and_draw_label"

! ==============================================================================
END !END !END !END !END !END !END !END !END !END !END
! ==============================================================================

! ==============================================================================
"install_label_position":
! ------------------------------------------------------------------------------
! Label positioning - global behavior for Marker form Labels
! - origin is where AC gives, the table begins with top left anchor
! - orientation is rotated with the parent structure by default
! - without AC Arrow
! - drawing the full symbol marker form
! - the origin is at the arrow peak
! - rotating with parent elem direction
! - Reference Point is cordinated by user
! - with AC Arrow
! - drawing only the head text
! - the origin is at the boundary
! - handling of rotation is belongs to AC (AC_CustomReadabilty OFF)
! - Reference Point is cordinated at Pointer tabpage
!
! LABEL_POSITION - position of the label
! - array[3][2] containing the coordinates of the 3 points defining the label position
!
! - the other transformations live in the label_marker_macro
! ==============================================================================

nTrans = 0

if not(LABEL_HAS_POINTER) then

add2 LABEL_POSITION [2][1] + LABEL_POSITION [3][1],
LABEL_POSITION [2][2] + LABEL_POSITION [3][2]

endif

return

! ==============================================================================
"collect_content":
! ------------------------------------------------------------------------------
! ==============================================================================
nTrans = 0

_nRowLabel = 0
dim _sRowsOfLabel[][]
_sRowsOfLabel[1][1] = ""
dim _sContentStringsHead[][]
_sContentStringsHead[1][1] = ""

_sSeparator = " "
_sSuffixName = ""
_sSuffixID = ""

dim _iUnitLocal[12]
for iA = 1 to 12
_iUnitLocal[iA] = 0 ! no need unit
next iA

if i1stRowContent <> CONTENT_PROPERTY then
_i1stRowContent = i1stRowContent
_stCustomText1 = stCustomText1
else
_stPropertyValue = ""
_i1stRowContent = CONTENT_CUSTOM
_stPropertyID = stPropertyID1
gosub "getPropertyValue"
_stCustomText1 = _stPropertyValue
endif

dim _iSelectedContent[]
_iSelectedContent[1]= _i1stRowContent
_iIDText = iIDText1
_sSuffixID = _sSeparator
_sSuffixName = _sSeparator
_stCustomText = _stCustomText1 + _sSeparator
gosub "call_general_label_macro" ! returned text array, _nRowLabel, _sRowsOfLabel
_sContentStringsHead = _sRowsOfLabel
_numRow = vardim1(_sContentStringsHead)
_numColu = vardim2(_sContentStringsHead)

if b2ndRowContent then

if i2ndRowContent <> CONTENT_PROPERTY then
_i2ndRowContent = i2ndRowContent
_stCustomText2 = stCustomText2
else
_stPropertyValue = ""
_i2ndRowContent = CONTENT_CUSTOM
_stPropertyID = stPropertyID2
gosub "getPropertyValue"
_stCustomText2 = _stPropertyValue
endif

dim _iSelectedContent[]
_iSelectedContent[1]= _i2ndRowContent
_iIDText = iIDText2
_sSuffixID = _sSeparator
_sSuffixName = _sSeparator
_stCustomText = _stCustomText2 + _sSeparator
gosub "call_general_label_macro" ! returned text array, _nRowLabel, _sRowsOfLabel
if iArrangeContent = ARRANGE_ROW then
for iRow = 1 to vardim1(_sRowsOfLabel)
for iColu = 1 to vardim2(_sRowsOfLabel)
_sContentStringsHead[iRow][_numColu + iColu] = _sRowsOfLabel[iRow][iColu]
next iColu
next iRow
else
for iRow = 1 to vardim1(_sRowsOfLabel)
for iColu = 1 to vardim2(_sRowsOfLabel)
_sContentStringsHead[_numRow + iRow][iColu] = _sRowsOfLabel[iRow][iColu]
next iColu
next iRow
endif
_numRow = vardim1(_sContentStringsHead)
_numColu = vardim2(_sContentStringsHead)
endif

if b3rdRowContent then

if i3rdRowContent <> CONTENT_PROPERTY then
_i3rdRowContent = i3rdRowContent
_stCustomText3 = stCustomText3
else
_stPropertyValue = ""
_i3rdRowContent = CONTENT_CUSTOM
_stPropertyID = stPropertyID3
gosub "getPropertyValue"
_stCustomText3 = _stPropertyValue
endif

dim _iSelectedContent[]
_iSelectedContent[1]= _i3rdRowContent
_iIDText = iIDText3
_sSuffixID = ""
_sSuffixName = ""
_stCustomText = _stCustomText3
gosub "call_general_label_macro" ! returned text array, _nRowLabel, _sRowsOfLabel
if iArrangeContent = ARRANGE_ROW then
for iRow = 1 to vardim1(_sRowsOfLabel)
for iColu = 1 to vardim2(_sRowsOfLabel)
_sContentStringsHead[iRow][_numColu + iColu] = _sRowsOfLabel[iRow][iColu]
next iColu
next iRow
else
for iRow = 1 to vardim1(_sRowsOfLabel)
for iColu = 1 to vardim2(_sRowsOfLabel)
_sContentStringsHead[_numRow + iRow][iColu] = _sRowsOfLabel[iRow][iColu]
next iColu
next iRow
endif
_numRow = vardim1(_sContentStringsHead)
_numColu = vardim2(_sContentStringsHead)
endif

return

! ==============================================================================
"position_and_draw_label":
! ------------------------------------------------------------------------------
! Text Style tabpage:
! LABEL_HAS_POINTER - built-in pointer ON/OFF
! - on/off 1 if the Use symbol arrow checkbox is checked, 0 otherwise
! AC_LabelPointerLineType - line type of the line of the arrow
! AC_LabelPointerPen - pen of the arrow
! AC_TextFont_1 - font name
! AC_TextSize_1 - text size
! AC_TextPen_1 - pen of the text
! AC_LabelTextBgrPen - text box background pen
! - 0 if opaque is off, the background pen otherwise
! AC_TextStyle_1 - font style in the settings dialog box
! - 0 - normal, otherwise j1 + 2*j2 + 4*j3 + 32*j6 + 64*j7 + 128*j8, j1 - bold, j2 - italic, j3 - underline, j6 - superscript, j7 - subscript, j8 - strikethrough
! - there is strikethrough and this global works well with define style{2} !
! AC_bLabelFrame - label frame on/off 1 if the label frame is checked, 0 otherwise
! LABEL_ROTANGLE - rotation angle using by AC (this rotation is not from GDL)
! AC_TextAlignment_1 - text alignment for full table
! - 1 - left aligned, 2 - center aligned, 3 - right aligned, 4 - full justified
! AC_TextLeading_1 - line spacing factor
! AC_TextCharWidthFactor_1 - width factor
! AC_TextCharSpaceFactor_1 - spacing factor
! ==============================================================================

_angleParentDirection = 0
if not(_isPreview) then
_angleParentDirection = LABEL_ASSOC_ELEM_ORIENTATION
endif

call "label_marker_form" parameters AC_CustomReadability = AC_CustomReadability,
bAlwaysReadable = AC_bLabelAlwaysReadable,
bEnableHeadWithPointer = 1,

! Position
iReferencePoint = 5,
AC_LabelOrientation = AC_LabelOrientation,
bFlipLabel = bFlipLabel,
!bMirrorLabel = bMirrorLabel,
angleParentPosition = _angleParentDirection,

! Paragraph Format
bEnablePrefixColumn = 0,
bUsePrefixColumn = 0,
bWrapText = AC_bLabelTextWrap,
widthTextBoxContent_mm = widthTextBoxContent_mm,
xFirstIndentParagraph = 0,
xLeftIndentParagraph = 0,
xRightIndentParagraph = 0,
xTabPositionParagraph = 0,
widthFactorTextBlock = AC_TextCharWidthFactor_1,
charspaceFactorTextBlock = AC_TextCharSpaceFactor_1,
iFixedHeightTextBlock = 0, ! fixed_height 1: the placed TEXTBLOCK will be scale-independent and all specified length type parameters will mean millimeters, !
!0: the placed TEXTBLOCK will be scale-dependent and all specified length type parameters will mean meters in model space

! Head apperance
sContentStringsHead = _sContentStringsHead,
bEnableCustomHeaderStyle = 0,
penTextHeader = AC_TextPen_1,
fontTypeHeader = AC_TextFont_1,
sizeFontHeader_mm = AC_TextSize_1,
iTextStyle = AC_TextStyle_1,
iAlignmentHeader = AC_TextAlignment_1, ! 1: left aligned, 2: center aligned, 3: right aligned, 4: full justified
sizeLeadingHeader = AC_TextLeading_1,
widthTextBoxOffset = AC_LabelFrameOffset * _paperToModel,

! Body skin list appearance
bUseTextBoxOnLine = 0,

! Label Head Representation
bEnableHeadSwitch = 0, ! Enable to switch the Show Label Head ON-OFF
bShowHead = 1,
iShapeHead = iShapeHead,
bFitFrameToText = bFitFrameToText,
widthHead_mm = widthHead_mm,
heightHead_mm = heightHead_mm,
bLinkSizes = bLinkSizes,
bShowHeadContour = AC_bLabelFrame,
penHead = AC_LabelPointerPen,
lineTypeHead = AC_LabelPointerLineType,
bShowFill = 1,
penForeground = _AC_LabelTextBgrPen,
penBackground = _AC_LabelTextBgrPen,
bEnableSeparatorLine = _bEnableSeparatorLine,
bShowSeparatorLines = bShowSeparatorLines,

! Label Line Representation
distanceLabelHead_mm = distanceLabelHead_mm,
bEnableLeaderLine = 1,
bShowLeaderLine = bShowLeaderLine,
penLeaderLine = AC_LabelPointerPen,
linetypeLeaderLine = AC_LabelPointerLineType,
iLeaderLineStyle = iLeaderLineStyle,
thkLeaderLine_mm = thkLeaderLine_mm,
iExtensionLineStyle = iExtensionLineStyle,
lengthExtensionLine_mm = lengthExtensionLine_mm,
thkExtensionLine_mm = thkExtensionLine_mm,

bDebug = 0

del nTrans : nTrans = 0

return


! ==============================================================================
"getPropertyValue":
! ==============================================================================
dim propertyValues[]
m = request ("Property_Value_Of_Parent", _stPropertyID, _typeValue, dim1, dim2, propertyValues)

if m > 3 then
_stLengthFormat = ""
_stAreaFormat = ""
_stVolumeFormat = ""
_stAngleFormat = ""

m = request ("Calc_length_unit", "", _stLengthFormat)
m = request ("Calc_area_unit", "", _stAreaFormat)
m = request ("Calc_volume_unit", "", _stVolumeFormat)
m = request ("Calc_angle_unit", "", _stAngleFormat)

for j = 1 to vardim1(propertyValues)
if j > 1 then
_stPropertyValue = _stPropertyValue + "; "
endif

if _typeValue = PROPVAL_STRING then
_stPropertyValue = _stPropertyValue + propertyValues[j]
else
if _typeValue = PROPVAL_REALNUM then
_stPropertyValue = _stPropertyValue + str ("%.2", propertyValues[j])
else
if _typeValue = PROPVAL_INT then
_stPropertyValue = _stPropertyValue + str ("%.0", propertyValues[j])
else
if _typeValue = PROPVAL_BOOL then
if propertyValues[j] > 0 then
_stPropertyValue = _stPropertyValue + `TRUE`
else
_stPropertyValue = _stPropertyValue + `FALSE`
endif
else
if _typeValue = PROPVAL_LENGTH then
_stPropertyValue = _stPropertyValue + str(_stLengthFormat, propertyValues[j])
else
if _typeValue = PROPVAL_AREA then
_stPropertyValue = _stPropertyValue + str(_stAreaFormat, propertyValues[j])
else
if _typeValue = PROPVAL_VOLUME then
_stPropertyValue = _stPropertyValue + str(_stVolumeFormat, propertyValues[j])
else
if _typeValue = PROPVAL_ANGLE then
_stPropertyValue = _stPropertyValue + str(_stAngleFormat, propertyValues[j])
else
_stPropertyValue = _stPropertyValue ! Undefined Value Type
endif
endif
endif
endif
endif
endif
endif
endif
next j
else
_stPropertyValue = "---"
endif

return


! ==============================================================================
"call_general_label_macro":
! ------------------------------------------------------------------------------
! input:
! i1stRowContent, i2ndRowContent, i3rdRowContent
! iIDPlacing
! _sSeparator
! iIDText
!
! input variable
! totalRotate
! _drawContent - 0 - calculating only, 1 - draw text
!
! output variable:
! _widthTextBlock, _heightTextBlock
! ==============================================================================

_nRowLabel = 0
dim tempsRowsOfLabel[]
tempsRowsOfLabel[1] = ""

call "label_content_macro" parameters all iSelectedContent = _iSelectedContent,
iUnitLocal = _iUnitLocal,
bUseInSingleRank = 0,

bUsePrefixColumn = 0,

bShowSuperScript = 1,
bShowUnit = 0,
bShow2D = 0,

iIDText = _iIDText,
sPrefixID = "",
sSuffixID = _sSuffixID,

sPrefixName = "",
sSuffixName = _sSuffixName,

sTextDataCustom = _stCustomText,

returned_parameters _nRowLabel, tempsRowsOfLabel

! making from one dimensioned array to two dimensioned
idx = 0
dim _sRowsOfLabel[][]
_sRowsOfLabel[1][1] = ""
for i = 1 to _nRowLabel
for j = 1 to 9 ! no need the full 48 cells, there is only one content by macrocalling (1 content need 9 cells)
_sRowsOfLabel[i][j] = tempsRowsOfLabel[idx + j]
next j
idx = idx + 48
next i
return
Learn and get certified!