GDL
About building parametric objects with GDL.
SOLVED!

GDL Script Transformation Order

Samuel1997
Booster

Hi guys, 

I've started making my way through learning GDL, using the Reference guides, and mostly via modifying existing scripts and checking various outcomes.

Current project is to restructure the 2D Dimension display of the Archicad 24 gs_dw_Marker

Specifically the Dimension Style = DIMSTYLE_1LINE

My query is how is the structure of the code dictates String Text before the Length Values : Ref Image Below

W 24 Marker - Standard.png

By replacing & switching the _lengthHeightValue with the _lengthWidthValue i can control the values, but how is the flow control statements, structuring the position order of the string text before the Length Values.

 

I understand its my lack of basic script knowledge, but i struggle to learn without direct application, so reading the reference guide is only helpful to an extent.

Refer to the Script Below, I've listed my values to be replaced in red, with there substitutes in pink.

 

  • ! ==============================================================================
    ! Show Width/Height
    ! ==============================================================================
    _nTrans = 0

    if AC_WidHei_On then
    textAngleWH = textAngle
    if iDimensionStyle = DIMSTYLE_2LINES and (iDimensionsDir = DIRVALUES_ALIGNED) then
    textAngleWH = textAngle + 90
    if textAngle >= 360 then
    textAngleWH = textAngle - 360
    endif
    endif

    add2 markerOffsetModel, 0
    rot2 90
    _nTrans = _nTrans + 2

    if iMarkerSizeUnit = 1 then
    hotspot2 0, 0, unID, whDistM, 1+1024+128, whDistMm
    hotspot2 -1, 0, unID+1, whDistM, 3+1024, whDistMm
    hotspot2 whDistModel,0, unID+2, whDistM, 2+1024, whDistMm
    endif
    if iMarkerSizeUnit = 2 then
    hotspot2 0, 0, unID, whDistM, 1+1024+128, whDistCm
    hotspot2 -1, 0, unID+1, whDistM, 3+1024, whDistCm
    hotspot2 whDistModel,0, unID+2, whDistM, 2+1024, whDistCm
    endif
    if iMarkerSizeUnit = 3 then
    hotspot2 0, 0, unID, whDistM, 1+1024+128, whDistPoint
    hotspot2 -1, 0, unID+1, whDistM, 3+1024, whDistPoint
    hotspot2 whDistModel,0, unID+2, whDistM, 2+1024, whDistPoint
    endif

    define style{2} "extraStyle2" _textFont2, _textSize2, _textStyle2 + 32
    define style{2} "extraStyle3" _textFont3, _textSize3, _textStyle3 + 32

    if iDimensionStyle = DIMSTYLE_2LINES then

    if bShowWidthHeight then
    if textAngleWH > (gs_readable_angle + eps) & textAngleWH < (gs_readable_angle + 180 + eps) & AC_Readable then
    bSwitchTexts = 1
    else
    bSwitchTexts = 0
    endif

    _textPen = _textPen3

    _iUnitTypeByContent = 7 ! "Windor_Door_Dimension"

    if GS_iCustomText_3 = CTXT_CUSTOMTEXT then
    _horAlign = 3
    note1 = AC_MarkerText_3
    note2 = ""
    note3 = ""
    note4 = ""
    else
    _lengthValue = _lengthHeightValue
    _horAlign = 3
    _TextFont = _textFont3
    _TextSize = _textSize3
    _TextStyle = _textStyle3
    _szPrefix = ""

    gosub "call_quantity_formatter"
    endif

    if iDimensionsDir = DIRVALUES_ALIGNED then
    posX = whDistModel / PAPER_TO_MODEL
    if bSwitchTexts then
    posY = _textSize3 / 2
    else
    posY = -1.5 * _textSize3
    endif
    else
    del 1
    _nTrans = _nTrans - 1
    _posXPerpendicular = max (stw(AC_MarkerText_2), stw(AC_MarkerText_3)) / 2
    posX = _posXPerpendicular
    posY = whDistModel / PAPER_TO_MODEL - 1.5 * _textSize3
    endif
    style1 = "mtext3style"
    style2 = "extraStyle3"
    style3 = "mtext3style"
    style4 = "mtext3style"
    notesize = _textSize3
    angle = textAngleWH
    enabled = AC_Readable
    iMarkerDir = DIRVALUES_PERPEND
    _bWidHei = 1

    gosub "Print_text_considering_readability"

    if GS_iCustomText_2 = CTXT_CUSTOMTEXT then
    _horAlign = 3
    note1 = AC_MarkerText_2
    note2 = ""
    note3 = ""
    note4 = ""
    else
    _lengthValue = _lengthWidthValue
    _horAlign = 3
    _TextFont = _textFont2
    _TextSize = _textSize2
    _TextStyle = _textStyle2
    _szPrefix = ""

    gosub "call_quantity_formatter"
    endif

    if iDimensionsDir = DIRVALUES_ALIGNED then
    posX = whDistModel / PAPER_TO_MODEL
    if bSwitchTexts then
    posY = -1.5 * _textSize2
    else
    posY = _textSize2 / 2
    endif
    else
    posX = _posXPerpendicular
    posY = whDistModel / PAPER_TO_MODEL + _textSize2 / 2
    endif
    _textPen = _textPen2
    style1 = "mtext2style"
    style2 = "extraStyle2"
    style3 = "mtext2style"
    style4 = "mtext2style"
    notesize = _textSize2
    angle = textAngleWH
    enabled = AC_Readable
    iMarkerDir = DIRVALUES_PERPEND
    _bWidHei = 1

    gosub "Print_text_considering_readability"
    endif

    del 1
    _nTrans = _nTrans - 1

    else ! iDimensionStyle = DIMSTYLE_1LINE
    del 1
    _nTrans = _nTrans - 1

    ! --- Dimensions with separator ---

    _iUnitTypeByContent = 7 ! "Windor_Door_Dimension"

    if AC_WidHei_On then

    _formattedWidth = ""
    _formattedHeight = ""
    _formattedWExtra = ""
    _formattedHExtra = ""

    _horAlign = 3
    _TextFont = _textFont2
    _TextSize = _textSize2
    _TextStyle = _textStyle2
    _szPrefix = ""

    if GS_iCustomText_2 = CTXT_CUSTOMTEXT then
    _formattedWidth = stWidHeiPrefix + AC_MarkerText_2
    else
    _lengthValue = _lengthWidthValue_lengthHeightValue
    _szPrefix = stWidHeiPrefix

    gosub "call_quantity_formatter"

    ! store returned formatted text
    _formattedWidth = note1
    _formattedWExtra = note2
    endif

    if GS_iCustomText_3 = CTXT_CUSTOMTEXT then
    _formattedHeight = stWidHeiSep + AC_MarkerText_3
    else
    _lengthValue = _lengthHeightValue_lengthWidthValue
    _szPrefix = stWidHeiSep

    gosub "call_quantity_formatter"

    ! store returned formatted text
    _formattedHeight = note1
    _formattedHExtra = note2
    endif

    note1 = _formattedWidth
    note2 = _formattedWExtra
    note3 = _formattedHeight
    note4 = _formattedHExtra
    style1 = "mtext2style"
    style2 = "extraStyle2"
    style3 = "mtext2style"
    style4 = "extraStyle2"
    notesize = _textSize2 !+_textSize2/3
    angle = textAngleWH
    enabled = AC_Readable
    iMarkerDir = iDimensionsDir

    if _formattedHExtra <> "" or _formattedWExtra <> "" then
    _increaseTextSize = 1
    else
    _increaseTextSize = -1
    endif

    posY = whDistModel / PAPER_TO_MODEL

    if (angle > (gs_readable_angle + eps) & angle < (gs_readable_angle + 180 + eps) & enabled & iMarkerDir = DIRVALUES_PERPEND) | \
    (angle > (gs_readable_angle - 90 + eps) & angle < (gs_readable_angle + 180 - 90 + eps) & enabled & iMarkerDir = DIRVALUES_ALIGNED) then

    posX = stw (_formattedWidth) + stw (_formattedWExtra)*2/3*_increaseTextSize + stw (stWidHeiSep) / 2
    else
    posX = stw (_formattedHeight) + (stw (_formattedHExtra))*2/3*_increaseTextSize - stw (stWidHeiSep) / 2
    endif

    if iMarkerDir = DIRVALUES_ALIGNED then
    add2 -notesize/3*PAPER_TO_MODEL, 0
    endif

    _bWidHei = 1

    _textPen = _textPen2

    gosub "Print_text_considering_readability"

    if iMarkerDir = DIRVALUES_ALIGNED then
    del 1
    endif
    endif
    endif
    else
    ! visible, movable and dimensionable hotspot is moved and locekd
    hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
    endif
    unID = unID + 3
    del _nTrans
    _nTrans = 0

 

AC24
Win11 | 12th gen i-7 | 32GB | RTX 3070 Ti
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Samuel1997
Booster

Hey guys, so, i just finished my workaround for the issue.

 

I created a copy of the : gosub "Print text considering readability"

Saved as : "Print text considering readability2"

Then just Modified the go sub referenced in the Width & Height script to match the new one, then changed the "Print text considering readability2" Script as per Palawats idea in cancelling out the remainder of the paragraph and adding the required code into the note1 Line!

 

This way the other data inputs / Show Parapet / Show  Location / Ect. can still refer and use the original "Print Text Ect" Plotting Script.

 

Ive attached below the finished 2D Script Below for record:

 


! ==============================================================================
! Initializations
! ==============================================================================

PAPER_TO_MODEL = GLOB_SCALE / 1000 ! Convert paper size to model size

AC_MarkerSize = AC_MarkerSize * PAPER_TO_MODEL

headDistModel = headDistM * GLOB_SCALE
footLengthModel = footLengthM * GLOB_SCALE
markerOffsetModel = markerOffsetM * GLOB_SCALE
whDistModel = whDistM * GLOB_SCALE
sillDistModel = sillDistM * GLOB_SCALE
sillOffsetModel = sillOffsetM * GLOB_SCALE
fireDistModel = fireDistM * GLOB_SCALE
fireOffsetModel = fireOffsetM * GLOB_SCALE
acousticDistModel = acousticDistM * GLOB_SCALE
acousticOffsetModel = acousticOffsetM * GLOB_SCALE
uvalueDistModel = uvalueDistM * GLOB_SCALE
uvalueOffsetModel = uvalueOffsetM * GLOB_SCALE
locationDistModel = locationDistM * GLOB_SCALE
locationOffsetModel = locationOffsetM * GLOB_SCALE
widthHeadModel = widthHead_mm * PAPER_TO_MODEL
unID = 1

note1 = ""
note2 = ""
note3 = ""
note4 = ""

lengthOfNote1 = 0
lengthOfNote2 = 0
lengthOfNote3 = 0
lengthOfNote4 = 0
_increaseTextSize = 0
_iUnitTypeByContent = 0

if AC_WIDO_TYPE = 3 then
Skylight_B = 0
succ1 = REQUEST ("ASSOCLP_PARVALUE", "B", Dummy, Dummy, Dummy, Dummy, Dummy, temp_Skylight_B)
if succ1 then Skylight_B = temp_Skylight_B

