Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Polyline length leader with additional text??
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Polyline length leader with additional text?? (Read 2574 times)
0 Members and 1 Guest are viewing this topic.
donniedrake
Guest
Polyline length leader with additional text??
«
on:
November 12, 2014, 11:53:10 AM »
Anyone have a way to select a polyline, get it's length, put that length plus additional text in a mtext with leader?
The yellow highlighted text in the example is what I'm trying to accomplish.
Logged
CAB
Global Moderator
Seagull
Posts: 10401
Re: Polyline length leader with additional text??
«
Reply #1 on:
November 12, 2014, 12:06:59 PM »
Do a search. There are plenty of Label programs that can be modified.
Logged
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.
ronjonp
Needs a day job
Posts: 7531
Re: Polyline length leader with additional text??
«
Reply #2 on:
November 12, 2014, 12:09:12 PM »
And here's a quicky
to put the length.
Code - Auto/Visual Lisp:
[Select]
(
defun
c:foo
(
/
_getlength e l p1 p2
)
(
vl-load-com
)
(
defun
_getlength
(
ename
/
ep
)
(
if
(
vl-catch-all-error-p
(
setq
ep
(
vl
-
catch
-
all
-
apply
'
vlax-curve-getendparam
(
list
ename
)
)
)
)
0.0
(
vlax-curve-getdistatparam
ename ep
)
)
)
(
if
(
and
(
setq
e
(
entsel
"
\n
Select object with length: "
)
)
(
setq
p1
(
cadr
e
)
)
(
setq
e
(
car
e
)
)
)
(
if
(
and
(
/=
0.0
(
setq
l
(
_getlength e
)
)
)
(
setq
p2
(
getpoint
p1
"
\n
Specify leader landing location: "
)
)
)
(
command
"._mleader"
p1 p2 l
)
(
princ
"
\n
Object does not have length property..."
)
)
)
(
princ
)
)
«
Last Edit: November 12, 2014, 12:15:31 PM by ronjonp
»
Logged
Windows 11 x64 - AutoCAD /C3D 2023
Custom Build PC
ChrisCarlson
Guest
Re: Polyline length leader with additional text??
«
Reply #3 on:
November 12, 2014, 12:10:54 PM »
Wouldn't be to complicated
Code - Auto/Visual Lisp:
[Select]
(
setq
a
(
car
(
nentsel
"
\n
SELECT ENTITY"
)
)
)
(
if
(
and
a
(
setq
aDXF
(
entget
a
)
)
(
member
(
cdr
(
assoc
0
aDXF
)
)
'
(
"LWPOLYLINE"
"POLYLINE"
"LINE"
"ARC"
)
)
)
(
progn
(
setq
a_length
(
vla
-
get
-
length
(
vlax
-
ename
->
vla-object
a
)
)
)
)
(
princ
"Not a valid selection"
)
Then find the mid point (first point of leader), extend it and enter the text.
Logged
donniedrake
Guest
Re: Polyline length leader with additional text??
«
Reply #4 on:
November 12, 2014, 12:26:15 PM »
Side note, I'm a newbie at implementing lisp's other than existing ones. Learning slowly!
Logged
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Polyline length leader with additional text??