Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Ray - Way to limit length?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Draw.Ray - Way to limit length?

    Hi,

    I'm using Draw.Ray as it is the easiest way for me to project the plotted line a few bars into the future at the correct scale. For aesthetic reasons though, I'd rather limit the length. I can't see a way to do this. Is this possible?

    Alternatively, does anyone have a code snippet for drawing a line through 2 points, where the end point is NOT the end value, so it can project a few bars into the future, with the correct scale etc? I took a look, but the code for the Ray drawing tool does not seem to be one of the public codes supplied.

    Thanks.

    #2
    Hello pjsmith,

    Thank you for the post.

    I am unaware of any way to limit the length of the ray as it is intended to extend currently. The logic the ray uses to calculate the projection would likely be needed to accomplish your alternative to correctly account for scale etc as you pointed out.

    I will need to question development to see if they can disclose any details surrounding how that method works. Once I have more details surrounding how to accomplish that, i will reply back here.

    If the logic to do this cannot be reused, I will put in a feature request to have a variable length rendered past the second anchor.

    I look forward to being of further assistance.

    Comment


      #3
      Hello pjsmith,

      I just wanted to reply back, development got back to me and provided some direction on what would be needed to create a projection. The internal method can still be used in your NinjaScript files, the internal logic does not need to be seen to accomplish this.

      I have attached a sample that first draws a Ray then takes the Points from the ray and creates a projection. I tried to comment the file as best I could, the logic to do this is complicated. I also setup some properties to control the test script and make it more easily readable. The ProjectionLength property shows where in the logic the projection points are configured and later calculated.

      In the sample the lime line is the ray which extends off the canvas, the red line is the rendered projection which does not extend off the canvas.


      I look forward to being of further assistance.
      Attached Files

      Comment


        #4
        Thank you for this. I think I'll be able to modify that method to my needs. Much appreciated.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        599 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        344 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        558 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        557 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X