Skylight_roofang = 0
succ2 = REQUEST ("ASSOCLP_PARVALUE", "ac_roofang", Dummy, Dummy, Dummy, Dummy, Dummy, temp_Skylight_roofang)
if succ2 then Skylight_roofang = temp_Skylight_roofang

gs_marker_text_dist = 0
succ3 = REQUEST ("ASSOCLP_PARVALUE", "gs_marker_text_dist", Dummy, Dummy, Dummy, Dummy, Dummy, temp_gs_marker_text_dist)
if succ3 then gs_marker_text_dist = temp_gs_marker_text_dist

if (succ1 & succ2) | succ3 then
if succ3 then
upbott_text_dist = gs_marker_text_dist
else
upbott_text_dist = Skylight_B * abs(cos(Skylight_roofang))
endif
else
upbott_text_dist = AC_WALL_THICKNESS
endif
else
upbott_text_dist = AC_WALL_THICKNESS
endif

! --- Oriented View ------------------------------------------------------------

angleViewRot = 0
if AC_Readable then
rrr = REQUEST ("View_Rotangle", "", angleViewRot)
endif
totalRotate = (SYMB_ROTANGLE + angleViewRot) MOD 360

textAngle = totalRotate

! --- Hotspot ------------------------------------------------------------
! The unused, visible, dimensionable hotspots are locked (black) and moved to (or next to) the opening's center hotspot

if (AC_WIDO_REVEAL_SIDE @ AC_SameSide) then
! Depends on the Opening's flip and the Marker's flip transformations are added earlier
_yDoorCenterPoint = -AC_WALL_THICKNESS
else
_yDoorCenterPoint = 0
endif

! ==============================================================================
! 2D Degradation
! ==============================================================================

if GLOB_CONTEXT < 20 then
bShowSillHeight = 1
bShowWidthHeight = 1
bShowID = 1
bShowDrawing = 1
bShowFire = 1
bShowAcoustic = 1
bShowUvalue = 1
bShowLocation = 1
else
! feedback mode
bShowSillHeight = (gs_GLOB_MODPAR_NAME = "sillDistM" | gs_GLOB_MODPAR_NAME = "sillOffsetM")
bShowWidthHeight = (gs_GLOB_MODPAR_NAME = "whDistM")
bShowID = 0
bShowDrawing = (gs_GLOB_MODPAR_NAME = "headDistM" | \
gs_GLOB_MODPAR_NAME = "footLengthM" | \
gs_GLOB_MODPAR_NAME = "markerOffsetM")
bShowFire = (gs_GLOB_MODPAR_NAME = "fireDistM" | gs_GLOB_MODPAR_NAME = "fireOffsetM")
bShowAcoustic = (gs_GLOB_MODPAR_NAME = "acousticDistM" | gs_GLOB_MODPAR_NAME = "acousticOffsetM")
bShowUvalue = (gs_GLOB_MODPAR_NAME = "uvalueDistM" | gs_GLOB_MODPAR_NAME = "uvalueOffsetM")

bShowLocation = (gs_GLOB_MODPAR_NAME = "locationillDistM" | gs_GLOB_MODPAR_NAME = "locationOffsetM")
endif


! ==============================================================================
! Positioning on left or right side
! ==============================================================================

if AC_WIDO_TYPE = 3 then
if ( not( abs(AC_SKYL_ROTANGLE)>EPS exor AC_SameSide)) & not(bDefaultElem & GLOB_CONTEXT = 5) then
rot2 180
textAngle = textAngle + 180
if textAngle >= 360 then
textAngle = textAngle - 360
endif
endif
if Skylight_roofang > 90 + EPS then add2 0, upbott_text_dist
if AC_SameSide then
if Skylight_roofang > 90 then
add2 0, -upbott_text_dist
else
add2 0, upbott_text_dist
endif
endif
else
if AC_WIDO_REVEAL_SIDE = AC_SameSide & not(bDefaultElem & GLOB_CONTEXT = 5) then
rot2 180
add2 0, upbott_text_dist
textAngle = textAngle + 180
if textAngle >= 360 then
textAngle = textAngle - 360
endif
endif
endif


! ==============================================================================
! Drawing Lines
! ==============================================================================

pen SYMB_VIEW_PEN

if GS_Center_Line then
! All hotspots in the ends of the line
! X direction moving hotspots
if iMarkerSizeUnit = 1 then
hotspot2 0, headDistModel, unID, markerOffsetM, 1+1024+128, markerOffsetMm
hotspot2 -1, headDistModel, unID+1, markerOffsetM, 3+1024, markerOffsetMm
hotspot2 markerOffsetModel, headDistModel, unID+2, markerOffsetM, 2+1024, markerOffsetMm
unID = unID + 3

hotspot2 0, -upbott_text_dist - footLengthModel, unID, markerOffsetM, 1+1024+128, markerOffsetMm
hotspot2 -0.1, -upbott_text_dist - footLengthModel, unID+1, markerOffsetM, 3+1024, markerOffsetMm
hotspot2 markerOffsetModel, -upbott_text_dist - footLengthModel, unID+2, markerOffsetM, 2+1024, markerOffsetMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 0, headDistModel, unID, markerOffsetM, 1+1024+128, markerOffsetCm
hotspot2 -1, headDistModel, unID+1, markerOffsetM, 3+1024, markerOffsetCm
hotspot2 markerOffsetModel, headDistModel, unID+2, markerOffsetM, 2+1024, markerOffsetCm
unID = unID + 3

hotspot2 0, -upbott_text_dist - footLengthModel, unID, markerOffsetM, 1+1024+128, markerOffsetCm
hotspot2 -0.1, -upbott_text_dist - footLengthModel, unID+1, markerOffsetM, 3+1024, markerOffsetCm
hotspot2 markerOffsetModel, -upbott_text_dist - footLengthModel, unID+2, markerOffsetM, 2+1024, markerOffsetCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 0, headDistModel, unID, markerOffsetM, 1+1024+128, markerOffsetPoint
hotspot2 -1, headDistModel, unID+1, markerOffsetM, 3+1024, markerOffsetPoint
hotspot2 markerOffsetModel, headDistModel, unID+2, markerOffsetM, 2+1024, markerOffsetPoint
unID = unID + 3

hotspot2 0, -upbott_text_dist - footLengthModel, unID, markerOffsetM, 1+1024+128, markerOffsetPoint
hotspot2 -0.1, -upbott_text_dist - footLengthModel, unID+1, markerOffsetM, 3+1024, markerOffsetPoint
hotspot2 markerOffsetModel, -upbott_text_dist - footLengthModel, unID+2, markerOffsetM, 2+1024, markerOffsetPoint
unID = unID + 3
endif
! Y direction moving hotspots
if iMarkerSizeUnit = 1 then
hotspot2 markerOffsetModel, 0, unID, headDistM, 1+1024+128, headDistMm
hotspot2 markerOffsetModel, -0.1, unID+1, headDistM, 3+1024, headDistMm
hotspot2 markerOffsetModel, headDistModel, unID+2, headDistM, 2+1024, headDistMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 markerOffsetModel, 0, unID, headDistM, 1+1024+128, headDistCm
hotspot2 markerOffsetModel, -0.1, unID+1, headDistM, 3+1024, headDistCm
hotspot2 markerOffsetModel, headDistModel, unID+2, headDistM, 2+1024, headDistCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 markerOffsetModel, 0, unID, headDistM, 1+1024+128, headDistPoint
hotspot2 markerOffsetModel, -0.1, unID+1, headDistM, 3+1024, headDistPoint
hotspot2 markerOffsetModel, headDistModel, unID+2, headDistM, 2+1024, headDistPoint
unID = unID + 3
endif

if iMarkerSizeUnit = 1 then
hotspot2 markerOffsetModel, -upbott_text_dist, unID, footLengthM, 1+1024+128, footLengthMm
hotspot2 markerOffsetModel, -upbott_text_dist + 0.1, unID+1, footLengthM, 3+1024, footLengthMm
hotspot2 markerOffsetModel, -upbott_text_dist - footLengthModel, unID+2, footLengthM, 2+1024, footLengthMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 markerOffsetModel, -upbott_text_dist, unID, footLengthM, 1+1024+128, footLengthCm
hotspot2 markerOffsetModel, -upbott_text_dist + 0.1, unID+1, footLengthM, 3+1024, footLengthCm
hotspot2 markerOffsetModel, -upbott_text_dist - footLengthModel, unID+2, footLengthM, 2+1024, footLengthCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 markerOffsetModel, -upbott_text_dist, unID, footLengthM, 1+1024+128, footLengthPoint
hotspot2 markerOffsetModel, -upbott_text_dist + 0.1, unID+1, footLengthM, 3+1024, footLengthPoint
hotspot2 markerOffsetModel, -upbott_text_dist - footLengthModel, unID+2, footLengthM, 2+1024, footLengthPoint
unID = unID + 3
endif
else

if AC_ID_On then
! The ID's hotspots stay on the ID's center, the centerline's lower hotspots are moved and locekd
! ID's X directions hotspots
if iMarkerSizeUnit = 1 then
hotspot2 0, headDistModel, unID, markerOffsetM, 1+1024+128, markerOffsetMm
hotspot2 -1, headDistModel, unID+1, markerOffsetM, 3+1024, markerOffsetMm
hotspot2 markerOffsetModel, headDistModel, unID+2, markerOffsetM, 2+1024, markerOffsetMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 0, headDistModel, unID, markerOffsetM, 1+1024+128, markerOffsetCm
hotspot2 -1, headDistModel, unID+1, markerOffsetM, 3+1024, markerOffsetCm
hotspot2 markerOffsetModel, headDistModel, unID+2, markerOffsetM, 2+1024, markerOffsetCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 0, headDistModel, unID, markerOffsetM, 1+1024+128, markerOffsetPoint
hotspot2 -1, headDistModel, unID+1, markerOffsetM, 3+1024, markerOffsetPoint
hotspot2 markerOffsetModel, headDistModel, unID+2, markerOffsetM, 2+1024, markerOffsetPoint
unID = unID + 3

endif
! Centerline's lower X direction hotspot (only the visible, movable and dimensionable)
hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
unID = unID + 3

! ID's Y directions hotspots
if iMarkerSizeUnit = 1 then
hotspot2 markerOffsetModel, 0, unID, headDistM, 1+1024+128, headDistMm
hotspot2 markerOffsetModel, -0.1, unID+1, headDistM, 3+1024, headDistMm
hotspot2 markerOffsetModel, headDistModel, unID+2, headDistM, 2+1024, headDistMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 markerOffsetModel, 0, unID, headDistM, 1+1024+128, headDistCm
hotspot2 markerOffsetModel, -0.1, unID+1, headDistM, 3+1024, headDistCm
hotspot2 markerOffsetModel, headDistModel, unID+2, headDistM, 2+1024, headDistCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 markerOffsetModel, 0, unID, headDistM, 1+1024+128, headDistPoint
hotspot2 markerOffsetModel, -0.1, unID+1, headDistM, 3+1024, headDistPoint
hotspot2 markerOffsetModel, headDistModel, unID+2, headDistM, 2+1024, headDistPoint
unID = unID + 3
endif
! Centerline's lower Y direction hotspot (only the visible, movable and dimensionable)
hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
unID = unID + 3

