Page 1 of 1

Draw a line from point A to point B

Posted: Fri Jan 18, 2008 5:56 pm
by xApple
Hello everyone,
I am currently programming a project where I need to draw an arrow from point A to point B. This is a process much more complicated than I thought it would be. I have done most of the scripting necessary, my only problem remains actually creating the lines.

The following script creates a graphic object with style "line" and an end arrow; unfortunately nothing appears on the card where it is drawn !
Any solutions ? Help greatly appreciated !

Code: Select all

on createArrows
  go to card "arrowCard"
  if exists(graphic "theArrow" of card "arrowCard") then delete graphic "theArrow" of card "arrowCard"
  create graphic "theArrow"
  set the style of graphic "theArrow" of card "arrowCard" to "line"
  set the endArrow of graphic "theArrow" of card "arrowCard" to true
  set the lineSize of graphic "theArrow" of card "arrowCard" to 2
  set the arrowSize of graphic "theArrow" of card "arrowCard" to 3
  set the height of graphic "theArrow" of card "arrowCard" to 100
  set the width of graphic "theArrow" of card "arrowCard" to 100
  send "choose browse tool" to me in 1 tick
end createArrows

Posted: Fri Jan 18, 2008 6:09 pm
by BIX
I think that you need to set the starting and ending points of the line.

Try adding this to your script:

Code: Select all

set the points of graphic "theArrow" to "100,100" & cr & "200,200"
You can use points that you need.

Posted: Fri Jan 18, 2008 6:20 pm
by xApple
Hey thanks a lot !
Don't know why I didn't see that earlier ^^