Jump to content

Auto dimesioning polyline


VaKaDi

Recommended Posts

Hi,

 

How about just make draworder,like layer 1 above layer 2;layer 2 above layer 3,layer 3 above layer 4,etc.can you help me to make this ?

 

thanks

Link to comment
Share on other sites

  • 2 weeks later...

Hi Lee Mac.....have tried your lisp codes.....somehow it does not work on poly lines.....would you be able to assist or have a lisp code that can:

 

1. show dimensions - with and without bearings

2. dimesion of only a selected polyline

3. dimension of all proposed polyline to where other lines intersect with the selected poly line.

 

i look forward to your kind help:unsure:

Link to comment
Share on other sites

Hi Lee Mac.....have tried your lisp codes.....somehow it does not work on poly lines....

 

It should work on polylines... - it only uses the vla-getBoundingBox function which will work on all drawing objects...

 

What error is occurring?

Link to comment
Share on other sites

Hi Lee

 

I have a polyline which has about 18 face sides @ differant angles and when i use the "DIMBLK" lisp command i get only two right angled triangled dimensions.

Link to comment
Share on other sites

Hi Lee

 

I have a polyline which has about 18 face sides @ differant angles and when i use the "DIMBLK" lisp command i get only two right angled triangled dimensions.

Link to comment
Share on other sites

Hi Lee

 

I have a polyline which has about 18 face sides @ differant angles and when i use the "DIMBLK" lisp command i get only two right angled triangled dimensions.

 

Yes, that is all that my dimension LISP does.

Link to comment
Share on other sites

Hi Lee Mac

 

my bad on the confusion of the lisp codes.....would you have a lips code that would be able to auto dimension along the face of each polyline with bearing included :?

Link to comment
Share on other sites

Thanks Lee Mac i have tried ASMI's code and it works great.....its that the txt on some line faces do not centre on the dimension.....but dont worry at least all the lines have been dimensioned as i wanted.....

 

Cheers and many thanks again for you kind help.....

Link to comment
Share on other sites

Hi Lee Mac......would you have a code similar to ASMI's code which would include bearings of the lines or polylines?

 

I don't have one atm, but I could try to make one :)

Link to comment
Share on other sites

Perhaps this?

 

