DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Curved Arrows

Started by Skybolt21, October 28, 2008, 01:13:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Skybolt21

Is there an easy way to make curved arrows? Sometimes I like to have a swooshy S-shaped arrow pointing to an object in my drawings instead of just straight arrows... so far I usually just use the 'Curve' command, and then add a really short arrow on the end of it... is there a better way?

Pearco

SkyBolt21;

In v18 there is a sample macro called Curved_Arrow.d3m that will do the trick. It requires you set 6 points to get the curve shape and arrowhead you want. I am sure you can modify the macro to the number of points you want. I think it was in other versions also.
Jim
User since ProDesign 1.5

SciGraphics

A: Draw a curve.
2: Add a very short arrow on the end of it using line snap and end point snap.

Jim A.

Skybolt21

Thanks, Pearco... I'll check that out.

Sci, is that not exactly how I said that I am currently doing it in my original post? *curnfused* Or are you just saying that IS the only method...

SciGraphics

Skybolt21: I grovel in mortification. Jim A.

Skybolt21

Quote from: SciGraphics on October 29, 2008, 08:09:21 PM
Skybolt21: I grovel in mortification. Jim A.

Hahaha... wasn't trying to be a smart alec, just thought I might have missed something... <K> for line point and then end-point snap on my curve with the arrow is exactly how I do it...

Played with the macro... it works pretty good but even with an 'Execute Macro' button added to the tool-bar still takes a couple clicks to get to.... might as well just do it like I have been.

Be a nice tool to add to a future version.

REF

#6
Try this different macro that I got somewhere on this forum . You might have to edit the arrow head size, type and layer.
DesignCAD user since 1990

charly-bochum

I had written a macro for that purpose. You find it in the appendix.

The 3 first points determin the arc of the arrow from end to top, the distance of point 4 to points 3 determines the length of the arrowhead.
Line width is set then to 1/10 of the length of arrowhead.

The coordinates of the points should be greater than -1000/-1000, the upper boundary of the offset-area, in that the parts first are drawn and grouped.

prl

#8
The code Ref has attached is an old version of something I put together. Here is one that works with versions 15 to 18.  Note I put my curved leaders on layer 23.  You need to edit the code to suit your needs.



'Program: cldr.d3m (curved leader)

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

gosub getversion

if dcver > 15 then
  as = sys(12) 'text size setting for arrows in version 16+
else
  as = 1
endif

clay = sys(3) 'current layer
lay=23 'set preferred layer for leader
layer(lay)=6
sys(3)=lay

start = sys(9)

sys(1) = 0
>curve
  {
  <type 0
  <incomplete
  }
sys(1) = 0
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(1), jy(1), jz(1)]
}

' 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
{
<Layer [lay]
<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
sys(3) = clay
end


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

getversion:
  s$ = sys$(105)
  fmt$ = "%d.%d.%d"
  parse s$, fmt$, dcver, dum1, dum2
return




Edit: cleaned up the above code a little.

bdeck


bdeck

#10
Hi prl,

I had some time this weekend, so I took a shot at adding some bells and whistles to your curved arrow macro to match my tastes.


1)     changed segment command to vectorconvert
         Segment command would require a movetoback command to prevent errors (ie: snapping to a balloon).
         See  http://forum.designcad.com/index.php?topic=1578.0
       
2)      scaled the x1-x2 distance based on arrow size
        ( I could not get the "specifydistance" parameter to work in the segment command. Anybody know how?)
     
3)      changed connection point from x2 to x1 to improve editing in point select mode.

4)      inserted an additional control point on curve near the arrow to improve editing.

5)      added archive/restore subroutines to preserve preexisting selections (if any)

6)      changed arrow size to match dimension settings  ( I have v15 and v17, but not 16, so Im not certain when the change occured)


Thanks for posting

BD


PS: These things have a way of getting out of hand......



Edited 11/09/08 to correct sys(80)/getselect bug

prl

Quote from: bdeck on November 02, 2008, 10:11:50 PM
PS: These things have a way of getting out of hand......

I always felt IMSI should concentrate on cad function fundamentals with equivalents through basiccad.  If the basics work, users like you and I can code anything and make DesignCAD behave the way we want.

You've always been willing to open source your creations and improvements and that creates an infectious response in DesignCAD basiccad devotees.

Thanks

Skybolt21

Thanks, guys. PRL, your program works great. Thanks for posting that.

Dr PR

prl and bdeck (and other macro users),

I have a question. You are obviously very familiar with the macro language in DesignCAD. I am not, and deliberately so.

I cut my teeth on macro assemblers back in the 70s. I even wrote macros to make Microsoft's 8080 assembler generate 68000 code - a mind bender at the time. I used macros in every program that had them and developed extensive add-ons for many.

Then the moron programmers changed the macro languages. I would spend weeks or months rewriting and debugging the macros, and about the time I would have them running again the idiots would change the language again. After a few rounds of this I swore off macros forever. I didn't write the macros just for the fun of it, but to produce useful functions in otherwise deficient programs. I found I was wasting more time rewriting the macros than I was using them. I haven't written a macro in any program for at least 20 years.

Here is my question: How often has the DesignCAD macro language or file structure changed and made all your hard work developing a macro useless? I have followed some of the macros discussions on the forum and it appears to me that it still isn't stable enough to be worth the trouble.
DesignCAD user since 1987

bdeck

#14
Quote from: Dr PR on November 07, 2008, 09:09:03 PM
How often has the DesignCAD macro language or file structure changed ...?

Between version 6 and 7 the DC user interface and the macro language both changed enough that it was not worth my time to mess with it. For a number of years I did all my drawing in version 6 and used v 7 only for its print drivers.

By version 13 the macro language had improved enough that it was possible to begin programming DC in Basiccad to bring back some of the features that had been stripped from it in version 7. With help from prl and lar I was able to bring myself up to date.

With very few exceptions ( ie input# ), basiccad has seen steady improvement since then, with good forward compatibility.

prl may have more info about the interim.

BD