Need help with editable hotspots.

Home Forums General discussions Need help with editable hotspots.

Viewing 2 reply threads
  • Author
    Posts
    • #4410
      Mats Knutsson
      Participant

      Hi,
      In the plan view I want to drag “Diameter” of circular shapes.
      I didn’t manage to solve the programming with Diameter so I resorted to Radius which is also how ArchiCAD defines circles and that worked from a programming point of view.
      This morning I had a new go at it because I really want to drag the diameter instead of the radius.

      But…I must have done something wrong since it doesn’t work out for me. I’ve tried different ways but the one shown below should work…at least according to my stupid self. Radius=Diameter/2… bot computer says NO…. I have no idea how to solve this and am grateful for help.

      Regards,
      Mats

      Attachments:
    • #4412
      Péter Baksa
      Keymaster

      Hi,

      editable hotspots work only with parameters, not variables.

      The solution is to use a hidden parameter that is edited by the hotspot. In your example add a parameter named rsp.
      Now you have to update any changes the user makes in dsp to rsp, in the parameter script:

      rsp = dsp / 2
      parameters rsp = rsp

      But when rsp is edited by the hotspots, you will need to change dsp. This can be done with the GLOB_MODPAR_NAME global variable:

      if GLOB_MODPAR_NAME = "rsp" then
          dsp = rsp * 2
          parameters dsp = dsp
      else
          rsp = dsp / 2
          parameters rsp = rsp
      endif
      

      If you want, you can show the value of dsp during hotspot editing:

      hotspot2 rsp, 0, 4, rsp, 2, dsp
      

      Péter Baksa
      Library Platform, Software Engineer
      GRAPHISOFT SE

      • #4422
        Mats Knutsson
        Participant

        Thanks but I don’t get it. I think I need it coded to understand. Is the “if”-part supposed to be also in the Parameter script? I tried several things but ended up with the same behaviour as before…that is dragging the radius…which would be just perfect if I didn’t want the diameter 🙂

    • #4423
      Péter Baksa
      Keymaster

      So you want that the center of the circle moves with dragging the diameter?

      Péter Baksa
      Library Platform, Software Engineer
      GRAPHISOFT SE

      • #4424
        Mats Knutsson
        Participant

        No. Center should stay put. The objects are lamps and they are defined by their diameter.

        • #4425
          Péter Baksa
          Keymaster

          OK, then I need to explain where to put the code fragments I wrote.

          Use your 2D code as in the picture top part, and in the parameter list add a parameter dsp, hide the parameter rsp.
          To the param script insert:

          if GLOB_MODPAR_NAME = "rsp" then
              dsp = rsp * 2
              parameters dsp = dsp
          else
              rsp = dsp / 2
              parameters rsp = rsp
          endif

          and in 2D script replace your 4th (non-blank) line with

          hotspot2 rsp, 0, 4, rsp, 2, dsp
          

          During dragging the hotspot, the radius line will be shown, but the parameter value in the tracker will be the diameter. You can show the diameter using:

          if GLOB_FEEDBACK_MODE then line2 -rsp, 0, rsp, 0
          

          Péter Baksa
          Library Platform, Software Engineer
          GRAPHISOFT SE

        • #4426
          Mats Knutsson
          Participant

          Works like charm Peter. Thanks!!! Now I’ll try to understand it. Hopefully I still have the gdl cookbok and handbook somewhere in my basement.

Viewing 2 reply threads
  • The forum ‘General discussions’ is closed to new topics and replies.