To add text to an object and make the text to follow a hotspot and be always hor

Home Forums General discussions To add text to an object and make the text to follow a hotspot and be always hor

This topic contains 6 replies, has 4 voices, and was last updated by  Barry Kelly 1 week, 2 days ago.

  • Author
    Posts
  • #18314

    Ricardo Rodriguez
    Participant

    Hi There, I’m getting familiar with GDL. I still need to learn a lot but I can make simple objects and understand a bit of the syntax.
    but I got stuck here. can somebody help me?
    I am trying to make a 2d object.

    Attachments:
  • #18316

    Ricardo Rodriguez
    Participant

    this is the 2d script if it makes it easier

    mul2 A/0.201778, B/0.241300
    add2 0′-4.7927″, 0′-0.0000″
    set line_type lineTypeAttribute_1
    pen penAttribute_1
    fill fillAttribute_1
    poly2_b{5} 5, 2, 0, 3, penAttribute_1, penAttribute_2,
    0′-0.0000″, 0′-0.0000″, 3′-3.3701″, 0′-0.0000″, 0′-0.0000″, 3′-3.3701″, 0′-0.0000″,
    0′-3.1514″, 0′-4.7500″, 1,
    0′-0.0000″, 0′-4.7500″, 900,
    0′-0.0000″, 590′-6.6142″, 4001,
    0′-0.0000″, 0′-4.7500″, 900,
    0′-0.0000″, 590′-6.6142″, 4001
    pen penAttribute_3
    line_property 0
    line2 -0′-1.3887″, 0′-4.1413″, 0′-0.0000″, 0′-4.7500″
    pen penAttribute_4
    line2 0′-0.0000″, 0′-0.0000″, 0′-0.0000″, 0′-2.0000″
    pen penAttribute_3
    line2 0′-1.3887″, 0′-5.3587″, 0′-0.0000″, 0′-4.7500″
    pen penAttribute_5
    line2 0′-0.0000″, 0′-7.5000″, 0′-0.0000″, 0′-9.5000″
    pen penAttribute_3
    arc2 0′-0.0954″, 0′-3.9021″, 0′-1.9048″, 266.981593756, 359.1456746775
    arc2 0′-0.0136″, 0′-3.7963″, 0′-1.7964″, 214.183464956, 269.4104437957
    arc2 -0′-0.5250″, 0′-3.4081″, 0′-1.1329″, 139.6717974381, 213.2478509556
    arc2 -0′-0.0954″, 0′-5.5979″, 0′-1.9048″, 86.98159375601, 179.1456746775
    arc2 -0′-0.0136″, 0′-5.7037″, 0′-1.7964″, 34.18346495604, 89.41044379571
    arc2 0′-0.5250″, 0′-6.0919″, 0′-1.1329″, 319.6717974381, 33.2478509556
    pen penAttribute_6
    hotspot2 0′-0.0000″, 0′-0.0000″
    hotspot2 0′-2.0000″, 0′-3.8737″
    hotspot2 -0′-1.4724″, 0′-2.7870″
    hotspot2 -0′-1.3887″, 0′-4.1413″
    hotspot2 0′-0.0000″, 0′-4.7500″
    hotspot2 0′-1.3887″, 0′-5.3587″
    hotspot2 0′-1.4724″, 0′-6.7130″
    hotspot2 -0′-2.0000″, 0′-5.6263″
    hotspot2 0′-0.0049″, 0′-7.5000″
    hotspot2 0′-0.0000″, 0′-9.5000″
    hotspot2 -0′-0.0049″, 0′-2.0000″
    hotspot2 -0′-3.6677″, 0′-1.7897″

    define style{2} “AC_STYLE_1” “Verdana”, textsize /72 * 25.4, 0
    r = request (“View_Rotangle”, “”, _angleViewRot)
    _totalRotate = (SYMB_ROTANGLE + _angleViewRot) MOD 360 ! Actual rotation of the 2D symbol
    _nTrans = 0

    if iTypeTextRotation = 2 then ! Readable
    if (_totalRotate > (90 + EPS) & _totalRotate < (270 + EPS)) then
    rot2 180
    _nTrans = _nTrans + 1
    endif
    else
    if iTypeTextRotation = 1 then ! Horizontal
    rot2 _totalRotate * (SYMB_MIRRORED – not(SYMB_MIRRORED)) ! 1/-1
    _nTrans = _nTrans + 1
    endif
    endif
    paragraph “AC_PRG_2″ 2, 0′-0.0000″, 0′-0.0000″, 0′-0.0000″, 2′-11.4331”
    pen penAttribute_9
    set style “AC_STYLE_1”
    firstline
    endparagraph
    textblock “AC_TEXTBLOCK_2″ 0′-0.0000″, 5, 0′-0.0000″, 3′-3.3701″, 3′-3.3701″, 3′-3.3701”,
    “AC_PRG_2″
    richtext2 -0′-3.6677″, 0′-1.7897”, “AC_TEXTBLOCK_2″
    fill fillAttribute_2
    poly2_b{5} 5, 2, 0, 3, penAttribute_7, penAttribute_8,
    0′-0.0000″, 0′-0.0000″, 3′-3.3701″, 0′-0.0000″, 0′-0.0000″, 3′-3.3701″, 0′-0.0000″,
    -0′-4.7927″, 0′-0.0000″, 1,
    -0′-2.5427″, 0′-0.0000″, 1,
    -0′-2.5427″, 0′-3.5794″, 1,
    -0′-4.7927″, 0′-3.5794″, 1,
    -0′-4.7927″, 0′-0.0000”, 1

  • #18317

    Lingwisyer GC
    Participant

    You want the Richtext to follow a hotspot? Make two overlapping Editable Hotspots, one for the x-axis and one for the y-axis, then set those two values as your x-y values in your Richtext command.

    HOTSPOT2 0, 0, unID, text-x, 1 : unID = unID + 1
    HOTSPOT2 1, 0, unID, text-x, 2 : unID = unID + 1
    HOTSPOT2 -1, 0, unID, text-x, 3 : unID = unID + 1
    
    HOTSPOT2 0, 0, unID, text-y, 1 : unID = unID + 1
    HOTSPOT2 0, 1, unID, text-y, 2 : unID = unID + 1
    HOTSPOT2 0, -1, unID, text-y, 3 : unID = unID + 1
    
    RICHTEXT2 text-x, text-y, “AC_TEXTBLOCK_2″

    Ling.

    AC18-22 AUS 6021
    Self-taught, bend it till it breaks.
    Win7 | E5620 x 2 | 24GB | K2200

  • #18335

    Péter Baksa
    Participant

    Hi Ricardo,

    rotation is always relative to the origin, so first move the origin to the anchor point, rotate, then draw the text at 0,0.

    Péter Baksa
    Software Engineer, Library Team
    GRAPHISOFT SE

  • #18345

    Ricardo Rodriguez
    Participant

    Thank you, Peter, that works!! I’m so glad!! It makes sense! I don’t know why I didn’t think about that haha.

  • #18346

    Ricardo Rodriguez
    Participant

    Thank you Lingwisyer GC too! but I haven’t been able to make that to work with the hotspot. I am interested in using that in another object. but I don understand yet how it works. I did this (photo attached) what I thought it was supposed to be but it didn’t work. it says text is not a valid parameter :/

    Attachments:
  • #18352

    Barry Kelly
    Participant

    The hotspot as written is not correct.
    Also I wouldn’t be using a dash “-” (means subtract), I would use an underscore (“_”).

    Try this …

    HOTSPOT2 0, text_y, unID, text_x, 1 : unID = unID + 1
    HOTSPOT2 text_x, text_y, unID, text_x, 2 : unID = unID + 1
    HOTSPOT2 -1, text_y, unID, text_x, 3 : unID = unID + 1
    
    HOTSPOT2 text_x, 0, unID, text_y, 1 : unID = unID + 1
    HOTSPOT2 text_x, text_y, unID, text_y, 2 : unID = unID + 1
    HOTSPOT2 text_x, -1, unID, text_y, 3 : unID = unID + 1
    
    RICHTEXT2 text-x, text-y, “AC_TEXTBLOCK_2″

    Versions 6.5 to 22
    Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
    Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit

You must be logged in to reply to this topic.