Leader line

Leader line

Anonymous
Not applicable
256 Views
2 Replies
Message 1 of 3

Leader line

Anonymous
Not applicable
In the "migration" from r14 to R2000 I have come across some frustrating
items that are seemingly not explanable.
Here is one of them. I have had a "curved" leader line routine for many
years (Rel10 I think).
For some reason it done not do all that it is supposed to.
What it does not do is the "pedit" of the leader line into a splined pline.
Below is the code.

(defun C:LEA (/ osm scale wide spt ept1 ept2 npt n_layer x_layer)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(setvar "cmdecho" 0)
(setq scale (gscale)) ;gscale is a function to retrieve
current scale factor
(setq wide (* 0.05 scale)
long (* 0.125 scale)
spt (getpoint "\nStart of arrowhead: ")
ept1 (getpoint spt "\nAngle of arrowhead: ")
ept2 (polar spt (angle spt ept1) long)
npt (polar ept2 (angle spt ept1) long)
)
(command ".pline" spt "w" 0 wide ept2 "w" 0 0 "")
(setq n_layer (strcat (getvar "USERS1") "txt")) ;This part
of the routine will
(setq x_layer (tblsearch "layer" n_layer)) ;change
the arrowhead to the
(if x_layer
;current discipline "text"
(command ".chprop" spt "" "la" n_layer "c" "1" "") ;layer
)
(command ".pline" ept2 npt)
(while
(type (setq npt (getpoint npt "\nNext point: ")) 'LIST)
(command npt)
)
(command "")
(command ".pedit" "l" "s" "")
(if x_layer
;As above, changes leader line
(command ".chprop" ept2 "" "la" n_layer "c" "1" "") ;to current
"text" layer.
)
(setvar "osmode" osm)
(princ)
)

In advance, thanks for the help..
0 Likes
257 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Try this. Add the polyline to a selection set.

(setq LEADR (ssadd))

(command ".pline" ept2 npt)
(while
(type (setq npt (getpoint npt "\nNext point: ")) 'LIST)
(command npt)
)
(command "")

(ssadd (entlast) LEADR)
(command "pedit" LEADR "s" "" )

This is what I used until I figuired out how to use the native AutoCAD
Leader in my leader routine.

CJ Follmer
0 Likes
Message 3 of 3

Anonymous
Not applicable
No success from that suggestion.
I have "stripped" all possible outside interferences (such as layer
changing) from the original posting and still this "thin" routine works in
R14 but not in R2000.
What's up, folks?

Here is the revised routine.

(defun C:LEA ()
(setq wide 0.05
long 0.125
spt (getpoint "\nStart of arrowhead: ")
ept1 (getpoint spt "\nAngle of arrowhead: ")
ept2 (polar spt (angle spt ept1) long)
npt (polar ept2 (angle spt ept1) long)
)
(command ".pline" spt "w" 0 wide ept2 "w" 0 0 "")
(command ".pline" ept2 npt)
(while
(type (setq npt (getpoint npt "\nNext point: ")) 'LIST)
(command npt)
)
(command "")
(setq junk (* 1 1))
(command ".pedit" "l" "s" "")
(princ)
)

Note: I added the line (setq junk....) purely to test where the routine
stops. The value of "junk" in R14 is "1", in R2000 it is "nil".

CJF wrote in message
news:eee1e30.0@WebX.SaUCah8kaAW...
> Try this. Add the polyline to a selection set.
>
> (setq LEADR (ssadd))
>
> (command ".pline" ept2 npt)
> (while
> (type (setq npt (getpoint npt "\nNext point: ")) 'LIST)
> (command npt)
> )
> (command "")
>
> (ssadd (entlast) LEADR)
> (command "pedit" LEADR "s" "" )
>
> This is what I used until I figuired out how to use the native AutoCAD
> Leader in my leader routine.
>
> CJ Follmer
>
0 Likes