need lisp for labelling lines

Discussion in 'AutoCAD' started by kewlgurl, Jan 22, 2004.

  1. kewlgurl

    kewlgurl Guest

    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?
     
    kewlgurl, Jan 22, 2004
    #1
  2. kewlgurl

    Rakesh Rao Guest

    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



    --

    AutoCAD customization for Engineering/Mapping/GIS
    Get GeoTools @ http://www.4d-technologies.com/geotools
    Build MyGeoTools @ http://www.4d-technologies.com/geotools/my_geotools.htm
    FREE downloads : http://www.4d-technologies.com/techcenter
    </PRE>
     
    Rakesh Rao, Jan 22, 2004
    #2
  3. kewlgurl

    CAB2k Guest

    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)
     
    CAB2k, Jan 24, 2004
    #3
  4. kewlgurl

    hawkeye2 Guest

    This program by Watson H. Kilbourne for Cadalyst Magazine
    June 1993 Pages 115-117 might be useful>
     
    hawkeye2, Jan 26, 2004
    #4
  5. kewlgurl

    btlsp Guest

    btlsp, Jan 27, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.