Macro to Draw Curve with Arrow

  • This macro places an arrow on a curved line.

    I've been using my version for many years. It's updated for version 16.3.001. Maybe it will work for you. Use it at your own risk.

    Note I always reference my arrow size to the text size sys(12). Also I have the curved leaders go to layer 23. Change the code to suit your needs and likes.


    Contributed by: PRL
'Program: cldr.d3m (curved leader)

dim jx(100), jy(100), jz(100)

if sys$(105) = "16.3.001" then
as = sys(12) 'text size setting for arrows in version 16+
else
as = 1
endif

lay=23
layer(lay)=6
sys(3)=lay

start = sys(9)

>Curve
{
<Type 0
<Incomplete
}

sys(36) = 1 'turn off dialogs from here on

' Get the points for the curve just drawn
Entity sys(9)
totp = sys(1)
for j = 1 to totp
Pointval jx(j), jy(j), jz(j), j
next j

sys(1)=0

>segment
{
<segment 20
<pointxyz [jx(totp), jy(totp), jz(totp)]
}

' only need the last two points of the last segment
Entity sys(9)
tp=sys(1)
tpm1=tp-1
Pointval x1 y1 z1 tpm1
Pointval x2 y2 z2 tp
sys(1)=0

'select the segmented curve and erase it
gosub selectnew
>erase
{
}

'redraw the original curve
>Curve
{
<Type 0
for j = 1 to totp
<pointxyz [jx(j), jy(j), jz(j)]
next j
}

'add the arrow using slope of last segment
>arrow
{
<Doublesided 0
<type 4
<size [as]
<Pointxyz [x1, y1, z1]
<Pointxyz [x2, y2, z2]
}

'group the curve and the arrow
totm1=sys(9)-1
tot=sys(9)

getattr totm1, type
putattr totm1, type, 1
getattr tot, type
putattr tot, type, 1

>GroupDefine
{
}

sys(80)=0
Sys(242) = 0
end


'subroutines follow
selectnew:
sp1=start+1
for j = sp1 to sys(9)
getattr j, type
putattr j, type, 1
next j
return

File to Download:

cldr.d3m