else
! all (only the visible, movable and dimensionable) hotspots are moved and locekd
! ID's X directions hotspot
hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
unID = unID + 3
! Centerline's lower X direction hotspot
hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
unID = unID + 3
! ID's Y directions hotspot
hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
unID = unID + 3
! Centerline's lower Y direction hotspot
hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
unID = unID + 3
endif

endIf

if not(gs_OverrideTextFormat_1) then
_textFont1 = AC_TextFont_1
_textSize1 = AC_TextSize_1
_textStyle1 = AC_TextStyle_1
_textPen1 = AC_TextPen_1
else
_textFont1 = gs_TextFont_1
_textSize1 = gs_TextSize_1
_textStyle1 = gs_TextStyle_1
_textPen1 = gs_TextPen_1
endif
define style{2} "mtext1style" _textFont1, _textSize1, _textStyle1

if not(gs_OverrideTextFormat_2) then
_textFont2 = AC_TextFont_1
_textSize2 = AC_TextSize_1
_textStyle2 = AC_TextStyle_1
_textPen2 = AC_TextPen_1
else
_textFont2 = gs_TextFont_2
_textSize2 = gs_TextSize_2
_textStyle2 = gs_TextStyle_2
_textPen2 = gs_TextPen_2
endif
define style{2} "mtext2style" _textFont2, _textSize2, _textStyle2

if not(gs_OverrideTextFormat_3) then
_textFont3 = AC_TextFont_1
_textSize3 = AC_TextSize_1
_textStyle3 = AC_TextStyle_1
_textPen3 = AC_TextPen_1
else
_textFont3 = gs_TextFont_3
_textSize3 = gs_TextSize_3
_textStyle3 = gs_TextStyle_3
_textPen3 = gs_TextPen_3
endif
define style{2} "mtext3style" _textFont3, _textSize3, _textStyle3

if not(gs_OverrideTextFormat_4) then
_textFont4 = AC_TextFont_1
_textSize4 = AC_TextSize_1
_textStyle4 = AC_TextStyle_1
_textPen4 = AC_TextPen_1
else
_textFont4 = gs_TextFont_4
_textSize4 = gs_TextSize_4
_textStyle4 = gs_TextStyle_4
_textPen4 = gs_TextPen_4
endif
define style{2} "mtext4style" _textFont4, _textSize4, _textStyle4

if not(gs_OverrideTextFormat_5) then
_textFont5 = AC_TextFont_1
_textSize5 = AC_TextSize_1
_textStyle5 = AC_TextStyle_1
_textPen5 = AC_TextPen_1
else
_textFont5 = gs_TextFont_5
_textSize5 = gs_TextSize_5
_textStyle5 = gs_TextStyle_5
_textPen5 = gs_TextPen_5
endif
define style{2} "mtext5style" _textFont5, _textSize5, _textStyle5

if not(gs_OverrideTextFormat_6) then
_textFont6 = AC_TextFont_1
_textSize6 = AC_TextSize_1
_textStyle6 = AC_TextStyle_1
_textPen6 = AC_TextPen_1
else
_textFont6 = gs_TextFont_6
_textSize6 = gs_TextSize_6
_textStyle6 = gs_TextStyle_6
_textPen6 = gs_TextPen_6
endif
define style{2} "mtext6style" _textFont6, _textSize6, _textStyle6

if not(gs_OverrideTextFormat_7) then
_textFont7 = AC_TextFont_1
_textSize7 = AC_TextSize_1
_textStyle7 = AC_TextStyle_1
_textPen7 = AC_TextPen_1
else
_textFont7 = gs_TextFont_7
_textSize7 = gs_TextSize_7
_textStyle7 = gs_TextStyle_7
_textPen7 = gs_TextPen_7
endif
define style{2} "mtext7style" _textFont7, _textSize7, _textStyle7

if not(gs_OverrideTextFormat_8) then
_textFont8 = AC_TextFont_1
_textSize8 = AC_TextSize_1
_textStyle8 = AC_TextStyle_1
_textPen8 = AC_TextPen_1
else
_textFont8 = gs_TextFont_8
_textSize8 = gs_TextSize_8
_textStyle8 = gs_TextStyle_8
_textPen8 = gs_TextPen_8
endif
define style{2} "mtext8style" _textFont8, _textSize8, _textStyle8

! ==============================================================================
! Show ID
! ==============================================================================

pen _textPen1
style "mtext1style"

_textPen = _textPen1
_textStyle1 = "mtext1style"

frame_width = stw(" " + AC_MarkerText_1 + " ") * PAPER_TO_MODEL

if bShowDrawing & bMarkerHead then
drawindex 20
mask = 7
pen gs_cont_pen

if GS_MarkerFill then fill AC_MarkerFill

rotdir_angle = 0 ! iMarkerDir = DIRVALUES_PERPEND
if iMarkerDir = DIRVALUES_ALIGNED then rotdir_angle = 90
if iMarkerDir = DIRVALUES_HORIZONTAL then rotdir_angle = -textAngle
if iMarkerDir = DIRVALUES_VERTICAL then rotdir_angle = -textAngle + 90

! Circle, Ellipse - Marker Shape
! ----------------------------------------------------------------------
if iMarkerShape = SHAPE_CIRCLE or iMarkerShape = SHAPE_ELLIPSE then
if bFitMarkerToText then
_ratio = max((frame_width / AC_MarkerSize), 1)
else
_ratio = max((widthHeadModel / AC_MarkerSize), 1)
endif

add2 markerOffsetModel, headDistModel
if iMarkerShape = SHAPE_ELLIPSE then
rot2 rotdir_angle
mul2 _ratio, 1
endif

if bFitMarkerToText = 0 or iMarkerShape = SHAPE_ELLIPSE then
dx1 = AC_MarkerSize/2
else
dx1 = frame_width/2
endif

poly2_b 2, mask, gs_fill_pen, gs_back_pen,
0,0,901,
dx1,360,4001

if iMarkerShape = SHAPE_ELLIPSE then del 2
del 1

gosub "drawCenterLine"

else

dict _headPolygon ! used to cut marker line

! Oval - Marker Shape
! ----------------------------------------------------------------------

if iMarkerShape = SHAPE_OVAL then

add2 markerOffsetModel, headDistModel
rot2 rotdir_angle

if bDefaultElem then
dx1 = AC_MarkerSize/2
else
if not(bFitMarkerToText) then frame_width = widthHeadModel

if frame_width < AC_MarkerSize then
dx1 = AC_MarkerSize/2
else
dx1 = frame_width/2
endif
endif

poly2_b 7, mask, gs_fill_pen, gs_back_pen,
-dx1+AC_MarkerSize/2, AC_MarkerSize/2, 1,
dx1-AC_MarkerSize/2, AC_MarkerSize/2, 1,
dx1-AC_MarkerSize/2, 0, 901,
dx1-AC_MarkerSize/2, -AC_MarkerSize/2, 3001,
-dx1+AC_MarkerSize/2, -AC_MarkerSize/2, 1,
-1, 0, 801,
-dx1+AC_MarkerSize/2, AC_MarkerSize/2, 1001

del 2

! intersect horizontal shape with rotated line
_headPolygon.contour.edges[1].begPoint.x = -dx1 + AC_MarkerSize / 2
_headPolygon.contour.edges[1].begPoint.y = AC_MarkerSize / 2
_headPolygon.contour.edges[1].type = EDGE_STRAIGHT
_headPolygon.contour.edges[2].begPoint.x = dx1 - AC_MarkerSize / 2
_headPolygon.contour.edges[2].begPoint.y = AC_MarkerSize / 2
_headPolygon.contour.edges[2].type = EDGE_CURVED
_headPolygon.contour.edges[2].arcAngle = -180.0
_headPolygon.contour.edges[3].begPoint.x = dx1 - AC_MarkerSize / 2
_headPolygon.contour.edges[3].begPoint.y = -AC_MarkerSize / 2
_headPolygon.contour.edges[3].type = EDGE_STRAIGHT
_headPolygon.contour.edges[4].begPoint.x = -dx1 + AC_MarkerSize / 2
_headPolygon.contour.edges[4].begPoint.y = -AC_MarkerSize / 2
_headPolygon.contour.edges[4].type = EDGE_CURVED
_headPolygon.contour.edges[4].arcAngle = -180.0

gosub "drawCenterLine"

goto 100
endif

! Rectangle - Marker Shape
! ----------------------------------------------------------------------

if iMarkerShape = SHAPE_RECTANGLE then
add2 markerOffsetModel, headDistModel
rot2 rotdir_angle

if not(bFitMarkerToText) then frame_width = widthHeadModel
poly2_b 4, mask, gs_fill_pen, gs_back_pen,
-frame_width/2, -AC_MarkerSize/2, 1,
-frame_width/2, AC_MarkerSize/2, 1,
frame_width/2, AC_MarkerSize/2, 1,
frame_width/2, -AC_MarkerSize/2, 1
del 2

! intersect horizontal shape with rotated line
_headPolygon.contour.edges[1].begPoint.x = -frame_width / 2
_headPolygon.contour.edges[1].begPoint.y = -AC_MarkerSize / 2
_headPolygon.contour.edges[1].type = EDGE_STRAIGHT
_headPolygon.contour.edges[2].begPoint.x = -frame_width / 2
_headPolygon.contour.edges[2].begPoint.y = AC_MarkerSize / 2
_headPolygon.contour.edges[2].type = EDGE_STRAIGHT
_headPolygon.contour.edges[3].begPoint.x = frame_width / 2
_headPolygon.contour.edges[3].begPoint.y = AC_MarkerSize / 2
_headPolygon.contour.edges[3].type = EDGE_STRAIGHT
_headPolygon.contour.edges[4].begPoint.x = frame_width / 2
_headPolygon.contour.edges[4].begPoint.y = -AC_MarkerSize / 2
_headPolygon.contour.edges[4].type = EDGE_STRAIGHT

gosub "drawCenterLine"

else
! Diamond - Marker Shape
! ----------------------------------------------------------------------

if iMarkerShape = SHAPE_DIAMOND then
add2 markerOffsetModel, headDistModel
rot2 rotdir_angle

if not(bFitMarkerToText) then frame_width = widthHeadModel
poly2_b 4, mask, gs_fill_pen, gs_back_pen,
-frame_width/2, 0, 1,
0, AC_MarkerSize/2, 1,
frame_width/2, 0, 1,
0, -AC_MarkerSize/2, 1
del 2

! intersect horizontal shape (bottom half) with rotated line
_headPolygon.contour.edges[1].begPoint.x = -frame_width / 2
_headPolygon.contour.edges[1].begPoint.y = 0.0
_headPolygon.contour.edges[1].type = EDGE_STRAIGHT
_headPolygon.contour.edges[2].begPoint.x = 0.0
_headPolygon.contour.edges[2].begPoint.y = AC_MarkerSize / 2
_headPolygon.contour.edges[2].type = EDGE_STRAIGHT
_headPolygon.contour.edges[3].begPoint.x = frame_width / 2
_headPolygon.contour.edges[3].begPoint.y = 0.0
_headPolygon.contour.edges[3].type = EDGE_STRAIGHT
_headPolygon.contour.edges[4].begPoint.x = 0.0
_headPolygon.contour.edges[4].begPoint.y = -AC_MarkerSize / 2
_headPolygon.contour.edges[4].type = EDGE_STRAIGHT

gosub "drawCenterLine"

goto 100
endif

! Triangle - Marker Shape
! ----------------------------------------------------------------------

num = 3
alfa = 0

if iMarkerShape = SHAPE_TRIANGLE or iMarkerShape = SHAPE_TRIANGLEROT then
num = 3
if iMarkerShape = SHAPE_TRIANGLE then
alfa = 30
else
alfa = 90
endif
endif

! Square - Marker Shape
! ----------------------------------------------------------------------

if iMarkerShape = SHAPE_SQUARE or iMarkerShape = SHAPE_SQUAREROT then
num = 4
if iMarkerShape = SHAPE_SQUAREROT then
alfa = 0
else
alfa = 45
endif
endif


! Pentagon - Marker Shape
! ----------------------------------------------------------------------

if iMarkerShape = SHAPE_PENTAGON or iMarkerShape = SHAPE_PENTAGONROT then
num = 5
if iMarkerShape = SHAPE_PENTAGON then
alfa = 54
else
alfa = 90
endif
endif

! Hexagon - Marker Shape
! ----------------------------------------------------------------------

if iMarkerShape = SHAPE_HEXAGON or iMarkerShape = SHAPE_HEXAGONROT then
num = 6
if iMarkerShape = SHAPE_HEXAGON then
alfa = 90
else
alfa = 60
endif
endif

! Octagon - Marker Shape
! ----------------------------------------------------------------------

if iMarkerShape = SHAPE_OCTAGON or iMarkerShape = SHAPE_OCTAGONROT then
num = 8
if iMarkerShape = SHAPE_OCTAGON then
alfa = 0
else
alfa = 67.5
endif
endif

if bFitMarkerToText then
frame_width = frame_width
! From Incicle to Circumcircle, so the Text can fit in
if iMarkerShape = SHAPE_SQUARE then frame_width = frame_width / cos(45)
if iMarkerShape = SHAPE_TRIANGLE or iMarkerShape = SHAPE_TRIANGLEROT then frame_width = frame_width * 2
if iMarkerShape = SHAPE_PENTAGON or iMarkerShape = SHAPE_PENTAGONROT then frame_width = frame_width / cos(36)
if iMarkerShape = SHAPE_HEXAGON then frame_width = frame_width / cos(30)
if iMarkerShape = SHAPE_OCTAGON then frame_width = frame_width / cos(22.5)
else
frame_width = AC_MarkerSize
endif

gosub "drawCenterLine"

for i=1 to num
put markerOffsetModel+frame_width/2*cos(alfa), headDistModel+frame_width/2*sin(alfa), 1
alfa = alfa + 360 / num
next i

pen gs_cont_pen
poly2_b num, mask, gs_fill_pen, gs_back_pen,
get(nsp)
endif
endif
else
if bShowDrawing & GS_Center_Line then
drawindex 10
pen SYMB_VIEW_PEN
style_hght = 0
rrr = REQUEST("Height_of_style", "mtext1style", style_hght)

if iMarkerDir = DIRVALUES_ALIGNED then
line2 markerOffsetModel, headDistModel - AC_ID_On * frame_width/2,
markerOffsetModel, -upbott_text_dist - footLengthModel
else
line2 markerOffsetModel, headDistModel - AC_ID_On * (style_hght * PAPER_TO_MODEL)/2,
markerOffsetModel, -upbott_text_dist - footLengthModel
endif
endif
endif

100:


! ==============================================================================
! Show ID
! ==============================================================================


if bShowID & AC_ID_On then
add2 markerOffsetModel,0

_textPen = _textPen1

posX = 0
posY = headDistModel / PAPER_TO_MODEL - _textSize1 / 2
_horAlign= 2
note1 = AC_MarkerText_1
note2 = ""
note3 = ""
note4 = ""
style1 = "mtext1style"
style2 = "mtext1style"
style3 = "mtext1style"
style4 = "mtext1style"
notesize = _textSize1
angle = textAngle
enabled = AC_Readable
_bWidHei = 0

gosub "Print_text_considering_readability"

del 1
endif


! ==============================================================================
! Show Width/Height
! ==============================================================================
_nTrans = 0

if AC_WidHei_On then
textAngleWH = textAngle
if iDimensionStyle = DIMSTYLE_2LINES and (iDimensionsDir = DIRVALUES_ALIGNED) then
textAngleWH = textAngle + 90
if textAngle >= 360 then
textAngleWH = textAngle - 360
endif
endif

add2 markerOffsetModel, 0
rot2 90
_nTrans = _nTrans + 2

if iMarkerSizeUnit = 1 then
hotspot2 0, 0, unID, whDistM, 1+1024+128, whDistMm
hotspot2 -1, 0, unID+1, whDistM, 3+1024, whDistMm
hotspot2 whDistModel,0, unID+2, whDistM, 2+1024, whDistMm
endif
if iMarkerSizeUnit = 2 then
hotspot2 0, 0, unID, whDistM, 1+1024+128, whDistCm
hotspot2 -1, 0, unID+1, whDistM, 3+1024, whDistCm
hotspot2 whDistModel,0, unID+2, whDistM, 2+1024, whDistCm
endif
if iMarkerSizeUnit = 3 then
hotspot2 0, 0, unID, whDistM, 1+1024+128, whDistPoint
hotspot2 -1, 0, unID+1, whDistM, 3+1024, whDistPoint
hotspot2 whDistModel,0, unID+2, whDistM, 2+1024, whDistPoint
endif

define style{2} "extraStyle2" _textFont2, _textSize2, _textStyle2 + 32
define style{2} "extraStyle3" _textFont3, _textSize3, _textStyle3 + 32

if iDimensionStyle = DIMSTYLE_2LINES then

if bShowWidthHeight then
if textAngleWH > (gs_readable_angle + eps) & textAngleWH < (gs_readable_angle + 180 + eps) & AC_Readable then
bSwitchTexts = 1
else
bSwitchTexts = 0
endif

_textPen = _textPen3

_iUnitTypeByContent = 7 ! "Windor_Door_Dimension"

if GS_iCustomText_3 = CTXT_CUSTOMTEXT then
_horAlign = 3
note1 = AC_MarkerText_3
note2 = ""
note3 = ""
note4 = ""
else
_lengthValue = _lengthHeightValue
_horAlign = 3
_TextFont = _textFont3
_TextSize = _textSize3
_TextStyle = _textStyle3
_szPrefix = ""

gosub "call_quantity_formatter"
endif

if iDimensionsDir = DIRVALUES_ALIGNED then
posX = whDistModel / PAPER_TO_MODEL
if bSwitchTexts then
posY = _textSize3 / 2
else
posY = -1.5 * _textSize3
endif
else
del 1
_nTrans = _nTrans - 1
_posXPerpendicular = max (stw(AC_MarkerText_2), stw(AC_MarkerText_3)) / 2
posX = _posXPerpendicular
posY = whDistModel / PAPER_TO_MODEL - 1.5 * _textSize3
endif
style1 = "mtext3style"
style2 = "extraStyle3"
style3 = "mtext3style"
style4 = "mtext3style"
notesize = _textSize3
angle = textAngleWH
enabled = AC_Readable
iMarkerDir = DIRVALUES_PERPEND
_bWidHei = 1

gosub "Print_text_considering_readability"

if GS_iCustomText_2 = CTXT_CUSTOMTEXT then
_horAlign = 3
note1 = AC_MarkerText_2
note2 = ""
note3 = ""
note4 = ""
else
_lengthValue = _lengthWidthValue
_horAlign = 3
_TextFont = _textFont2
_TextSize = _textSize2
_TextStyle = _textStyle2
_szPrefix = ""

gosub "call_quantity_formatter"
endif

if iDimensionsDir = DIRVALUES_ALIGNED then
posX = whDistModel / PAPER_TO_MODEL
if bSwitchTexts then
posY = -1.5 * _textSize2
else
posY = _textSize2 / 2
endif
else
posX = _posXPerpendicular
posY = whDistModel / PAPER_TO_MODEL + _textSize2 / 2
endif
_textPen = _textPen2
style1 = "mtext2style"
style2 = "extraStyle2"
style3 = "mtext2style"
style4 = "mtext2style"
notesize = _textSize2
angle = textAngleWH
enabled = AC_Readable
iMarkerDir = DIRVALUES_PERPEND
_bWidHei = 1

gosub "Print_text_considering_readability"
endif

del 1
_nTrans = _nTrans - 1

else ! iDimensionStyle = DIMSTYLE_1LINE
del 1
_nTrans = _nTrans - 1

! --- Dimensions with separator ---

_iUnitTypeByContent = 7 ! "Windor_Door_Dimension"

if AC_WidHei_On then

_formattedHeight = ""
_formattedWidth = ""
_formattedHExtra = ""
_formattedWExtra = ""

_horAlign = 3
_TextFont = _textFont2
_TextSize = _textSize2
_TextStyle = _textStyle2
_szPrefix = ""

if GS_iCustomText_2 = CTXT_CUSTOMTEXT then
_formattedHeight = stWidHeiPrefix + AC_MarkerText_2
else
_lengthValue = _lengthWidthValue

gosub "call_quantity_formatter"

! store returned formatted text
_formattedWidth = note1
_formattedWExtra = note2
endif

if GS_iCustomText_3 = CTXT_CUSTOMTEXT then
_formattedWidth = stWidHeiSep + AC_MarkerText_3
else
_lengthValue = _lengthHeightValue

gosub "call_quantity_formatter"

! store returned formatted text
_formattedHeight = note1
_formattedHExtra = note2
endif

note1 = _formattedHeight
note2 = _formattedHExtra
note3 = _formattedWidth
note4 = _formattedWExtra
style1 = "mtext2style"
style2 = "extraStyle2"
style3 = "mtext2style"
style4 = "extraStyle2"
notesize = _textSize2 !+_textSize2/3
angle = textAngleWH
enabled = AC_Readable
iMarkerDir = iDimensionsDir

if _formattedHExtra <> "" or _formattedWExtra <> "" then
_increaseTextSize = 1
else
_increaseTextSize = -1
endif

posY = whDistModel / PAPER_TO_MODEL

if (angle > (gs_readable_angle + eps) & angle < (gs_readable_angle + 180 + eps) & enabled & iMarkerDir = DIRVALUES_PERPEND) | \
(angle > (gs_readable_angle - 90 + eps) & angle < (gs_readable_angle + 180 - 90 + eps) & enabled & iMarkerDir = DIRVALUES_ALIGNED) then

