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:
Help ME re - format code
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Help ME re - format code (Read 1574 times)
0 Members and 1 Guest are viewing this topic.
HOSNEYALAA
Newt
Posts: 107
Help ME re - format code
«
on:
November 07, 2018, 01:40:12 AM »
I have a code that gives the point the height of the nearest TEXT of the point
Is it possible to choose points and numbers at once?
And the requirement that the number of Texts equal the number of characters until the code works
Thanks a lot to everyone.
Code - Auto/Visual Lisp:
[Select]
(
defun
c:DTP
(
/
AP AT DD END1 END2 H HH HTT I II J LEN NP NT XL1 XL2 YL1 YL2 ZND2
)
; ***************************************
(
ALERT
"Required number of points = number of writings"
)
(
command
"layer"
"m"
"NEW_TXT"
""
)
(
command
"color"
"t"
"253,176,23"
)
(
command
"CMDECHO"
"0"
)
(
princ
"
\n
Select POINT :"
)
(
SETQ
AP
(
SSGET
(
LIST
(
CONS
0
"POINT"
)
)
)
)
(
princ
"
\n
Select POINT :"
)
(
setq
NP
(
sslength
AP
)
)
; No of POINT
(
princ
"
\n
Select TEXT :"
)
(
SETQ
AT
(
SSGET
(
LIST
(
CONS
0
"TEXT,MTEXT"
)
)
)
)
(
princ
"
\n
Select TEXT,MTEXT :"
)
(
setq
NT
(
sslength
AT
)
)
; No of TEXT
;******************************************************************
(
setq
I
0
)
; Order of POINT
(
setq
II
0
)
; Order of TEXT
(
setq
DD
100
)
; No. of Intersection
(
while
(
<
I NP
)
(
while
(
<
II NT
)
(
setq
END1
(
cdr
(
assoc
10
(
entget
(
ssname
AP I
)
)
)
)
)
; Get Point
(
setq
END2
(
cdr
(
assoc
10
(
entget
(
ssname
AT II
)
)
)
)
)
; GetTEXT
(
setq
ZND2
(
ATOF
(
cdr
(
assoc
1
(
entget
(
ssname
AT II
)
)
)
)
)
)
; GetTEXT
(
setq
XL1
(
car
END1
)
)
; Get X cordinate for START POINT.
(
setq
YL1
(
cadr
END1
)
)
; Get Y cordinate for START POINT.
(
setq
XL2
(
car
END2
)
)
; Get X cordinate for END TEXT.
(
setq
YL2
(
cadr
END2
)
)
; Get Y cordinate for END TEXT.
(
setq
len
(
sqrt
(
ABS
(
+
(
expt
(
-
YL2 YL1
)
2
)
(
expt
(
-
XL2 XL1
)
2
)
)
)
)
)
(
if
(
<
LEN DD
)
(
progn
(
setq
hh
(
list
XL1 YL1 ZND2
)
)
(
setq
DD LEN
)
)
(
progn
(
setq
h
(
list
XL1 YL1
)
)
)
)
(
SETQ
II
(
+
1
II
)
)
)
;while
(
SETQ
htT
(
RTOS
(
CADDR
HH
)
2
2
)
)
(
command
"._Text"
"j"
"mc"
HH
2
"0"
htt
)
(
command
"._point"
hh
)
;;; (command "._Change" (entlast) "" "p" "ELEV" "ZND2" "")
(
setq
II
0
)
(
SETQ
I
(
+
1
I
)
)
(
setq
DD
100
)
)
;while
)
EDIT (John): Added code tags to post for formatting.
«
Last Edit: November 07, 2018, 07:25:38 AM by John Kaul (Se7en)
»
Logged
BIGAL
Swamp Rat
Posts: 1444
40 + years of using Autocad
Re: Help ME re - format code
«
Reply #1 on:
February 06, 2019, 07:54:57 PM »
Just search this has been answered many times using a distance between point and text.
Logged
A man who never made a mistake never made anything
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Help ME re - format code