;; ============================================================    ;;
;;                                                              ;;
;;  PDIM.LSP - This lisp is for dimensioning of several         ;;
;;             LwPolylines simultaneously. The program works    ;;
;;             with the current dimensional style.        ;;
;;           The distance of the dimensional text from a    ;;
;;           polyline is equal to the height of the        ;;
;;           dimensional text (DIMTEXT system variable)    ;;
;;           multiplied by a variable 'tOff'.            ;;
;;           You can change value of 'tOff' in the          ;;
;;             program beginning, after the note.               ;;
;;                                                              ;;
;; ============================================================    ;;
;;                                                                ;;
;;  Command(s) to call: PDIM                                 ;;
;;                                                              ;;
;;  Select LwPolylines and press Enter.                            ;;
;;                                                                ;;
;; ============================================================    ;;
;;                                                                 ;;
;;  THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD    ;;
;;  ON ANY MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS    ;;
;;  PROGRAM OR PARTS OF IT ABSOLUTELY FREE.                     ;;
;;                                                              ;;
;;  THIS PROGRAM PROVIDES THIS PROGRAM 'AS IS' WITH ALL FAULTS    ;;
;;  AND SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF        ;;
;;  MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.            ;;
;;                                                                ;;
;; ============================================================    ;;
;;                                                              ;;
;;  V1.2, 9th Okt 2008, Riga, Latvia                            ;;
;;  © Aleksandr Smirnov (ASMI)                              ;;
;;  For AutoCAD 2000 - 2008 (isn't tested in a next versions)    ;;
;;                                                              ;;
;;                                 http://www.asmitools.com       ;;
;;                                                                ;;
;; ============================================================ ;;

(defun c:pdim (/ tOff plSet pLlst vLst oldDss cAng cDis cPt)

; NOTE 
;                                                                 
;  The distance of the text from a LwPolyline line is equal       
;  of multiplication of system variable 'DIMTXT' (height of       
;  the dimensional text) on a variable 'tOff'. Change this        
;  variable to change this distance.                              

 (setq tOff 1.0)
 
 (princ "\n<<< Select LwPolyline for dimensioning >>> ")
 (if (setq plSet (ssget '((0 . "LWPOLYLINE"))))
   (progn
     (setq pLlst (vl-remove-if 'listp
                        (mapcar 'cadr (ssnamex plSet)))
       oldDss (getvar "DIMASSOC"))
     (setvar "CMDECHO" 0)
     (command "_.undo" "_be")
     (setvar "DIMASSOC" 2)
     (foreach pl pLlst
   (setq vLst (mapcar '(lambda(x)
           (trans x 0 1)) (mapcar 'cdr
             (vl-remove-if-not
               '(lambda(x) (= 10(car x))) (entget pl)))))
   (if (equal '(70 . 1) (assoc 70 (entget pl)))
     (setq vLst (append vLst (list (car vLst)))))
   (while (< 1 (length vLst))
     (setq cAng (angle (car vLst) (cadr vLst))
           cDis (/ (distance (car vLst) (cadr vLst)) 2))
     (if (>= (caar vLst) (caadr vLst))
       (setq cAng (- cAng pi)))
     (setq cPt (polar (polar (car vLst) cAng cDis)
            (+ cAng (* 0.5 pi)) (* 1.0 (getvar "DIMTXT")))
       bPt (polar (polar (car vLst) cAng cDis)
            (+ cAng (* 0.5 pi)) (* 3.0 (getvar "DIMTXT"))))      
     (command "_.dimaligned" "_end" (car vLst)
          "_end" (cadr vLst) "_none" cPt)
     (Make_Text bPt (strcat (angtos cAng 0 2) "%%D") cAng)
     (setq vLst (cdr vLst))))
     (setvar "DIMASSOC" oldDss)
     (command "_.undo" "_e")
     (setvar "CMDECHO" 1)))
 (princ))

(princ "\n*** Type PDIM for multiple LwPolyline dimensioning *** ")

(defun Make_Text  (pt val rot)
 (entmake (list '(0 . "TEXT")
        '(8 . "0")
        (cons 10 pt)
        (cons 40 (getvar "TEXTSIZE"))
        (cons 1 val)
        (cons 50 rot)
        (cons 7 (getvar "TEXTSTYLE"))
        '(71 . 0)
        '(72 . 1)
        '(73 . 1)
        (cons 11 pt))))

Link to comment
Share on other sites

Thanks Lee Mac

 

Sorry if iam asking for to much.....the lisp works great.....would you be able to include "minutes & seconds" after degress?

Link to comment
Share on other sites

OK:

 

;; ============================================================    ;;
;;                                                              ;;
;;  PDIM.LSP - This lisp is for dimensioning of several         ;;
;;             LwPolylines simultaneously. The program works    ;;
;;             with the current dimensional style.        ;;
;;           The distance of the dimensional text from a    ;;
;;           polyline is equal to the height of the        ;;
;;           dimensional text (DIMTEXT system variable)    ;;
;;           multiplied by a variable 'tOff'.            ;;
;;           You can change value of 'tOff' in the          ;;
;;             program beginning, after the note.               ;;
;;                                                              ;;
;; ============================================================    ;;
;;                                                                ;;
;;  Command(s) to call: PDIM                                 ;;
;;                                                              ;;
;;  Select LwPolylines and press Enter.                            ;;
;;                                                                ;;
;; ============================================================    ;;
;;                                                                 ;;
;;  THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD    ;;
;;  ON ANY MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS    ;;
;;  PROGRAM OR PARTS OF IT ABSOLUTELY FREE.                     ;;
;;                                                              ;;
;;  THIS PROGRAM PROVIDES THIS PROGRAM 'AS IS' WITH ALL FAULTS    ;;
;;  AND SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF        ;;
;;  MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.            ;;
;;                                                                ;;
;; ============================================================    ;;
;;                                                              ;;
;;  V1.2, 9th Okt 2008, Riga, Latvia                            ;;
;;  © Aleksandr Smirnov (ASMI)                              ;;
;;  For AutoCAD 2000 - 2008 (isn't tested in a next versions)    ;;
;;                                                              ;;
;;                                 http://www.asmitools.com       ;;
;;                                                                ;;
;; ============================================================ ;;

(defun c:pdim (/ tOff plSet pLlst vLst oldDss cAng cDis cPt)

; NOTE 
;                                                                 
;  The distance of the text from a LwPolyline line is equal       
;  of multiplication of system variable 'DIMTXT' (height of       
;  the dimensional text) on a variable 'tOff'. Change this        
;  variable to change this distance.                              

 (setq tOff 1.0)
 
 (princ "\n<<< Select LwPolyline for dimensioning >>> ")
 (if (setq plSet (ssget '((0 . "LWPOLYLINE"))))
   (progn
     (setq pLlst (vl-remove-if 'listp
                        (mapcar 'cadr (ssnamex plSet)))
       oldDss (getvar "DIMASSOC"))
     (setvar "CMDECHO" 0)
     (command "_.undo" "_be")
     (setvar "DIMASSOC" 2)
     (foreach pl pLlst
   (setq vLst (mapcar '(lambda(x)
           (trans x 0 1)) (mapcar 'cdr
             (vl-remove-if-not
               '(lambda(x) (= 10(car x))) (entget pl)))))
   (if (equal '(70 . 1) (assoc 70 (entget pl)))
     (setq vLst (append vLst (list (car vLst)))))
   (while (< 1 (length vLst))
     (setq cAng (angle (car vLst) (cadr vLst))
           cDis (/ (distance (car vLst) (cadr vLst)) 2))
     (if (>= (caar vLst) (caadr vLst))
       (setq cAng (- cAng pi)))
     (setq cPt (polar (polar (car vLst) cAng cDis)
            (+ cAng (* 0.5 pi)) (* 1.0 (getvar "DIMTXT")))
       bPt (polar (polar (car vLst) cAng cDis)
            (+ cAng (* 0.5 pi)) (* 3.0 (getvar "DIMTXT"))))      
     (command "_.dimaligned" "_end" (car vLst)
          "_end" (cadr vLst) "_none" cPt)
     (Make_Text bPt (strcat (angtos cAng 0 2) "%%D" (chr 32)
   (angtos cAng 1 3)) cAng)
     (setq vLst (cdr vLst))))
     (setvar "DIMASSOC" oldDss)
     (command "_.undo" "_e")
     (setvar "CMDECHO" 1)))
 (princ))

(princ "\n*** Type PDIM for multiple LwPolyline dimensioning *** ")

(defun Make_Text  (pt val rot)
 (entmake (list '(0 . "TEXT")
        '(8 . "0")
        (cons 10 pt)
        (cons 40 (getvar "TEXTSIZE"))
        (cons 1 val)
        (cons 50 rot)
        (cons 7 (getvar "TEXTSTYLE"))
        '(71 . 0)
        '(72 . 1)
        '(73 . 1)
        (cons 11 pt))))

Link to comment
Share on other sites

Hi Lee Mac

 

The Lisp works great.....but I have two degree readings with the minutes and seconds.........could there be only one degree reading?

 

Sorry for the confusion

Link to comment
Share on other sites

Hi Lee Mac

 

The Lisp works great.....but I have two degree readings with the minutes and seconds.........could there be only one degree reading?

 

Sorry for the confusion

 

Sorry, my misinterpretation - shall post new code :)

Link to comment
Share on other sites

;; ============================================================    ;;
;;                                                              ;;
;;  PDIM.LSP - This lisp is for dimensioning of several         ;;
;;             LwPolylines simultaneously. The program works    ;;
;;             with the current dimensional style.        ;;
;;           The distance of the dimensional text from a    ;;
;;           polyline is equal to the height of the        ;;
;;           dimensional text (DIMTEXT system variable)    ;;
;;           multiplied by a variable 'tOff'.            ;;
;;           You can change value of 'tOff' in the          ;;
;;             program beginning, after the note.               ;;
;;                                                              ;;
;; ============================================================    ;;
;;                                                                ;;
;;  Command(s) to call: PDIM                                 ;;
;;                                                              ;;
;;  Select LwPolylines and press Enter.                            ;;
;;                                                                ;;
;; ============================================================    ;;
;;                                                                 ;;
;;  THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD    ;;
;;  ON ANY MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS    ;;
;;  PROGRAM OR PARTS OF IT ABSOLUTELY FREE.                     ;;
;;                                                              ;;
;;  THIS PROGRAM PROVIDES THIS PROGRAM 'AS IS' WITH ALL FAULTS    ;;
;;  AND SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF        ;;
;;  MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.            ;;
;;                                                                ;;
;; ============================================================    ;;
;;                                                              ;;
;;  V1.2, 9th Okt 2008, Riga, Latvia                            ;;
;;  © Aleksandr Smirnov (ASMI)                              ;;
;;  For AutoCAD 2000 - 2008 (isn't tested in a next versions)    ;;
;;                                                              ;;
;;                                 http://www.asmitools.com       ;;
;;                                                                ;;
;; ============================================================ ;;

(defun c:pdim (/ tOff plSet pLlst vLst oldDss cAng cDis cPt)

; NOTE 
;                                                                 
;  The distance of the text from a LwPolyline line is equal       
;  of multiplication of system variable 'DIMTXT' (height of       
;  the dimensional text) on a variable 'tOff'. Change this        
;  variable to change this distance.                              

 (setq tOff 1.0)
 
 (princ "\n<<< Select LwPolyline for dimensioning >>> ")
 (if (setq plSet (ssget '((0 . "LWPOLYLINE"))))
   (progn
     (setq pLlst (vl-remove-if 'listp
                        (mapcar 'cadr (ssnamex plSet)))
       oldDss (getvar "DIMASSOC"))
     (setvar "CMDECHO" 0)
     (command "_.undo" "_be")
     (setvar "DIMASSOC" 2)
     (foreach pl pLlst
   (setq vLst (mapcar '(lambda(x)
           (trans x 0 1)) (mapcar 'cdr
             (vl-remove-if-not
               '(lambda(x) (= 10(car x))) (entget pl)))))
   (if (equal '(70 . 1) (assoc 70 (entget pl)))
     (setq vLst (append vLst (list (car vLst)))))
   (while (< 1 (length vLst))
     (setq cAng (angle (car vLst) (cadr vLst))
           cDis (/ (distance (car vLst) (cadr vLst)) 2))
     (if (>= (caar vLst) (caadr vLst))
       (setq cAng (- cAng pi)))
     (setq cPt (polar (polar (car vLst) cAng cDis)
            (+ cAng (* 0.5 pi)) (* 1.0 (getvar "DIMTXT")))
       bPt (polar (polar (car vLst) cAng cDis)
            (+ cAng (* 0.5 pi)) (* 3.0 (getvar "DIMTXT"))))      
     (command "_.dimaligned" "_end" (car vLst)
          "_end" (cadr vLst) "_none" cPt)
     (Make_Text bPt (angtos cAng 1 3) cAng)
     (setq vLst (cdr vLst))))
     (setvar "DIMASSOC" oldDss)
     (command "_.undo" "_e")
     (setvar "CMDECHO" 1)))
 (princ))

(princ "\n*** Type PDIM for multiple LwPolyline dimensioning *** ")

(defun Make_Text  (pt val rot)
 (entmake (list '(0 . "TEXT")
        '(8 . "0")
        (cons 10 pt)
        (cons 40 (getvar "TEXTSIZE"))
        (cons 1 val)
        (cons 50 rot)
        (cons 7 (getvar "TEXTSTYLE"))
        '(71 . 0)
        '(72 . 1)
        '(73 . 1)
        (cons 11 pt))))

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...