+ Reply to Thread
Page 2 of 4 FirstFirst 1 2 3 4 LastLast
Results 11 to 20 of 38
  1. #11
    Super Member chelsea1307's Avatar
    Computer Details
    chelsea1307's Computer Details
    Operating System:
    windows xp
    Using
    AutoCAD 2011
    Join Date
    Sep 2008
    Location
    Sacramento, Ca USA
    Posts
    1,109

    Default

    Registered forum members do not see this ad.

    yup that was the one i was talking about
    "The problem is stupidity. I am not saying there should be capital punishment for stupidity, but, why don't we just take the safety labels off of everything and let the problem solve itself? "

  2. #12
    Senior Member Fire Alarm's Avatar
    Computer Details
    Fire Alarm's Computer Details
    Operating System:
    Windows Vista
    Computer:
    Dell XPS XPS710
    Using
    MEP 2008
    Join Date
    May 2008
    Location
    Wilmington, DE
    Posts
    111

    Default

    Thank you for the replies. Before I try this, one question. Here is my one big headache that I cannot figure out with lisps. Am I to open up notepad, paste the text, save as a .lsp file, then load the lisp. Correct? Then up the "leng" as the command?

  3. #13
    Super Member chelsea1307's Avatar
    Computer Details
    chelsea1307's Computer Details
    Operating System:
    windows xp
    Using
    AutoCAD 2011
    Join Date
    Sep 2008
    Location
    Sacramento, Ca USA
    Posts
    1,109

    Default

    yup save the file as a .lsp then you can use appload to load it. Then type leng at the command line and you should be all good
    "The problem is stupidity. I am not saying there should be capital punishment for stupidity, but, why don't we just take the safety labels off of everything and let the problem solve itself? "

  4. #14
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,706

    Default

    Here's an upgrade for it

    Code:
    ;; ============ pLen.lsp ===============
    ;;
    ;;  FUNCTION:
    ;;  Will Display the Length of a
    ;;  Line or Polyline upon selection.
    ;;
    ;;  SYNTAX: pLen
    ;;
    ;;  AUTHOR:
    ;;  Copyright (c) 2009, Lee McDonnell
    ;;  (Contact Lee Mac, CADTutor.net)
    ;;
    ;;
    ;;  VERSION:
    ;;  1.0  ~  30.06.2009
    ;;
    ;; ====================================
    
    
    (defun c:pLen (/ *error* doc spc ent cObj tStr tSze
                     tBox wBse gr cPt pt cAng lAng)
      (vl-load-com)
    
      (defun *error* (msg)
        (and tObj
          (not
            (vlax-erased-p tObj))
              (vla-delete tObj))
        (if
          (not
            (wcmatch
              (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
          (princ
            (strcat
              "\n<< Error: " msg " >>")))
        (princ))
    
       (if
         (eq 4
           (logand 4
             (cdr (assoc 70
                    (tblsearch "LAYER"
                      (getvar "CLAYER"))))))
        (progn
          (princ "\n<< Current Layer Locked >>") (exit)))
    
      (setq doc (vla-get-ActiveDocument
                  (vlax-get-Acad-Object))
            spc (if
                  (zerop
                    (vla-get-activespace doc))
                  (if (= (vla-get-mspace doc) :vlax-true)
                    (vla-get-modelspace doc)
                    (vla-get-paperspace doc))
                  (vla-get-modelspace doc)))
      
      (while
        (progn
          (setq ent
            (car (entsel "\nSelect Object: ")))
          (cond
            ((eq 'ENAME (type ent))
             (setq cObj (vlax-ename->vla-object ent))
             (if (vlax-property-available-p cObj 'length)
               (not
                 (print
                   (setq tStr
                     (vl-princ-to-string
                       (vla-get-length cObj)))))
               (princ "\n** Invalid Object Selected **")))
            (t (princ "\n** Nothing Selected **")))))
    
      (or *Mac$Per*  (setq *Mac$Per* (/ pi 2.)))
      (or *Mac$tOff* (setq *Mac$tOff* 1.))
      (or tSze (setq tSze (getvar "TEXTSIZE")))
    
      (setq tBox (textbox
                   (list
                     (cons 1 (strcat tStr ".."))
                     (cons 40 tSze)
                     (cons 7 (getvar "TEXTSTYLE"))))
            wBse (textbox
                   (list
                     (cons 1 ".")
                     (cons 40 tSze)
                     (cons 7 (getvar "TEXTSTYLE"))))
            wBse (- (caadr wBse) (caar wBse)))
                
            (vla-put-attachmentpoint
              (setq tObj
                (vla-addMText spc
                  (vlax-3D-point '(0 0 0))
                    (setq tWid (- (caadr tBox) (caar tBox))) tStr))
              acAttachmentPointMiddleCenter)
          (vla-put-Height tObj tSze)
          (princ "\n<< Type [+] or [-] for offset, [P]er & [<] or [>] for MText Width  >>")
    
          ;; Place Text
                
          (while
            (or
              (and
                (setq gr (grread t 15 0))
                  (eq (car gr) 5))
              (and
                (eq 2 (car gr))
                (vl-position (cadr gr)
                  '(43 ; +
                    45 ; -
                    61 ; + (as =)
                    80 112  ; P/p
                    60 62 44 46)))) ; < > , .
            
            (cond ((and (eq 5 (car gr)) (listp (setq cPt (cadr gr))))
                   (setq pt (vlax-curve-getClosestPointto cObj cPt)
                         cAng (angle pt cPt)
                         lAng (+ cAng *Mac$Per*))
                   
                   (cond ((and (> lAng (/ pi 2)) (<= lAng pi))
                          (setq lAng (- lAng pi)))
                         ((and (> lAng pi) (<= lAng (/ (* 3 pi) 2)))
                          (setq lAng (+ lAng pi))))
                   
                   (vla-move tObj
                     (vla-get-InsertionPoint tObj)
                       (vlax-3D-point
                         (polar pt cAng (* tSze *Mac$tOff*))))
                   (vla-put-Rotation tObj lAng))
    
                  ((eq 2 (car gr))
                   (cond ((vl-position (cadr gr) '(43 61))
                          (setq *Mac$tOff*
                            (+ (/ 1 10.) *Mac$tOff*)))
                         ((eq (cadr gr) 45)
                          (setq *Mac$tOff*
                            (-  *Mac$tOff* (/ 1 10.))))
                         ((vl-position (cadr gr) '(80 112))
                          (setq *Mac$Per* (- (/ pi 2.) *Mac$Per*)))
                         ((vl-position (cadr gr) '(60 44))
                          (if (> (- (vla-get-Width tObj) wBse) 0)
                            (vla-put-Width tObj
                              (- (vla-get-Width tObj) wBse))))
                         ((vl-position (cadr gr) '(62 46))
                          (vla-put-Width tObj
                            (+ (vla-get-Width tObj) wBse)))))))
      (princ))
    
    (princ
      (strcat "\nCurve Length by Lee McDonnell " (chr 169) " June 2009."
              "\n         Type \"PLEN\" to Invoke"))
    (princ)
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  5. #15
    Senior Member Fire Alarm's Avatar
    Computer Details
    Fire Alarm's Computer Details
    Operating System:
    Windows Vista
    Computer:
    Dell XPS XPS710
    Using
    MEP 2008
    Join Date
    May 2008
    Location
    Wilmington, DE
    Posts
    111

    Default

    That is what I thought, however, when I save it with notepad I can only save as a .txt file. After I do that I change the extenion from a .txt for a .lsp, then it loads find, but the leng command does not work.

  6. #16
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,706

    Default

    Quote Originally Posted by Fire Alarm View Post
    That is what I thought, however, when I save it with notepad I can only save as a .txt file. After I do that I change the extenion from a .txt for a .lsp, then it loads find, but the leng command does not work.
    Make sure that the "Save as type" box is set to "All Files".

    You can also load LISP files in the Visual LISP Editor provided with AutoCAD, type VLIDE at the command line.
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  7. #17
    Super Member chelsea1307's Avatar
    Computer Details
    chelsea1307's Computer Details
    Operating System:
    windows xp
    Using
    AutoCAD 2011
    Join Date
    Sep 2008
    Location
    Sacramento, Ca USA
    Posts
    1,109

    Default

    after you set saveas type to all type*.lsp in for the file name and all lsp files in the location you are saving will now show and you can replace the * with the name you want to save as
    "The problem is stupidity. I am not saying there should be capital punishment for stupidity, but, why don't we just take the safety labels off of everything and let the problem solve itself? "

  8. #18
    Senior Member Fire Alarm's Avatar
    Computer Details
    Fire Alarm's Computer Details
    Operating System:
    Windows Vista
    Computer:
    Dell XPS XPS710
    Using
    MEP 2008
    Join Date
    May 2008
    Location
    Wilmington, DE
    Posts
    111

    Default

    It worked when I used vlide, but how can I get the text to show in feet? Does the lisp need to have some kind of dimension or distance command in it?

  9. #19
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,706

    Default

    Quote Originally Posted by Fire Alarm View Post
    It worked when I used vlide, but how can I get the text to show in feet? Does the lisp need to have some kind of dimension or distance command in it?
    Which LISP are you using?
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  10. #20
    Senior Member Fire Alarm's Avatar
    Computer Details
    Fire Alarm's Computer Details
    Operating System:
    Windows Vista
    Computer:
    Dell XPS XPS710
    Using
    MEP 2008
    Join Date
    May 2008
    Location
    Wilmington, DE
    Posts
    111

    Default

    Registered forum members do not see this ad.

    The one from the link that you (Lee Mac) provided below.

    http://www.cadtutor.net/forum/showthread.php?t=36659

Similar Threads

  1. Lisp for auto-dimensioning tons of lines.
    By Zykl0 in forum AutoLISP, Visual LISP & DCL
    Replies: 22
    Last Post: 20th Apr 2012, 03:28 pm
  2. What is key TERRA FIRMA in auto cad & how we use it in auto cad
    By tariq mahmood in forum AutoCAD General
    Replies: 3
    Last Post: 9th Jan 2009, 12:39 pm
  3. Auto Dimensioning in autocad
    By Anil.S in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 2
    Last Post: 20th Jun 2008, 11:02 am
  4. Auto dimensioning
    By bjasa in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 2
    Last Post: 19th Jun 2008, 07:24 am
  5. Dimensioning curved lines
    By DirtylittleCAD in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 7th Apr 2005, 01:27 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts