<?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 Betreff: LISP - automatic coordinate dimensions for a free closed polyline in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/10225359#M73537</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;&lt;P&gt;It's not perfect, but for now it's enough for me.&amp;nbsp;If someone suggests a better method or optimization, thank you in advance.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hello&lt;BR /&gt;I'm not sure if this will meet your need, but I suggest the following.&lt;BR /&gt;It uses the dimension style and the current layer, so choose them wisely.&lt;BR /&gt;If the result is not convincing (extension line crosses the polyline), undo, reverse the polyline and start over.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:DIMORD_POLY_CONTINUE ( / sel ent lo_pt l_pt minpt maxpt off_dim l_cr lst q_pt n count EDGE0 EDGE1 EDGE2 EDGE3)
	(princ "\nSelect a LWPOLYLINE : ")
	(while (not (setq sel (ssget "_+.:E:S" '((0 . "LWPOLYLINE") (-4 . "&amp;amp;") (70 . 1))))))
	(setq
		ent (ssname sel 0)
		lo_pt (mapcar 'cdr (vl-remove-if '(lambda (x) (/= (car x) 10)) (entget ent)))
		l_pt (mapcar '(lambda (z) (trans z 0 1)) lo_pt)
		minpt (list (eval (append '(min) (mapcar 'car l_pt))) (eval (append '(min) (mapcar 'cadr l_pt))))
		maxpt (list (eval (append '(max) (mapcar 'car l_pt))) (eval (append '(max) (mapcar 'cadr l_pt))))
	)
	(initget 7)
	(setq off_dim (getdist (car l_pt) "\nOffset for dimension: "))
	(setvar "CMDECHO" 0)
	(command "_.UNDO" "_begin")
	(command "_.UCS" "_3p" "_none" minpt "_none" (list (car maxpt) (cadr minpt)) "_none" (list (car minpt) (cadr maxpt)))
	(setq
		l_pt (mapcar '(lambda (z) (trans z 0 1)) lo_pt)
		minpt (list (eval (append '(min) (mapcar 'car l_pt))) (eval (append '(min) (mapcar 'cadr l_pt))))
		maxpt (list (eval (append '(max) (mapcar 'car l_pt))) (eval (append '(max) (mapcar 'cadr l_pt))))
		l_cr
		(list
			(list (car minpt) (cadr minpt))
			(list (car maxpt) (cadr minpt))
			(list (car maxpt) (cadr maxpt))
			(list (car minpt) (cadr maxpt))
		)
	)
	(foreach e l_cr (setq q_pt (cons (vl-position (apply 'min (setq lst (mapcar '(lambda (x) (distance e x)) l_pt))) lst) q_pt)))
	(setq q_pt (append q_pt (list (car q_pt))) n 0)
	(repeat 4
		(setq count 0)
		(repeat (1+ (- (if (&amp;gt; (car q_pt) (cadr q_pt)) (+ (length lst) (cadr q_pt)) (cadr q_pt)) (car q_pt)))
			(set (read (strcat "EDGE" (itoa n))) (cons (nth (rem (+ (car q_pt) count) (length lst)) l_pt) (eval (read (strcat "EDGE" (itoa n))))))
			(setq count (1+ count))
		)
		(set (read (strcat "EDGE" (itoa n))) (vl-sort (eval (read (strcat "EDGE" (itoa n)))) '(lambda (e1 e2) (if (zerop (rem n 2)) (&amp;lt; (car e1) (car e2)) (&amp;lt; (cadr e1) (cadr e2))))))
		(set (read (strcat "EDGE" (itoa n)))
			(if (or (eq n 0) (eq n 3))
				(append (list (nth n l_cr)) (eval (read (strcat "EDGE" (itoa n)))) (list (nth (rem (1+ n) 4) l_cr)))
				(append (list (nth (rem (1+ n) 4) l_cr)) (eval (read (strcat "EDGE" (itoa n)))) (list (nth n l_cr)))
			)
		)
		(setq n (1+ n) q_pt (cdr q_pt))
	)
	(setq n 0)
	(repeat 4
		(while (eval (read (strcat "EDGE" (itoa n))))
			(command "_.DIMORDINATE" "_none" (car (eval (read (strcat "EDGE" (itoa n))))))
			(if (zerop (rem n 2))
				(command "_X" "_none" (list (caar (eval (read (strcat "EDGE" (itoa n))))) (if (zerop n) (+ (cadr maxpt) off_dim) (- (cadr minpt) off_dim))))
				(command "_Y" "_none" (list (if (eq n 1) (+ (car maxpt) off_dim) (- (car minpt) off_dim)) (cadar (eval (read (strcat "EDGE" (itoa n)))))))
			)
			(set (read (strcat "EDGE" (itoa n))) (cdr (eval (read (strcat "EDGE" (itoa n))))))
		)
		(setq n (1+ n) l_cr (cdr l_cr))
	)
	(command "_.UCS" "_previous")
	(command "_.UNDO" "_end")
	(setvar "CMDECHO" 1)
	(prin1)
)&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 09 Apr 2021 15:29:15 GMT</pubDate>
    <dc:creator>CADaSchtroumpf</dc:creator>
    <dc:date>2021-04-09T15:29:15Z</dc:date>
    <item>
      <title>LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572078#M73512</link>
      <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm workin on Autocad Mechanical 2018 and I am looking for a LISP for automatic &lt;U&gt;&lt;STRONG&gt;coordinate dimensioning for a free closed polyline&lt;/STRONG&gt;&lt;/U&gt;.&amp;nbsp;I found many LISPs and tested them all, unfortunately they either only work for orthogonal objects (base plate) or they only have linear dimensions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The coordinate dimensions should look like this:&lt;/P&gt;&lt;P&gt;- UCS set to world&lt;/P&gt;&lt;P&gt;- with specific dimension style "AM_ISO_35mm"&lt;/P&gt;&lt;P&gt;- at each vertex of the polyline&lt;BR /&gt;- scale by scaling area (AMSCAREA) in which you are currently dimensioning&lt;/P&gt;&lt;P&gt;- zero points (starting points) - see example&lt;/P&gt;&lt;P&gt;-&amp;nbsp;the polyline must remain a polyline,&amp;nbsp;because it is important for further use&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The double coordinate dimensions (e.g. right / left and top / bottom) will be removed later manually (via power-delete)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sketch.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/782158iFC643AE7523E5D16/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sketch.png" alt="Sketch.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance for your support&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 14:25:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572078#M73512</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-10T14:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572124#M73513</link>
      <description>&lt;P&gt;No dwg, no help.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 14:39:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572124#M73513</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2020-06-10T14:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572173#M73514</link>
      <description>&lt;P&gt;here one example&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 14:57:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572173#M73514</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-10T14:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572209#M73515</link>
      <description>&lt;P&gt;Those arrows are made automatically too? (don't have AM)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because I thought that those are made by dim style...&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 15:26:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572209#M73515</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2020-06-10T15:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572253#M73516</link>
      <description>&lt;P&gt;yes, automatically according to my (privat) dim style in Mechanical&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 15:18:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572253#M73516</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-10T15:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572294#M73517</link>
      <description>&lt;P&gt;Great. Then I'm lost at this point.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider posting this into the AM forums.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 15:34:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572294#M73517</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2020-06-10T15:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572395#M73518</link>
      <description>&lt;P&gt;Some three months ago I have created a script to automatically delete overlapping dimensions . Actually&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp; has helped me at one point. I'll try to use some parts of that script to create dims the way you like. At the moment I'm half a way done,&amp;nbsp; so I won't post anything until I have something to show.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 16:12:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572395#M73518</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2020-06-10T16:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572411#M73519</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5530556"&gt;@hak_vz&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;many thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 16:16:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572411#M73519</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-10T16:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572786#M73520</link>
      <description>&lt;P&gt;Here is first part of the code, just to show my idea. It creates bounding box around dimensioning object, and creates perpendicular lines from polyline vertexes to four segments. It removes all lines that intersect with object. I will tomorrow update code to create dimensions over those lines and to remove them from a drawing. Option is not to delete intersecting lines and then you can erase them with your code.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 19:45:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9572786#M73520</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2020-06-10T19:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9573233#M73521</link>
      <description>&lt;P&gt;My idea pick&lt;/P&gt;&lt;P&gt;pline get co-ords straight forward.&lt;/P&gt;&lt;P&gt;make 2 list X &amp;amp; Y then sort&lt;/P&gt;&lt;P&gt;Get min point x and y this is bottom left&amp;nbsp;&lt;/P&gt;&lt;P&gt;Draw Vertical lines x + foreach Y, length&lt;/P&gt;&lt;P&gt;Draw Horizontal lines Y + foreach x, length&lt;/P&gt;&lt;P&gt;Draw hor text&lt;/P&gt;&lt;P&gt;Draw ver text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Take mid point of X &amp;amp; Y do left right up down no need to clean up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Time for a coffee !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; pline co-ords example
(defun getcoords (ent)
  (vlax-safearray-&amp;gt;list
    (vlax-variant-value
      (vlax-get-property
    (vlax-ename-&amp;gt;vla-object ent)
    "Coordinates"
      )
    )
  )
)

(setq co-ords (getcoords (car (entsel "\nPlease pick pline"))))
(co-ords2xy)
(princ co-ords)&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;(setq plent (entsel "\nPick rectang"))
(if plent (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent))))))&lt;/LI-CODE&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>Thu, 11 Jun 2020 01:25:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9573233#M73521</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2020-06-11T01:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9574037#M73522</link>
      <description>&lt;P&gt;Try this. I have tried to do something else,&amp;nbsp; but then used method you use&amp;nbsp; in your sample.&lt;/P&gt;&lt;P&gt;At the end erase bounding box lines, match dim style properties rotate text and remove duplicates.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:43:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9574037#M73522</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2020-06-11T11:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9574215#M73523</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5530556"&gt;@hak_vz&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just tested it, unfortunately the command is interrupted relatively shortly after the start, bevore the bounding box is completed. The&amp;nbsp;box will not close automatically,&amp;nbsp;the drop-down menu will be displayed only.&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="1_selecting polyline.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/782562i9572AB11586A4614/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1_selecting polyline.png" alt="1_selecting polyline.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2_set dimensions offset.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/782563i316DD68F25C1ACCC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2_set dimensions offset.png" alt="2_set dimensions offset.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3_error after dimensions offset.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/782564iF41733C2DB8D8517/image-size/medium?v=v2&amp;amp;px=400" role="button" title="3_error after dimensions offset.png" alt="3_error after dimensions offset.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 12:52:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9574215#M73523</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-11T12:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9574271#M73524</link>
      <description>&lt;P&gt;Here is the latest version and I guess it will work ok.&lt;/P&gt;&lt;P&gt;In case of error please skim through code and check if all switches are ok wherever you see (command .....), since you're using German version.&lt;/P&gt;&lt;P&gt;Error you describe arises since switch "c" don't work in German version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can not replicate this error in English version.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 13:17:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9574271#M73524</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2020-06-11T13:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9576987#M73525</link>
      <description>&lt;P&gt;Here is my finalized code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:autodim ()