posX = stw (_formattedWidth) + stw (_formattedWExtra)*2/3*_increaseTextSize + stw (stWidHeiSep) / 2
else
posX = stw (_formattedHeight) + (stw (_formattedHExtra))*2/3*_increaseTextSize - stw (stWidHeiSep) / 2
endif

if iMarkerDir = DIRVALUES_ALIGNED then
add2 -notesize/3*PAPER_TO_MODEL, 0
endif

_bWidHei = 1

_textPen = _textPen2

gosub "Print_text_considering_readability2"

if iMarkerDir = DIRVALUES_ALIGNED then
del 1
endif
endif
endif
else
! visible, movable and dimensionable hotspot is moved and locekd
hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
endif
unID = unID + 3
del _nTrans
_nTrans = 0

! ==============================================================================
! Show Parapet
! ==============================================================================

define style{2} "extraStyle4" _textFont4, _textSize4, _textStyle4 + 32

if AC_Sill_On then
add2 markerOffsetModel,0

if iMarkerSizeUnit = 1 then
hotspot2 sillOffsetModel, -upbott_text_dist, unID, sillDistM, 1+1024+128, sillDistMm
hotspot2 sillOffsetModel, -upbott_text_dist + 1, unID+1, sillDistM, 3+1024, sillDistMm
hotspot2 sillOffsetModel, -upbott_text_dist - sillDistModel, unID+2, sillDistM, 2+1024, sillDistMm
endif
if iMarkerSizeUnit = 2 then
hotspot2 sillOffsetModel, -upbott_text_dist, unID, sillDistM, 1+1024+128, sillDistCm
hotspot2 sillOffsetModel, -upbott_text_dist + 1, unID+1, sillDistM, 3+1024, sillDistCm
hotspot2 sillOffsetModel, -upbott_text_dist - sillDistModel, unID+2, sillDistM, 2+1024, sillDistCm
endif
if iMarkerSizeUnit = 3 then
hotspot2 sillOffsetModel, -upbott_text_dist, unID, sillDistM, 1+1024+128, sillDistPoint
hotspot2 sillOffsetModel, -upbott_text_dist + 1, unID+1, sillDistM, 3+1024, sillDistPoint
hotspot2 sillOffsetModel, -upbott_text_dist - sillDistModel, unID+2, sillDistM, 2+1024, sillDistPoint
endif
unID = unID + 3

if iMarkerSizeUnit = 1 then
hotspot2 0, -upbott_text_dist - sillDistModel, unID, sillOffsetM, 1+1024+128, sillOffsetMm
hotspot2 -1, -upbott_text_dist - sillDistModel, unID+1,sillOffsetM, 3+1024, sillOffsetMm
hotspot2 sillOffsetModel, -upbott_text_dist - sillDistModel, unID+2,sillOffsetM, 2+1024, sillOffsetMm
endif
if iMarkerSizeUnit = 2 then
hotspot2 0, -upbott_text_dist - sillDistModel, unID, sillOffsetM, 1+1024+128, sillOffsetCm
hotspot2 -1, -upbott_text_dist - sillDistModel, unID+1,sillOffsetM, 3+1024, sillOffsetCm
hotspot2 sillOffsetModel, -upbott_text_dist - sillDistModel, unID+2,sillOffsetM, 2+1024, sillOffsetCm
endif
if iMarkerSizeUnit = 3 then
hotspot2 0, -upbott_text_dist - sillDistModel, unID, sillOffsetM, 1+1024+128, sillOffsetPoint
hotspot2 -1, -upbott_text_dist - sillDistModel, unID+1,sillOffsetM, 3+1024, sillOffsetPoint
hotspot2 sillOffsetModel, -upbott_text_dist - sillDistModel, unID+2,sillOffsetM, 2+1024, sillOffsetPoint
endif
unID = unID + 3

add2 sillOffsetModel, 0

if bShowSillHeight then
_textPen = _textPen4

_iUnitTypeByContent = 8 ! "Sill_height_dimension"

if GS_iCustomText_4 = CTXT_CUSTOMTEXT then
_horAlign = 2
note1 = AC_MarkerText_4
note2 = ""
note3 = ""
note4 = ""
else
_lengthValue = _lengthSillValue
_horAlign = 2
_TextFont = _textFont4
_TextSize = _textSize4
_TextStyle = _textStyle4
_szPrefix = AC_SillPrefix + " "

gosub "call_quantity_formatter"
endif

posX = 0
posY = (-sillDistModel - upbott_text_dist) / PAPER_TO_MODEL
style1 = "mtext4style"
style2 = "extraStyle4"
style3 = "mtext4style"
style4 = "mtext4style"
notesize = _textSize4
angle = textAngle
enabled = AC_Readable
iMarkerDir = DIRVALUES_PERPEND
_bWidHei = 0

gosub "Print_text_considering_readability"
endif

del 2
else
if abs(sillOffsetModel) > EPS then
unID = unID + 6
else
! visible, movable and dimensionable hotspots are moved and locekd
! Parapet's X directions hotspot
hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
unID = unID + 3
! Parapet's Y directions hotspot
hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
unID = unID + 3
endif
endif


! ==============================================================================
! Show Location
! ==============================================================================

define style{2} "extraStyle8" _textFont8, 2/3*_textSize8, _textStyle8 + 32

if AC_show_Location then
add2 markerOffsetModel, 0

if iMarkerSizeUnit = 1 then
hotspot2 locationOffsetModel, -upbott_text_dist, unID, locationDistM, 1+1024+128, locationDistMm
hotspot2 locationOffsetModel, -upbott_text_dist + 1, unID+1, locationDistM, 3+1024, locationDistMm
hotspot2 locationOffsetModel, -upbott_text_dist - locationDistModel, unID+2, locationDistM, 2+1024, locationDistMm
endif
if iMarkerSizeUnit = 2 then
hotspot2 locationOffsetModel, -upbott_text_dist, unID, locationDistM, 1+1024+128, locationDistCm
hotspot2 locationOffsetModel, -upbott_text_dist + 1, unID+1, locationDistM, 3+1024, locationDistCm
hotspot2 locationOffsetModel, -upbott_text_dist - locationDistModel, unID+2, locationDistM, 2+1024, locationDistCm
endif
if iMarkerSizeUnit = 3 then
hotspot2 locationOffsetModel, -upbott_text_dist, unID, locationDistM, 1+1024+128, locationDistPoint
hotspot2 locationOffsetModel, -upbott_text_dist + 1, unID+1, locationDistM, 3+1024, locationDistPoint
hotspot2 locationOffsetModel, -upbott_text_dist - locationDistModel, unID+2, locationDistM, 2+1024, locationDistPoint
endif
unID = unID + 3
if iMarkerSizeUnit = 1 then
hotspot2 0, -upbott_text_dist - locationDistModel, unID, locationOffsetM, 1+1024+128, locationOffsetMm
hotspot2 -1, -upbott_text_dist - locationDistModel, unID+1,locationOffsetM, 3+1024, locationOffsetMm
hotspot2 locationOffsetModel, -upbott_text_dist - locationDistModel, unID+2,locationOffsetM, 2+1024, locationOffsetMm
endif
if iMarkerSizeUnit = 2 then
hotspot2 0, -upbott_text_dist - locationDistModel, unID, locationOffsetM, 1+1024+128, locationOffsetCm
hotspot2 -1, -upbott_text_dist - locationDistModel, unID+1,locationOffsetM, 3+1024, locationOffsetCm
hotspot2 locationOffsetModel, -upbott_text_dist - locationDistModel, unID+2,locationOffsetM, 2+1024, locationOffsetCm
endif
if iMarkerSizeUnit = 3 then
hotspot2 0, -upbott_text_dist - locationDistModel, unID, locationOffsetM, 1+1024+128, locationOffsetPoint
hotspot2 -1, -upbott_text_dist - locationDistModel, unID+1,locationOffsetM, 3+1024, locationOffsetPoint
hotspot2 locationOffsetModel, -upbott_text_dist - locationDistModel, unID+2,locationOffsetM, 2+1024, locationOffsetPoint
endif
unID = unID + 3

add2 locationOffsetModel, 0

if bShowLocation then
_textPen =_textPen8

posX = 0
posY = (-locationDistModel - upbott_text_dist) / PAPER_TO_MODEL
_horAlign= 2
note1 = AC_MarkerText_8
note2 = ""
note3 = ""
note4 = ""
style1 = "mtext8style"
style2 = "extraStyle8"
style3 = "mtext8style"
style4 = "mtext8style"
notesize = _textSize8
angle = textAngle
enabled = AC_Readable
iMarkerDir = DIRVALUES_PERPEND
_bWidHei = 0

gosub "Print_text_considering_readability"
endif

del 2
else
if abs(locationOffsetModel) > EPS then
unID = unID + 6
else
! visible, movable and dimensionable hotspots are moved and locekd
! Location's X directions hotspot
hotspot2 markerOffsetModel, _yDoorCenterPoint, unID+2
unID = unID + 3
! Location's Y directions hotspot
hotspot2 markerOffsetModel,_yDoorCenterPoint, unID+2
unID = unID + 3
endif
endif


! ==============================================================================
! Show Fire Rating
! ==============================================================================

if AC_show_firerating then
add2 markerOffsetModel, 0

if iMarkerSizeUnit = 1 then
hotspot2 fireOffsetModel, 0, unID, fireDistM, 1+1024+128, fireDistMm
hotspot2 fireOffsetModel, -1, unID+1, fireDistM, 3+1024, fireDistMm
hotspot2 fireOffsetModel, fireDistModel, unID+2, fireDistM, 2+1024, fireDistMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 fireOffsetModel, 0, unID, fireDistM, 1+1024+128, fireDistCm
hotspot2 fireOffsetModel, -1, unID+1, fireDistM, 3+1024, fireDistCm
hotspot2 fireOffsetModel, fireDistModel, unID+2, fireDistM, 2+1024, fireDistCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 fireOffsetModel, 0, unID, fireDistM, 1+1024+128, fireDistPoint
hotspot2 fireOffsetModel, -1, unID+1, fireDistM, 3+1024, fireDistPoint
hotspot2 fireOffsetModel, fireDistModel, unID+2, fireDistM, 2+1024, fireDistPoint
unID = unID + 3
endif

if iMarkerSizeUnit = 1 then
hotspot2 0, fireDistModel, unID, fireOffsetM, 1+1024+128, fireOffsetMm
hotspot2 -1, fireDistModel, unID+1, fireOffsetM, 3+1024, fireOffsetMm
hotspot2 fireOffsetModel, fireDistModel, unID+2, fireOffsetM, 2+1024, fireOffsetMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 0, fireDistModel, unID, fireOffsetM, 1+1024+128, fireOffsetCm
hotspot2 -1, fireDistModel, unID+1, fireOffsetM, 3+1024, fireOffsetCm
hotspot2 fireOffsetModel, fireDistModel, unID+2, fireOffsetM, 2+1024, fireOffsetCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 0, fireDistModel, unID, fireOffsetM, 1+1024+128, fireOffsetPoint
hotspot2 -1, fireDistModel, unID+1, fireOffsetM, 3+1024, fireOffsetPoint
hotspot2 fireOffsetModel, fireDistModel, unID+2, fireOffsetM, 2+1024, fireOffsetPoint
unID = unID + 3
endif


