
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys,
I need some customization in the lisps resources I have found here and other websites. I have written some programs in VBA but I have no idea of LISP but been using others LISP files in the past which have been very helpful.
Basically I am using the following code (by others) and did some tweaking. If I draw a pline in CAD in mm, this routine puts the text underneath in m showing the line length.
I would like to add 2 features and if someone could help:
1. Add suffix to the text "m"
2. Iff the text number is less than 1.8m it should also add prefix "P1 " otherwise add prefix "M1 "
So in short, if a draw a line less than 1.8m long i should see text under the line "P1 xxm"
if line length is equal to or more than 1.8m i should see "M1 xxm"
Thanks in advance
(Defun c:BRR (/ pt1 pt2) ; Text over Polyline
(setvar "cmdecho" 0)
(if (setq pt1 (getpoint "\nPick the first Point: "))
(progn
(command "_Pline" pt1)
(while (> (getvar "CMDACTIVE") 0)
(if (setq pt2 (getpoint pt1 "\nPick Next point:"))
(progn
(entmakex
(list
(cons 0 "TEXT")
(cons 10
(Setq p_ (polar
(mapcar '(lambda (x y)
(* 0.5 (+ x y))
)
pt1
pt2
)
(+ (setq ang (angle pt1 pt2)) (/ pi 2.0))
(- 360)
)
)
)
(cons 11 p_)
(cons 40 175)
(Cons 50 ang)
'(72 . 4)
'(73 . 3)
(cons 1
((rtos (/ (distance pt1 pt2) 1000.0) 2 2)
)
)
)
(setq pt1 pt2)
(command pt2)
)
(command "")
)
)
)
)
(princ)
)
Solved! Go to Solution.