<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Lisp automatic dimension in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8855944#M87448</link>
    <description>&lt;P&gt;Welcome to these Forums!&lt;/P&gt;
&lt;P&gt;I guess you came here to get help on how to code your own programs. Is it that right?&lt;/P&gt;
&lt;P&gt;The following code supposed&amp;nbsp;to show you what's possible. &amp;nbsp;Consider that as a welcome gift because I feel like generous today. Don't hesitate to ask if you have any question about the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)

(defun c:DimToPolyline ( / i p1 p2 px ints obj pl pts ss tmp used pair)
  
  (if (and (setq ss (ssget '((0 . "LINE"))))
           (setq pl (car (entsel "\nSelect polyline: ")))
           (or (= "LWPOLYLINE" (cdr (assoc 0 (entget pl))))
               (prompt "\nError: Selected object is not a polyline!"))
           (setq obj (vlax-ename-&amp;gt;vla-object pl))
           (setq pts (mapcar '(lambda (x) (list (cdr (assoc 10 x))
                                                (cdr (assoc 11 x))))
                             (mapcar 'entget (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))))
           )
    (foreach pair pts
      (foreach i '(0 1)
        (and (setq p1 (nth i pair)
                   p2 (nth (- 1 i) pair))
             (setq tmp (entmakex (list '(0 . "LINE") (cons 10 p1) (cons 11 (polar p1 (+ (angle p1 p2) (/ pi 2)) 1.)))))
             (setq ints (LM:intersections obj (vlax-ename-&amp;gt;vla-object tmp) acextendotherentity))
             (setq ints (vl-sort ints (function (lambda (e1 e2)
                                                  (&amp;lt; (distance e1 p1)
                                                     (distance e2 p1))))))
             (setq px (car ints))
             (or (and (LM:UniqueFuzz-p (cons (append p1 px) used) 0.01)
                      (setq used (cons (append p1 px) used))
                      (vl-cmdf "_.dimaligned" "_non" p1 "_non" (car ints) "_non" "@")
                      )
                 T)
             (entdel tmp)))))
  (princ)
  )



;; Intersections  -  Lee Mac
;; Returns a list of all points of intersection between two objects
;; for the given intersection mode.
;; ob1,ob2 - [vla] VLA-Objects
;;     mod - [int] acextendoption enum of intersectwith method

(defun LM:intersections ( ob1 ob2 mod / lst rtn )
  (if (and (vlax-method-applicable-p ob1 'intersectwith)
           (vlax-method-applicable-p ob2 'intersectwith)
           (setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
           )
    (repeat (/ (length lst) 3)
      (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
            lst (cdddr lst)
            )
      )
    )
  (reverse rtn)
  )

;; Unique-p with Fuzz  -  Lee Mac
;; Returns T if a list contains items considered distinct to
;; a given tolerance

(defun LM:UniqueFuzz-p ( l f )
  (or (null l)
      (and (not (vl-some (function (lambda ( x ) (equal x (car l) f))) (cdr l)))
           (LM:UniqueFuzz-p (cdr l) f)
           )
      )
  )&lt;/PRE&gt;</description>
    <pubDate>Mon, 17 Jun 2019 17:34:38 GMT</pubDate>
    <dc:creator>ВeekeeCZ</dc:creator>
    <dc:date>2019-06-17T17:34:38Z</dc:date>
    <item>
      <title>Lisp automatic dimension</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8854828#M87446</link>
      <description>&lt;P&gt;Pls help me Lisp Automatic Dimension&lt;/P&gt;&lt;P&gt;Images depicting what to do&lt;/P&gt;&lt;P&gt;Dim from Red line to Blue line&amp;nbsp;with angle = 90&amp;nbsp;degrees&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled.jpg" style="width: 207px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/647856i5F75C9E7A3796420/image-dimensions/207x133?v=v2" width="207" height="133" role="button" title="Untitled.jpg" alt="Untitled.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 08:33:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8854828#M87446</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-17T08:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp automatic dimension</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8855943#M87447</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp; hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you tell us more what we see here?&lt;/P&gt;&lt;P&gt;is this a manual drawing or do you have some automation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 17:34:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8855943#M87447</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2019-06-17T17:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp automatic dimension</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8855944#M87448</link>
      <description>&lt;P&gt;Welcome to these Forums!&lt;/P&gt;
&lt;P&gt;I guess you came here to get help on how to code your own programs. Is it that right?&lt;/P&gt;
&lt;P&gt;The following code supposed&amp;nbsp;to show you what's possible. &amp;nbsp;Consider that as a welcome gift because I feel like generous today. Don't hesitate to ask if you have any question about the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)

(defun c:DimToPolyline ( / i p1 p2 px ints obj pl pts ss tmp used pair)
  
  (if (and (setq ss (ssget '((0 . "LINE"))))
           (setq pl (car (entsel "\nSelect polyline: ")))
           (or (= "LWPOLYLINE" (cdr (assoc 0 (entget pl))))
               (prompt "\nError: Selected object is not a polyline!"))
           (setq obj (vlax-ename-&amp;gt;vla-object pl))
           (setq pts (mapcar '(lambda (x) (list (cdr (assoc 10 x))
                                                (cdr (assoc 11 x))))
                             (mapcar 'entget (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))))
           )
    (foreach pair pts
      (foreach i '(0 1)
        (and (setq p1 (nth i pair)
                   p2 (nth (- 1 i) pair))
             (setq tmp (entmakex (list '(0 . "LINE") (cons 10 p1) (cons 11 (polar p1 (+ (angle p1 p2) (/ pi 2)) 1.)))))
             (setq ints (LM:intersections obj (vlax-ename-&amp;gt;vla-object tmp) acextendotherentity))
             (setq ints (vl-sort ints (function (lambda (e1 e2)
                                                  (&amp;lt; (distance e1 p1)
                                                     (distance e2 p1))))))
             (setq px (car ints))
             (or (and (LM:UniqueFuzz-p (cons (append p1 px) used) 0.01)
                      (setq used (cons (append p1 px) used))
                      (vl-cmdf "_.dimaligned" "_non" p1 "_non" (car ints) "_non" "@")
                      )
                 T)
             (entdel tmp)))))
  (princ)
  )



;; Intersections  -  Lee Mac
;; Returns a list of all points of intersection between two objects
;; for the given intersection mode.
;; ob1,ob2 - [vla] VLA-Objects
;;     mod - [int] acextendoption enum of intersectwith method

(defun LM:intersections ( ob1 ob2 mod / lst rtn )
  (if (and (vlax-method-applicable-p ob1 'intersectwith)
           (vlax-method-applicable-p ob2 'intersectwith)
           (setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
           )
    (repeat (/ (length lst) 3)
      (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
            lst (cdddr lst)
            )
      )
    )
  (reverse rtn)
  )

;; Unique-p with Fuzz  -  Lee Mac
;; Returns T if a list contains items considered distinct to
;; a given tolerance

(defun LM:UniqueFuzz-p ( l f )
  (or (null l)
      (and (not (vl-some (function (lambda ( x ) (equal x (car l) f))) (cdr l)))
           (LM:UniqueFuzz-p (cdr l) f)
           )
      )
  )&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Jun 2019 17:34:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8855944#M87448</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-06-17T17:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp automatic dimension</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8856745#M87449</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747"&gt;@Moshe-A&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, we are developing to automate some continuous repetition work to reduce working time, as well as automate manipulation.&lt;/P&gt;&lt;P&gt;First I draw a Pline, use "test" lisp to create the cells and use "Break" lisp to break the line, then select a red line representing Dim to the blue line.&lt;/P&gt;&lt;P&gt;I did it automatically by lisp (lisp attach)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 01:55:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8856745#M87449</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-18T01:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp automatic dimension</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8856760#M87450</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm programming code about HTML, SQL. I have no experience with CAD code and CAD commands, I have reviewed the documents in the past 1 month but have no results.&amp;nbsp;I think it is a series of automated CAD commands that are executed. But I still can't find it.&lt;BR /&gt;Thank for your gift.&amp;nbsp;This is amazing.&lt;/P&gt;&lt;P&gt;I made drawings with attached lisp.&lt;/P&gt;&lt;P&gt;Regarding your code, I applied it to the drawing, the top part was amazing (image 1), the horizontal part was incorrect (image 2), it was 49&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Picture 1" style="width: 407px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/648158i814270744E3FAA9B/image-dimensions/407x321?v=v2" width="407" height="321" role="button" title="Images1.jpg" alt="Picture 1" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Picture 1&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-right" image-alt="Picture 2" style="width: 376px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/648157i9CBD3CB4F32112D4/image-dimensions/376x363?v=v2" width="376" height="363" role="button" title="Images2.jpg" alt="Picture 2" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Picture 2&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 02:21:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8856760#M87450</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-18T02:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp automatic dimension</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8867538#M87451</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pls help me again&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2019 03:11:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/8867538#M87451</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-24T03:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp automatic dimension</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/14245400#M172473</link>
      <description>&lt;P&gt;Whats the command text in autocad what i have to write that i can work this lisp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2026 07:28:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-dimension/m-p/14245400#M172473</guid>
      <dc:creator>gzeynepberfin</dc:creator>
      <dc:date>2026-08-26T07:28:20Z</dc:date>
    </item>
  </channel>
</rss>