add2 fireOffsetModel, 0

_textPen = _textPen5
define style{2} "lowerIndex" _textFont5, _textSize5 * 2/3, _textStyle5

if bShowFire then
firerating_textMain = ""
firerating_textLowerIndex = ""
firerating_textMain2 = ""

if (LibraryLangCode = "AUT" or LibraryLangCode = "CHE" or LibraryLangCode = "GER") and\
gs_dw_marker_type <> MARKERTYPE_SKYLIGHT and\
GS_iCustomText_5 = CTXT_MEASUREDVALUE then

if gs_dw_marker_type = MARKERTYPE_DOOR then ! D Marker
if _contbInsulation and _contindexInsul <> "" then ! For the index style as fraction
posIndex = strstr(_contExpressionFR, _contindexInsul)
posList = posIndex + strlen( _contindexInsul)
posEnd = strlen( _contExpressionFR)
firerating_textMain = AC_FirePrefix + strsub(_contExpressionFR, 0, posIndex-1)
firerating_textLowerIndex = _contindexInsul
firerating_textMain2 = strsub(_contExpressionFR, posList, posEnd)
else
firerating_textMain = AC_FirePrefix + _contExpressionFR
endif
else ! W Marker
if _contbSelfC and _contindexSelfC <> "" then ! For the index style as fraction
posIndex = strstr(_contExpressionFR, _contindexSelfC)
posList = posIndex + strlen( _contindexSelfC)
posEnd = strlen( _contExpressionFR)
firerating_textMain = AC_FirePrefix + strsub(_contExpressionFR, 0, posIndex-1)
firerating_textLowerIndex = _contindexSelfC
firerating_textMain2 = strsub(_contExpressionFR, posList, posEnd)
else
firerating_textMain = AC_FirePrefix + _contExpressionFR
endif
endif
else
firerating_textMain = AC_MarkerText_5
endif

posX = 0
posY = fireDistModel / PAPER_TO_MODEL
_horAlign= 1
note1 = firerating_textMain
note2 = ""
note3 = firerating_textLowerIndex
note4 = firerating_textMain2
style1 = "mtext5style"
style2 = "mtext5style"
style3 = "lowerIndex"
style4 = "mtext5style"
notesize = _textSize5
angle = textAngle
enabled = AC_Readable
iMarkerDir = iFireRatingDir
_bWidHei = 0

gosub "Print_text_considering_readability"

endif
del 2


! --------------------------------------------------------------------------
! Show Fire Rating LINEs for NED openings
! This function is duplicated in all INT Door objects, controlled by MVO
! This copy of the function depends on the values of "iNedFireRating" parameter only
! explicitly requested from NED office, do not delete unless told otherwise
! --------------------------------------------------------------------------

_textPen = AC_Pen_FireRate
RadFPLine = 0.072
Dx = 0.08
Dy1 = 0.5
Dy2 = 0.3
Dy3 = 0.16

! BRAND parameter check - It is for NED Doors/Windows
rrBrand = request ("ASSOCLP_PARVALUE", "iNedFireRating",
index_firerating2, type_firerating2, flags_firerating2,
dim1_firerating2, dim2_firerating2, firerating2)

if rrBrand > EPS then
if firerating2 = 1 or firerating2 = 4 or firerating2 = 5 then ! "zelfsluitend" - Smoke Protection
POLY2_ 9,1,
0,4*RadFPLine,1,
0,3*RadFPLine,901,
RadFPLine,-180,4001,
0,1*RadFPLine,901,
RadFPLine,180,4001,
0,-RadFPLine,901,
RadFPLine,-180,4001,
0,-3*RadFPLine,901,
RadFPLine,180,4001
endif

if firerating2 = 2 or firerating2 = 4 then ! "30 min. brandwerend" - 30 Min. Fire Protection
LINE2 -Dx,Dy1,Dx,Dy1+Dy3
LINE2 -Dx,-Dy1,Dx,-Dy1-Dy3
LINE2 Dx,Dy1,-Dx,Dy1+Dy3
LINE2 Dx,-Dy1,-Dx,-Dy1-Dy3
endif

if firerating2 = 3 or firerating2 = 5 then ! "60 min. brandwerend" - 60 Min. Fire Protection
LINE2 -Dx,Dy2,Dx,Dy2+Dy3
LINE2 -Dx,-Dy2,Dx,-Dy2-Dy3
LINE2 Dx,Dy2,-Dx,Dy2+Dy3
LINE2 Dx,-Dy2,-Dx,-Dy2-Dy3

LINE2 -Dx,Dy1,Dx,Dy1+Dy3
LINE2 -Dx,-Dy1,Dx,-Dy1-Dy3
LINE2 Dx,Dy1,-Dx,Dy1+Dy3
LINE2 Dx,-Dy1,-Dx,-Dy1-Dy3
endif
endif
endif

! ==============================================================================
! Show Acoustic Rating
! ==============================================================================

if AC_show_acousticrating then
add2 markerOffsetModel, 0

if iMarkerSizeUnit = 1 then
hotspot2 acousticOffsetModel, 0, unID, acousticDistM, 1+1024+128, acousticDistMm
hotspot2 acousticOffsetModel, -1, unID+1, acousticDistM, 3+1024, acousticDistMm
hotspot2 acousticOffsetModel, acousticDistModel, unID+2, acousticDistM, 2+1024, acousticDistMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 acousticOffsetModel, 0, unID, acousticDistM, 1+1024+128, acousticDistCm
hotspot2 acousticOffsetModel, -1, unID+1, acousticDistM, 3+1024, acousticDistCm
hotspot2 acousticOffsetModel, acousticDistModel, unID+2, acousticDistM, 2+1024, acousticDistCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 acousticOffsetModel, 0, unID, acousticDistM, 1+1024+128, acousticDistPoint
hotspot2 acousticOffsetModel, -1, unID+1, acousticDistM, 3+1024, acousticDistPoint
hotspot2 acousticOffsetModel, acousticDistModel, unID+2, acousticDistM, 2+1024, acousticDistPoint
unID = unID + 3
endif


if iMarkerSizeUnit = 1 then
hotspot2 0, acousticDistModel, unID, acousticOffsetM, 1+1024+128, acousticOffsetMm
hotspot2 -1, acousticDistModel, unID+1, acousticOffsetM, 3+1024, acousticOffsetMm
hotspot2 acousticOffsetModel, acousticDistModel, unID+2, acousticOffsetM, 2+1024, acousticOffsetMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 0, acousticDistModel, unID, acousticOffsetM, 1+1024+128, acousticOffsetCm
hotspot2 -1, acousticDistModel, unID+1, acousticOffsetM, 3+1024, acousticOffsetCm
hotspot2 acousticOffsetModel, acousticDistModel, unID+2, acousticOffsetM, 2+1024, acousticOffsetCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 0, acousticDistModel, unID, acousticOffsetM, 1+1024+128, acousticOffsetPoint
hotspot2 -1, acousticDistModel, unID+1, acousticOffsetM, 3+1024, acousticOffsetPoint
hotspot2 acousticOffsetModel, acousticDistModel, unID+2, acousticOffsetM, 2+1024, acousticOffsetPoint
unID = unID + 3
endif


add2 acousticOffsetModel, 0

if bShowAcoustic then
_textPen = _textPen6

posX = 0
posY = acousticDistModel / PAPER_TO_MODEL
_horAlign= 1
note1 = AC_MarkerText_6
note2 = ""
note3 = ""
note4 = ""
style1 = "mtext6style"
style2 = "mtext6style"
style3 = "mtext6style"
style4 = "mtext6style"
notesize = _textSize6
angle = textAngle
enabled = AC_Readable
iMarkerDir = iAcousticDir
_bWidHei = 0

gosub "Print_text_considering_readability"
endif

del 2
endif


! ==============================================================================
! Show U-value
! ==============================================================================

if AC_show_Uvalue then
add2 markerOffsetModel, 0

if iMarkerSizeUnit = 1 then
hotspot2 uvalueOffsetModel, 0, unID, uvalueDistM, 1+1024+128, uvalueDistMm
hotspot2 uvalueOffsetModel, -1, unID+1, uvalueDistM, 3+1024, uvalueDistMm
hotspot2 uvalueOffsetModel, uvalueDistModel, unID+2, uvalueDistM, 2+1024, uvalueDistMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 uvalueOffsetModel, 0, unID, uvalueDistM, 1+1024+128, uvalueDistCm
hotspot2 uvalueOffsetModel, -1, unID+1, uvalueDistM, 3+1024, uvalueDistCm
hotspot2 uvalueOffsetModel, uvalueDistModel, unID+2, uvalueDistM, 2+1024, uvalueDistCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 uvalueOffsetModel, 0, unID, uvalueDistM, 1+1024+128, uvalueDistPoint
hotspot2 uvalueOffsetModel, -1, unID+1, uvalueDistM, 3+1024, uvalueDistPoint
hotspot2 uvalueOffsetModel, uvalueDistModel, unID+2, uvalueDistM, 2+1024, uvalueDistPoint
unID = unID + 3
endif


if iMarkerSizeUnit = 1 then
hotspot2 0, uvalueDistModel, unID, uvalueOffsetM, 1+1024+128, uvalueOffsetMm
hotspot2 -1, uvalueDistModel, unID+1, uvalueOffsetM, 3+1024, uvalueOffsetMm
hotspot2 uvalueOffsetModel, uvalueDistModel, unID+2, uvalueOffsetM, 2+1024, uvalueOffsetMm
unID = unID + 3
endif
if iMarkerSizeUnit = 2 then
hotspot2 0, uvalueDistModel, unID, uvalueOffsetM, 1+1024+128, uvalueOffsetCm
hotspot2 -1, uvalueDistModel, unID+1, uvalueOffsetM, 3+1024, uvalueOffsetCm
hotspot2 uvalueOffsetModel, uvalueDistModel, unID+2, uvalueOffsetM, 2+1024, uvalueOffsetCm
unID = unID + 3
endif
if iMarkerSizeUnit = 3 then
hotspot2 0, uvalueDistModel, unID, uvalueOffsetM, 1+1024+128, uvalueOffsetPoint
hotspot2 -1, uvalueDistModel, unID+1, uvalueOffsetM, 3+1024, uvalueOffsetPoint
hotspot2 uvalueOffsetModel, uvalueDistModel, unID+2, uvalueOffsetM, 2+1024, uvalueOffsetPoint
unID = unID + 3
endif


add2 uvalueOffsetModel, 0

if bShowUvalue then
_textPen = _textPen7

