need lisp for labelling lines

kewlgurl

Usenet Archive
Joined
Jan 22, 2004
Messages
1
Reaction score
0
Does anyone have a lisp that would work like the dim command but instead of labelling the distance between two points it labels the bearing?
 
Our GeoTools program has a comprehensive polyline (and lines) labeling tool that will label the segments with distance, bearing and user strings.

You can download a fully functional eval version from our site (see URL fow download below).

Let me know if it works for you and is you have any questions. If you need the Lisp to do just the labeling, you can have it. See 'MyGeoTools'
- URL is also below.

- Rakesh Rao

Does anyone have a lisp that would work like the dim command but instead of labelling the distance between two points it labels the bearing?
 
Try this, very simple routine.

(defun C:TA
;;; ------- Some Housekeeping ------------------
(setq usercmd (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq useros (getvar "osmode"))
(setvar "osmode" 1); end point snap

(setq p1 (getpoint "\nSelect first endpoint of line: ")) (setq p2 (getpoint "\nSelect other endpoint of line: ")) (setq d (distance p1 p2)) (setq di (rtos d 2 2)) (setq L_Angle (angle p1 p2)) ; line angle (Setq ang (* L_Angle (/ 180 pi))) (setq ant (angtos ang 4 2)) (setvar "OSMODE" 0) (setq txt (strcat di "'" " " ant)) ; text string

;;; Text offset 4 units distance from line
(If (or (<= L_Angle 1.5708) (> L_Angle 4.71239))
(setq oo 4.0)
(setq oo -4.0)
)
;;; Calculate midpoint of pline
(setq midpt (polar p1 L_Angle (/ d 2.0)))
;;; Calculate text insertion point
(setq txtpt (polar midpt (+ L_Angle (/ pi 2.0))oo )) ;end setq ;;; Convert Text angle from Radians to Degrees (Setq L_Angle (* 180.0 (/ L_Angle pi))) ;;; Adjust angle to keep text upwright (Cond ((and (> L_Angle 90) (<= L_Angle 180)) (setq L_Angle (+ L_Angle 180)) ) ((and (> L_Angle 180) (<= L_Angle 270)) (setq L_Angle (- L_Angle 180)) )
)

;;;Check if the drawing text height is set to 0:
(setq dwg_style (getvar "textstyle"))
(setq styledata (tblsearch "style" dwg_style))
(setq dwg_ht (cdr (assoc 40 styledata)))
;;; If text height is undefined (signified by 0 in the table) (if (= dwg_ht 0) ;;; Draw the text using the current text height (textsize) (command "text" "c" txtpt "" L_Angle txt) ;;; Otherwise use the defined text height (command "text" "c" txtpt L_Angle txt)
) ; endif

;;;========== Exit Sequence ============
(setvar "osmode" useros)
(setvar "CMDECHO" usercmd)
;;; Exit quietly
(princ)

) ; end defun
;;; Notify user program ready to use
(prompt "\nSurvey Labeler Loaded: Type 'TA' to run it.")
(princ)
 
This program by Watson H. Kilbourne for Cadalyst Magazine June 1993 Pages 115-117 might be useful>
 

Latest threads

Back
Top