(defun pointlist2d (lst / ret)(while lst (setq ret (cons (list (car lst)(cadr lst)) ret) lst (cddr lst))) (reverse ret))

(defun LM:boundingbox ( obj / a b lst )
    (if
        (and
            (vlax-method-applicable-p obj 'getboundingbox)
            (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'a 'b))))
            (setq lst (mapcar 'vlax-safearray-&amp;gt;list (list a b)))
        )
        (mapcar '(lambda ( a ) (mapcar '(lambda ( b ) ((eval b) lst)) a))
           '(
                (caar   cadar)
                (caadr  cadar)
                (caadr cadadr)
                (caar  cadadr)
            )
        )
    )
)
(defun perperdicular_from_point_to_line (lin1 lin2 p / x1 y1 x2 y2 x3 y3 k m n ret)
;returns point on a line (line1 line2) as a perpendicular projection from point p
	(mapcar 'set '(x1 x2 x3) (mapcar 'car (list lin1 lin2 p)))
	(mapcar 'set '(y1 y2 y3) (mapcar 'cadr (list lin1 lin2 p)))
	(setq 
		m (-(*(- y2 y1) (- x3 x1))(*(- x2 x1) (- y3 y1)))
		n (+(* (- y2 y1)(- y2 y1))(*(- x2 x1)(- x2 x1)))
	)
	(cond 
		((/= n 0.0) 
			(setq 
				k (/ m n)
				ret (list(- x3 (* k(- y2 y1)))(+ y3 (* k(- x2 x1))))
			)
		)
	)
	ret
)
(defun getintersections	(obj1 obj2 / var)
     ; from RonJonP
     (setq var (vlax-variant-value (vla-intersectwith obj1 obj2 2)))
     (if (&amp;lt; 0 (vlax-safearray-get-u-bound var 1))
	  (vlax-safearray-&amp;gt;list var)
     ) ;_ end of if
) ;_ end of defun

(defun init ( / e ent off plobj pts bbox p1 p2 p3 p4 k1 k2 k3 k4 uc_list po a b c i segs uc te to int)
    (setq e (car(entsel "\nSelect polyline to autodim &amp;gt;")))
    (if (not (setq off (getreal "\nDimensions offset from object &amp;lt;20&amp;gt;"))) (setq off 20))
    (cond 
        ((and e)
            (setq plobj (vlax-ename-&amp;gt;vla-object e))
            (setq pts (pointlist2d(vlax-get plobj 'Coordinates)))
            (setq bbox (LM:boundingbox plobj))
            (command "_.pline" "_non" (car bbox) "_non"  (cadr bbox) "_non"  (caddr bbox) "_non"  (cadddr bbox) "c")
            (setq p1 (car bbox) p2 (cadr bbox) p3(cadddr bbox) p4 p1)
            (setq k1 (cadr bbox) k2 (caddr bbox) k3 (caddr bbox) k4 (cadddr bbox))
            (setq uc_list (list (list p1 k1)(list p2 k2)(list p3 k3)(list p4 k4)))
            (setq po (entlast))
            (setq a (car bbox) b (mapcar '+ (car bbox) (list 0 (* -1 off))) c (distance a b))
            (command "_.offset" "_non" c (entlast) "_non" a "_non" b "")
            (setq e (entlast))
            (setq bo (vlax-ename-&amp;gt;vla-object e))
            (setq bbox (LM:boundingbox  bo))
            (entdel po)
            (setq i 0 segs (list))
            (while (&amp;lt; i 3)
                (setq a (nth i bbox) b (nth (+ i 1) bbox))
                (if (&amp;gt; (car a) (car b)) (setq c a a b b c))
                (setq segs (append segs (list(list a b))))
                (setq i (+ i 1))
            )
            (setq segs (append segs (list(list (car bbox)(last bbox)))))
            (entdel e)
            (setq i 0)
            (foreach seg segs
                (setq uc (nth i uc_list))
                (command "_.ucs" "w")
                (command "_.ucs" "_3p" (car uc)(cadr uc) "")
                (command "_.line" "_non" (trans (car seg) 0 1) "_non" (trans(cadr seg)0 1) "")
                (setq te (entlast))
                (foreach pt pts
                    (setq proj (perperdicular_from_point_to_line (trans(car seg)0 1) (trans(cadr seg)0 1) (trans pt 0 1)))
                    (command "_.line" "_non" (trans pt 0 1) "_non" proj "")
                    (setq to (vlax-ename-&amp;gt;vla-object (entlast)))
                    (setq int (getintersections to plobj))
                    (entdel (entlast))
                    (command "_.dimordinate" "_non" (trans pt 0 1) "_non" proj)
                    (if (or (= i 1) (= i 3))
                        (progn
                            (setq ent (entget(entlast)))
                            (setq ent (subst (cons 53 4.71238898)(assoc 53 ent)  ent))
                            (entmod ent)
                        
                        )
                    )
                )
                (setq i (+ i 1))
                (entdel te)
            )
      
        )
    )
)
(setvar 'cmdecho 0)
(vla-endundomark (vla-get-ActiveDocument (vlax-get-acad-object)))
(vla-startundomark (vla-get-ActiveDocument (vlax-get-acad-object)))
(init)
(command "ucs" "w")
(vla-endundomark (vla-get-ActiveDocument (vlax-get-acad-object)))
(setvar 'cmdecho 1)
(princ)
)
(princ "\n Type Autodim to dimension an polyline ")
(princ)&lt;/LI-CODE&gt;&lt;P&gt;If you find this usable, select this as final solution.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 17:15:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9576987#M73525</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2020-06-12T17:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9577272#M73526</link>
      <description>&lt;P&gt;I knew this would be possible... nice, easy and quick! Just using built-in QDIM command.&lt;/P&gt;
&lt;P&gt;See&amp;nbsp;&lt;A href="https://autode.sk/2YpYag6" target="_blank" rel="noopener"&gt;HERE&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="gtx-trans" style="position: absolute; left: 65px; top: 31.8px;"&gt;
&lt;DIV class="gtx-trans-icon"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 12 Jun 2020 19:54:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9577272#M73526</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2020-06-12T19:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9580479#M73527</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5530556"&gt;@hak_vz&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="tlid-input input"&gt;&lt;DIV class="source-wrap"&gt;&lt;DIV class="input-full-height-wrapper tlid-input-full-height-wrapper"&gt;&lt;DIV class="source-input"&gt;&lt;DIV class="source-footer-wrap source-or-target-footer"&gt;&lt;DIV class="character-count tlid-character-count"&gt;&lt;DIV class="cc-ctr normal"&gt;&lt;SPAN style="font-family: inherit;"&gt;I'm back after a short vacation. T&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;hat's great, what you have created. You are a magician &lt;/SPAN&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;SPAN style="font-family: inherit;"&gt;.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These things have occurred during testig:&amp;nbsp;&lt;/P&gt;&lt;P&gt;- UCS&amp;nbsp;has turned 90 ° counterclockwise (X is vertical, Y is negativ horizontally),&amp;nbsp;then the vertical dimensions "on the head"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AutoDimTest.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/783781i5E28E305B5F05D67/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AutoDimTest.png" alt="AutoDimTest.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;-&amp;nbsp;how can you set a specific user dimension style (e.g. "AM_ISO_Plate" or similar)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- i work in scalling areas (M1:15 for assembly, M1:5 for details), where the dim style takes over the scale from the scaling area. How can you set a temporare global dim factor M1:5 (for the details) in the scaling area? Now it use a global dim scale factor.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Many thanks for your help in advance, your LISP will save a lot of sleepless nights&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(and i can learn something new about it)&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 15:37:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9580479#M73527</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-15T15:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9580493#M73528</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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i know QDIM very good - was my tool until now, but this is not suitable for a work with 50+ details :-).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to the community, we can protect our eyes&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 15:42:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9580493#M73528</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-15T15:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9580718#M73529</link>
      <description>&lt;P&gt;My code works as follow:&lt;/P&gt;&lt;P&gt;1) It creates a bounding box around dim object&lt;/P&gt;&lt;P&gt;2) It moves in cc direction and creates ordinate dims&lt;/P&gt;&lt;P&gt;All the time it works in direction of bounding box side and takes her as a x direction&lt;/P&gt;&lt;P&gt;so for horizontal ordinate dim lines it rotates text for 270 deg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should not change usc direction, and actually in each iteration **** first changes ucs to world&lt;/P&gt;&lt;P&gt;Before you use the code use command DIMSIZE to set scaling&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In acad 2014 it all works ok&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 17:16:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9580718#M73529</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2020-06-15T17:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9580833#M73530</link>
      <description>&lt;P&gt;I tested it in AutoCAD Mechanical 2018, without good result (see DWG example in my previous post).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use QDIM for ordinate dimension and compare it with AUTODIM possibilities, the properties of both dimension methodes are difficult, &lt;STRONG&gt;especially for vertical dimension&lt;/STRONG&gt; (by "_list" command):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Properties&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QDIM&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AUTODIM&lt;/U&gt;&lt;/P&gt;&lt;P&gt;associative&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;yes&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;no&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;type&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y axis&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;X axis&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;All the vertical dimensions have wrong type (should be Y axis)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to understand why it is so and what can I do differently. But no idea.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 18:13:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9580833#M73530</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-15T18:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - automatic coordinate dimensions for a free closed polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9581612#M73531</link>
      <description>&lt;P&gt;I'll have to change my algorithm.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2020 05:29:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-automatic-coordinate-dimensions-for-a-free-closed-polyline/m-p/9581612#M73531</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2020-06-16T05:29:50Z</dc:date>
    </item>
  </channel>
</rss>