posX = 0
posY = uvalueDistModel / PAPER_TO_MODEL
_horAlign= 1
note1 = AC_MarkerText_7
note2 = ""
note3 = ""
note4 = ""
style1 = "mtext7style"
style2 = "mtext7style"
style3 = "mtext7style"
style4 = "mtext7style"
notesize = _textSize7
angle = textAngle
enabled = AC_Readable
iMarkerDir = iUValueDir
_bWidHei = 0

gosub "Print_text_considering_readability"
endif

del 2
endif


end


! ==============================================================================
"call_quantity_formatter":
! ------------------------------------------------------------------------------

if _iUnitTypeByContent = 8 then ! "Sill_height_dimension"
_iWorkUnit = iWorkUnitSillHgt
_iWorkUnitDecimal = iWorkUnitSillHgtDecimal
else
_iWorkUnit = iWorkUnitLinear
_iWorkUnitDecimal = iWorkUnitLinearDecimal
endif

_custom_form = ""

if _iWorkUnit = DIMUNIT_MM then _custom_form = "%~0." + str(_iWorkUnitDecimal,1,0) + "mm" !mm
if _iWorkUnit = DIMUNIT_CM then _custom_form = "%~0." + str(_iWorkUnitDecimal,1,0) + "cm" !cm
if _iWorkUnit = DIMUNIT_DM then
_custom_form = "%~0." + str(_iWorkUnitDecimal,1,0) + "m" !dm
_lengthValue = _lengthValue * 10
endif
if _iWorkUnit = DIMUNIT_METER then _custom_form = "%~0." + str(_iWorkUnitDecimal,1,0) + "m" !m
if _iWorkUnit = DIMUNIT_INCH then _custom_form = "%0.64fi"

if _iWorkUnit = DIMUNIT_PROJECT then
_iUnitType = _iUnitTypeByContent
else
_iUnitType = 0 ! Custom
endif

call "quantity_text_formatter" parameters lengthValue = _lengthValue,
custom_form = _custom_form,
iUnitType = _iUnitType,
horizontalAlignment = _horAlign,
verticalAlignment = 1,
AC_TextFont = _TextFont,
AC_TextSize = _TextSize,
AC_TextStyle = _TextStyle,
szPrefix = _szPrefix,
bShowText = 0,
bShowUnit = 0,
bShowSuperScript = 1,
returned_parameters lengthOfNote1,
lengthOfNote2,
lengthOfNote3,
lengthOfNote4,
dummy_totalLength,
dummy_totalHeight,
dummy_lengthOfUnit,
dummy_lengthOfIntegerPart,
note1, !szPrefix + main
note2, !frac,
note3, !szUnit,
note4, !szUnitIndex,
dummy_szExtraPrecision,
dummy_iAnchorString
return


! ==============================================================================
! Print text considering readability
! ==============================================================================
! works for anchor point 1 only! (top left corner)
! optional extra text in 2/3 size, elevated to 1/3 hight
!
! posX: text position X
! posY: text position Y
! note1: text
! note2: extra text
! style1: style of text
! style2: style of extra
! _horAlign:1-left, 2-center, 3-right
! angle: text angle
! enabled: may rotate
! ==============================================================================

"Print_text_considering_readability":

if note2 <> "" or _increaseTextSize then
_bextra = 1
else
_bextra = 0
endif

mul2 PAPER_TO_MODEL, PAPER_TO_MODEL
numTrans = 1

if iMarkerDir = DIRVALUES_ALIGNED and _bWidHei then
add2 -notesize / 2, posY
else
add2 0, posY + notesize / 2
endif

numTrans = numTrans + 1

rotdir_angle = 0 ! iMarkerDir = DIRVALUES_PERPEND
if iMarkerDir = DIRVALUES_ALIGNED then rotdir_angle = 90
if iMarkerDir = DIRVALUES_HORIZONTAL then rotdir_angle = -textAngle
if iMarkerDir = DIRVALUES_VERTICAL then rotdir_angle = -textAngle + 90

rot2 rotdir_angle
numTrans = numTrans + 1

style style1
_textStyle1 = style1
if abs(lengthOfNote1 < EPS) | \
abs(lengthOfNote2 < EPS) | \
abs(lengthOfNote3 < EPS) | \
abs(lengthOfNote4 < EPS) then

gosub "compute_note_lengths"
endif

if _horAlign = 2 then
add2 -(lengthOfNote1+lengthOfNote2+lengthOfNote3+lengthOfNote4)/2, 0
numTrans = numTrans + 1
endif
if _horAlign = 3 then
add2 -(lengthOfNote1+lengthOfNote2+lengthOfNote3+lengthOfNote4), 0
numTrans = numTrans + 1
endif

if (angle > (gs_readable_angle + eps) & angle < (gs_readable_angle + 180 + eps) & enabled & iMarkerDir = DIRVALUES_PERPEND) | \
(angle > (gs_readable_angle - 90 + eps) & angle < (gs_readable_angle + 180 - 90 + eps) & enabled & iMarkerDir = DIRVALUES_ALIGNED) then

add2 posX + lengthOfNote1 + lengthOfNote2 + lengthOfNote3 + lengthOfNote4, notesize/2 ! top right corner
rot2 180
numTrans = numTrans + 2
else
add2 posX, - notesize/2 ! bottom left corner
numTrans = numTrans + 1
endif

rrr = request("Height_of_style", style1, sy, descent, leading)
dl = (descent + leading)

if GLOB_FEEDBACK_MODE then
_drawRichText = 0
else
_drawRichText = 1
endif

paragraph "Paragraph1" 1, 0, 0, 0, 1, 0 !1
pen _textPen
style _textStyle1
note1
style style2
note2
style style3
note3
style style4
note4
endparagraph
textblock "Textblock1" 0, 7, 0, AC_TextCharWidthFactor_1, AC_TextCharSpaceFactor_1, 0, "Paragraph1"

rrr = REQUEST ("TEXTBLOCK_INFO", "Textblock1", _widthTB, _heightTB)

if _drawRichText then
richtext2 0, -dl, "Textblock1"
else
rect2 0, -dl, _widthTB, _heightTB-dl
endif

del numTrans
return

! ==============================================================================
! Print text considering readability2
! ==============================================================================
! works for anchor point 1 only! (top left corner)
! optional extra text in 2/3 size, elevated to 1/3 hight
!
! posX: text position X
! posY: text position Y
! note1: text
! note2: extra text
! style1: style of text
! style2: style of extra
! _horAlign:1-left, 2-center, 3-right
! angle: text angle
! enabled: may rotate
! ==============================================================================

"Print_text_considering_readability2":

if note2 <> "" or _increaseTextSize then
_bextra = 1
else
_bextra = 0
endif

mul2 PAPER_TO_MODEL, PAPER_TO_MODEL
numTrans = 1

if iMarkerDir = DIRVALUES_ALIGNED and _bWidHei then
add2 -notesize / 2, posY
else
add2 0, posY + notesize / 2
endif

numTrans = numTrans + 1

rotdir_angle = 0 ! iMarkerDir = DIRVALUES_PERPEND
if iMarkerDir = DIRVALUES_ALIGNED then rotdir_angle = 90
if iMarkerDir = DIRVALUES_HORIZONTAL then rotdir_angle = -textAngle
if iMarkerDir = DIRVALUES_VERTICAL then rotdir_angle = -textAngle + 90

rot2 rotdir_angle
numTrans = numTrans + 1

style style1
_textStyle1 = style1
if abs(lengthOfNote1 < EPS) | \
abs(lengthOfNote2 < EPS) | \
abs(lengthOfNote3 < EPS) | \
abs(lengthOfNote4 < EPS) then

gosub "compute_note_lengths"
endif

if _horAlign = 2 then
add2 -(lengthOfNote1+lengthOfNote2+lengthOfNote3+lengthOfNote4)/2, 0
numTrans = numTrans + 1
endif
if _horAlign = 3 then
add2 -(lengthOfNote1+lengthOfNote2+lengthOfNote3+lengthOfNote4), 0
numTrans = numTrans + 1
endif

if (angle > (gs_readable_angle + eps) & angle < (gs_readable_angle + 180 + eps) & enabled & iMarkerDir = DIRVALUES_PERPEND) | \
(angle > (gs_readable_angle - 90 + eps) & angle < (gs_readable_angle + 180 - 90 + eps) & enabled & iMarkerDir = DIRVALUES_ALIGNED) then

add2 posX + lengthOfNote1 + lengthOfNote2 + lengthOfNote3 + lengthOfNote4, notesize/2 ! top right corner
rot2 180
numTrans = numTrans + 2
else
add2 posX, - notesize/2 ! bottom left corner
numTrans = numTrans + 1
endif

rrr = request("Height_of_style", style1, sy, descent, leading)
dl = (descent + leading)

if GLOB_FEEDBACK_MODE then
_drawRichText = 0
else
_drawRichText = 1
endif

paragraph "Paragraph2" 1, 0, 0, 0, 1, 0 !1
pen _textPen
style _textStyle1
note1 + stWidHeiSep + note3 + stWidHeiPrefix
!style style2
!note2
!style style3
!note3
!style style4
!note4
endparagraph
textblock "Textblock2" 0, 7, 0, AC_TextCharWidthFactor_1, AC_TextCharSpaceFactor_1, 0, "Paragraph2"

rrr = REQUEST ("TEXTBLOCK_INFO", "Textblock2", _widthTB, _heightTB)

if _drawRichText then
richtext2 0, -dl, "Textblock2"
else
rect2 0, -dl, _widthTB, _heightTB-dl
endif

del numTrans
return



! ==============================================================================
! Compute note lengths if necessary
! ==============================================================================
! The matching style has to be active.
!
! Input:
! note1:
! note2:
! Output:
! lengthOfNote1:
! lengthOfNote2:
! ==============================================================================
"compute_note_lengths":
! ------------------------------------------------------------------------------
lengthOfNote1 = stw (note1)
lengthOfNote2 = stw (note2) * 2/3
lengthOfNote3 = stw (note3) * 2/3 +(stw (note3) * 1/3*_bextra)
lengthOfNote4 = stw (note4) - (stw (note4) * 1/3*_bextra)

return

! ==============================================================================
"drawCenterLine":
! ------------------------------------------------------------------------------
! input:
! GS_Center_Line bool
! iMarkerShape shape
! rotdir_angle position
! markerOffsetModel
! headDistModel
! upbott_text_dist
! footLengthModel
! for SHAPE_CIRCLE
! dx1 radius
! for SHAPE_ELLIPSE
! dx1 small axis
! _ratio large / small axis
! for SHAPE_OVAL, SHAPE_RECTANGLE, SHAPE_DIAMOND
! _headPolygon in PolyOperations format
! for SHAPE_TRIANGLE, SHAPE_SQUAREROT, SHAPE_PENTAGON, SHAPE_HEXAGON, SHAPE_OCTAGON,
! SHAPE_TRIANGLEROT, SHAPE_SQUARE, SHAPE_PENTAGONROT, SHAPE_HEXAGONROT, SHAPE_OCTAGONROT,
! frame_width
! num of sides
! ==============================================================================

if GS_Center_Line then

! intersect horizontal shape with rotated line

_HeadLineIntersection = 0 ! default for intersection geometric errors
_LineToShapeAxisAngle = -(90 + rotdir_angle)

if iMarkerShape = SHAPE_CIRCLE then
! symmetric on origin
_HeadLineIntersection = dx1
endif

if iMarkerShape = SHAPE_ELLIPSE then
! _ratio is >= 1 (no div0)
_div = tan(_LineToShapeAxisAngle) **2 + (1 / _ratio) **2
_cosrot = cos(_LineToShapeAxisAngle)

if abs(_cosrot) > EPS then
if _div > 0 then
_dx = dx1 / sqr(_div)
_HeadLineIntersection = (_dx / _cosrot)
endif
else ! 90° or 270° rotation
_HeadLineIntersection = dx1
endif
endif

if iMarkerShape = SHAPE_OVAL |\
iMarkerShape = SHAPE_RECTANGLE |\
iMarkerShape = SHAPE_DIAMOND \

then
dict _markerLine
_markerLine.point.x = 0.0
_markerLine.point.y = 0.0
_markerLine.direction.ux = cos(_LineToShapeAxisAngle)
_markerLine.direction.uy = sin(_LineToShapeAxisAngle)

dict _intersection
call "BasicGeometry" parameters iFunction = BasicGeometry.INTERSECT_LINE_POLYGON_2D,
polygon = _headPolygon,
lineA = _markerLine,
returned_parameters _intersection

if vardim1(_intersection.points) > 0 then
! symmetric on origin
_HeadLineIntersection = sqr(_intersection.points[1].x **2 + _intersection.points[1].y **2)
endif
endif

if iMarkerShape = SHAPE_TRIANGLE |\
iMarkerShape = SHAPE_SQUAREROT |\
iMarkerShape = SHAPE_PENTAGON |\
iMarkerShape = SHAPE_HEXAGON |\
iMarkerShape = SHAPE_OCTAGON \
then
_HeadLineIntersection = frame_width / 2
endif

if iMarkerShape = SHAPE_TRIANGLEROT |\
iMarkerShape = SHAPE_SQUARE |\
iMarkerShape = SHAPE_PENTAGONROT |\
iMarkerShape = SHAPE_HEXAGONROT |\
iMarkerShape = SHAPE_OCTAGONROT \
then
_HeadLineIntersection = frame_width / 2 * sin(90 - 360 / (2 * num))
endif

pen SYMB_VIEW_PEN
line2 markerOffsetModel, headDistModel - abs(_HeadLineIntersection), markerOffsetModel, -upbott_text_dist - footLengthModel
endif

return

AC24
Win11 | 12th gen i-7 | 32GB | RTX 3070 Ti

View solution in original post

11 REPLIES 11
Lingwisyer
Guru

You have not included the portion of script that actually plots the text out. Should be a TEXT2 and probably a PARAGRAPH somewhere. Follow this sub: gosub "Print_text_considering_readability"

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

Hi Lingwisyer, thanks for the reply! 

I've copied the code in below, i was under the impression that the plotting script would have to reference the (_LengthHeightValue & _stWidHeiPrefix, ect. )? but i guess this isnt the case, still unsure as how to the data is being transfered.

 

! ==============================================================================
! Print text considering readability
! ==============================================================================
! works for anchor point 1 only! (top left corner)
! optional extra text in 2/3 size, elevated to 1/3 hight
!
! posX: text position X
! posY: text position Y
! note1: text
! note2: extra text
! style1: style of text
! style2: style of extra
! _horAlign:1-left, 2-center, 3-right
! angle: text angle
! enabled: may rotate
! ==============================================================================

"Print_text_considering_readability":

if note2 <> "" or _increaseTextSize then
_bextra = 1
else
_bextra = 0
endif

mul2 PAPER_TO_MODEL, PAPER_TO_MODEL
numTrans = 1

if iMarkerDir = DIRVALUES_ALIGNED and _bWidHei then
add2 -notesize / 2, posY
else
add2 0, posY + notesize / 2
endif

numTrans = numTrans + 1

rotdir_angle = 0 ! iMarkerDir = DIRVALUES_PERPEND
if iMarkerDir = DIRVALUES_ALIGNED then rotdir_angle = 90
if iMarkerDir = DIRVALUES_HORIZONTAL then rotdir_angle = -textAngle
if iMarkerDir = DIRVALUES_VERTICAL then rotdir_angle = -textAngle + 90

rot2 rotdir_angle
numTrans = numTrans + 1

style style1
_textStyle1 = style1
if abs(lengthOfNote1 < EPS) | \
abs(lengthOfNote2 < EPS) | \
abs(lengthOfNote3 < EPS) | \
abs(lengthOfNote4 < EPS) then

gosub "compute_note_lengths"
endif

if _horAlign = 2 then
add2 -(lengthOfNote1+lengthOfNote2+lengthOfNote3+lengthOfNote4)/2, 0
numTrans = numTrans + 1
endif
if _horAlign = 3 then
add2 -(lengthOfNote1+lengthOfNote2+lengthOfNote3+lengthOfNote4), 0
numTrans = numTrans + 1
endif

if (angle > (gs_readable_angle + eps) & angle < (gs_readable_angle + 180 + eps) & enabled & iMarkerDir = DIRVALUES_PERPEND) | \
(angle > (gs_readable_angle - 90 + eps) & angle < (gs_readable_angle + 180 - 90 + eps) & enabled & iMarkerDir = DIRVALUES_ALIGNED) then

add2 posX + lengthOfNote1 + lengthOfNote2 + lengthOfNote3 + lengthOfNote4, notesize/2 ! top right corner
rot2 180
numTrans = numTrans + 2
else
add2 posX, - notesize/2 ! bottom left corner
numTrans = numTrans + 1
endif

rrr = request("Height_of_style", style1, sy, descent, leading)
dl = (descent + leading)

if GLOB_FEEDBACK_MODE then
_drawRichText = 0
else
_drawRichText = 1
endif

paragraph "Paragraph1" 1, 0, 0, 0, 1, 0 !1
pen _textPen
style _textStyle1
note1
style style2
note2
style style3
note3
style style4
note4
endparagraph
textblock "Textblock1" 0, 7, 0, AC_TextCharWidthFactor_1, AC_TextCharSpaceFactor_1, 0, "Paragraph1"

rrr = REQUEST ("TEXTBLOCK_INFO", "Textblock1", _widthTB, _heightTB)

if _drawRichText then
richtext2 0, -dl, "Textblock1"
else
rect2 0, -dl, _widthTB, _heightTB-dl
endif

del numTrans
return
AC24
Win11 | 12th gen i-7 | 32GB | RTX 3070 Ti

The goal is to restructure the stWidHeiPrefix to show at the end (as a suffix)

AC24
Win11 | 12th gen i-7 | 32GB | RTX 3070 Ti
Lingwisyer
Guru

So this script is using ParagraphTextblock and Richtext2. I have not used Paragraph as in input into a Textblock before but I would look at your note# parameters. Is stWidHeiPrefix one of your note# parameters? If it is, you could probably just reorder them within the Paragraph command.

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 
Palawat
Advocate

I'm not on my pc with Archicad right now. But from ;

note1 = _formattedWidth
note2 = _formattedWExtra
note3 = _formattedHeight
note4 = _formattedHExtra

This mean that the "note1 to 4" has value assigned to each one. And then, in the "paragraph" ;

paragraph "Paragraph1" 1, 0, 0, 0, 1, 0 !1
pen _textPen
style _textStyle1
note1
style style2
note2
style style3
note3
style style4
note4
endparagraph

 You can experiment by changing the order of "note1" to "note3" (without using the "" sign). Or you can ;

paragraph "Paragraph1" 1, 0, 0, 0, 1, 0 !1
pen _textPen
style _textStyle1
"asdf" + note1 + " - " + note3
!style style2
!note2
!style style3
!note3
!style style4
!note4
endparagraph

Notice the "!" used to comment out unused lines of code. Play around with the styles and order of the contents as you like.

BTW, I think this should be in the Dev forum, not Design forum.

Archicad 26, Windows 10, Corei7 3.4 GHz, 16 GB Ram.
https://www.indigofigs.com
https://www.facebook.com/indigofigs
Samuel1997
Booster

Hey guys, Thankyou for the responses!!

 

So i worked out that the note1 & note2 were obviously the sizes, but were combining the Prefix & Separator into each, back in the 2D Dimension text script that i originally posted. The note 3 & note4 seem to be variations of note 1 & note2, so restructuring the code with those notes wasnt ever going to achieve the intended purpose!

 

I solved it via removing the prefix & separator data that was being added into note1 & note2 in first section of script originally posted, then I Followed up with Palawats idea in cancelling out the remainder of the paragraph and adding the required code into the note1 Line!

 

  • paragraph "Paragraph1" 1, 0, 0, 0, 1, 0 !1
    pen _textPen
    style _textStyle1
    note1 + stWidHeiSep + note3 + stWidHeiPrefix
    !style style2
    !note2
    !style style3
    !note3
    !style style4
    !note4
    endparagraph

And this was the Outcome!

W 24 Marker - Modified7.png

 

So far seems to be working, just have to double check & stress test that cancelling the note3/note4 doesnt create issues!

 

Thanks for the help guys! Very Informative, and your effort is appreciated!

Kind Regards Samuel H

AC24
Win11 | 12th gen i-7 | 32GB | RTX 3070 Ti
Lingwisyer
Guru

Good to know. There is so much x=y=z=a in this object that it is hard to follow... Can the marker still show the window / door number? My guess would be that the other notes are Sill Height and Related Zone.

 

BTW, I think this should be in the Dev forum, not Design forum.

More like there should be a Library and / or GDL sub... I see the Dev sub being more to do with the API. They killed the GDL forum to streamline everyone into the GDL sub on the old forum, then they killed that too... Zzz...

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

Honestly its quite the labyrinth!

And that definitely is an issue, as now that those parameters have been added directly into that paragraph controlling the text plotting, all other additional parameters which had options to be added in with their own textblocks and hotspots, are now also combined with the prefix & separator from the dimensions code. 

 

So for instance if the fire rating textblock is activated, it produces as follows:

W 24 Marker - Modified8.png

To combat this i know i'll have to restructure the original note# within the window height & width script individually, rather then the paragraph controlling all of the text blocks. But i still count this as a minor win in learning the behavior of the paragraph in relation to the text block.

 

I have my goal for the weekend and at least a place to start! 

AC24
Win11 | 12th gen i-7 | 32GB | RTX 3070 Ti
Lingwisyer
Guru

Following the "call_quantity_formatter" gosub, there is a note next to the parameters.

 

note1, !szPrefix + main
note2, !frac,
note3, !szUnit,
note4, !szUnitIndex

 

In the subsequent call there is:

 

note1 = szPrefix + main

 

If main is a tempt variable, and that is where the prefix is added, you might just be able to flip that line. Else if you can locate it happening elsewhere and comment it out, you could add it to the following line:

 

note1 = _formattedWidth + _formattedHeight

 

 

 

Ling.

 

Note: All of the GS objects are a nightmare to read through as there are millions of gosubcall and temp variables.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!