<?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>tema Re: Bearing and Distance Lisp - Text Layers en AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/bearing-and-distance-lisp-text-layers/m-p/8845860#M982742</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747" target="_self"&gt;Moshe-A.&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;That worked really well. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I've added the CHGD function that I'd missed on the previous post. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;For the oblique text I meant 20d (sloping to the right) not 70d!&amp;nbsp;I made the change to lisp and it's working as I hoped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I really appreciate you taking the time to help me with this. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Thanks &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@38DF24EF580240D512020314976B5FC8/emoticons/1f642.png" alt=":cara_con_una_leve_sonrisa:" title=":cara_con_una_leve_sonrisa:" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Ross&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Below is the working lisp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;(defun CHGD(os / ns sl ct lt)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq ns "" sl (strlen os) ct 1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "osnap" "none")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(while (&amp;lt;= ct sl)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq lt (substr os ct 1))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(if (= lt "d")(setq lt "%%d"))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq ct (1+ ct) ns (strcat ns lt)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(defun create_layer (name clr)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(if (null (tblsearch "layer" name))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "layer" "new" name "color" clr name "")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;); change layer&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;(DEFUN C:OO ()&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setvar "cmdecho" 0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "undo" "begin")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ L 0 MID 0 MID 0 AN 0 BRG 0 DIST 0 A 0 B 0 C 0 D 0 MA 0 MB 0 MC 0 MD 0 MID 0 Z 0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(PROMPT "\nSelect lines to be annotated..")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq ss1 (ssget)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;n (sslength ss1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;index 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;dim (getvar "DIMSCALE")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ht (* dim 1.8)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(while (&amp;gt; n index)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq l (ssname ss1 index)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;index (+ index 1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;OFFSET (* 0.6 ht)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;L (ENTGET L)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ST (CDR (ASSOC 10 L))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;END (CDR (ASSOC 11 L))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;AN (ANGLE ST END)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;BRG (CHGD (ANGTOS AN 1 4))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;AN (* AN (/ 180 PI))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;dAND AN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;dAND (- dAND 90)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;dAND (- 360 dAND)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;); setq&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;gt; dAND 360)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ dAND (- dAND 360))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;gt;= dAND 180)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ dAND (+ dAND 180))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (= dAND 540)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ dAND 0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ DIST (RTOS (DISTANCE ST END) 2 3)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;A (CAR ST)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;B (CDR ST)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;B (CAR B)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;C (CAR END)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;D (CDR END)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;D (CAR D)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MA (+ A C)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MB (+ B D)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MC (/ MA 2)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MD (/ MB 2)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ANR (* (* (/ AN 360) 2) PI)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MID (LIST MC MD)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;); setq&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;gt; dAND 180)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ MID1 (POLAR MID (- ANR (* 0.5 PI)) OFFSET))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;gt; dAND 180)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ MID2 (POLAR MID (+ ANR (* 0.5 PI)) (+ OFFSET HT)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;lt;= dAND 180)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ MID1 (POLAR MID (+ ANR (* 0.5 PI)) OFFSET))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;lt;= dAND 180)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ MID2 (POLAR MID (- ANR (* 0.5 PI)) (+ OFFSET HT)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ Z (+ Z 1))&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (= Z 1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(COMMAND "STYLE" "rjc" "rjc" HT "1.00" "" "" "" "")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(COMMAND "TEXT" "C" MID1 dAND BRG)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(create_layer "bearing" 7) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "chprop" "si" "last" "layer" "bearing" "")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(COMMAND "TEXT" "C" MID2 dAND DIST)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq elist (entget (entlast)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(entmod (subst (cons '51 (/ pi 9)) (assoc '51 elist) elist))&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(create_layer "distance" 1) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "chprop" "si" "last" "layer" "distance" "")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;); while&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "undo" "end")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setvar "cmdecho" 1)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(princ) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;); c:oo&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2019 22:15:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-06-11T22:15:58Z</dc:date>
    <item>
      <title>Bearing and Distance Lisp - Text Layers</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/bearing-and-distance-lisp-text-layers/m-p/8843451#M982589</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a lisp which works well for adding bearings and distances to lines. However I'm looking to make a few changes to the text and hoping someone can help me out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;(DEFUN C:OO()&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(setvar "cmdecho" 0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(SETQ L 0 MID 0 MID 0 AN 0 BRG 0 DIST 0 A 0 B 0 C 0 D 0 MA 0 MB 0 MC 0 MD 0 MID 0 Z 0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(PROMPT "\nSelect lines to be annotated..")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(setq ss1 (ssget)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;n (sslength ss1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;index 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;dim (getvar "DIMSCALE")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;ht (* dim 1.8)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(while (&amp;gt; n index)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(setq l (ssname ss1 index)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;index (+ index 1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;OFFSET (* 0.6 ht)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;L (ENTGET L)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;ST (CDR (ASSOC 10 L))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;END (CDR (ASSOC 11 L))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;AN (ANGLE ST END)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;BRG (CHGD(ANGTOS AN 1 4))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;AN (* AN (/ 180 PI))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;dAND AN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;dAND (- dAND 90)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;dAND (- 360 dAND))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(IF (&amp;gt; dAND 360)(SETQ dAND (- dAND 360)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(IF (&amp;gt;= dAND 180)(SETQ dAND (+ dAND 180))) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(IF (= dAND 540)(SETQ dAND 0))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(SETQ DIST (RTOS (DISTANCE ST END) 2 3)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;A (CAR ST)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;B (CDR ST)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;B (CAR B)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;C (CAR END)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;D (CDR END)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;D (CAR D)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;MA (+ A C)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;MB (+ B D)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;MC (/ MA 2)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;MD (/ MB 2)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;ANR (* (* (/ AN 360) 2) PI)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;MID (LIST MC MD))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(IF (&amp;gt; dAND 180)(SETQ MID1 (POLAR MID (- ANR (* 0.5 PI)) OFFSET)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(IF (&amp;gt; dAND 180)(SETQ MID2 (POLAR MID (+ ANR (* 0.5 PI)) (+ OFFSET HT))))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(IF (&amp;lt;= dAND 180)(SETQ MID1 (POLAR MID (+ ANR (* 0.5 PI)) OFFSET)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(IF (&amp;lt;= dAND 180)(SETQ MID2 (POLAR MID (- ANR (* 0.5 PI)) (+ OFFSET HT))))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(SETQ Z (+ Z 1))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(IF (= Z 1)(COMMAND "STYLE" "rjc" "rjc" HT "1.00" "" "" "" ""))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(COMMAND "TEXT" "C" MID1 dAND BRG)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;(COMMAND "TEXT" "C" MID2 dAND DIST)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;(command "osnap" "end")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm happy the text style, height and offset to line.&lt;/P&gt;&lt;P&gt;But I'd like the distance to be..&lt;/P&gt;&lt;P&gt;On Layer - DISTANCE&lt;/P&gt;&lt;P&gt;Color - RED&lt;/P&gt;&lt;P&gt;Oblique - 70d&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and for the bearing..&lt;/P&gt;&lt;P&gt;On Layer - BEARING&lt;/P&gt;&lt;P&gt;Color - WHITE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Ross&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 00:00:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/bearing-and-distance-lisp-text-layers/m-p/8843451#M982589</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-11T00:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Bearing and Distance Lisp - Text Layers</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/bearing-and-distance-lisp-text-layers/m-p/8843692#M982598</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp; hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is my fix, untested cause you did not send all the code.&amp;nbsp;there is a (CHGD) function missing.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;about &lt;FONT color="#0000FF"&gt;Oblique - 70d?&amp;nbsp; &lt;FONT color="#333300"&gt;you meant only 15d - yes?!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;enjoy&lt;/P&gt;&lt;P&gt;moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun create_layer (name clr)
 (if (null (tblsearch "layer" name))
  (command "layer" "new" name "color" clr name "")
 )
); change layer

(DEFUN C:OO ()
 (setvar "cmdecho" 0)
 (command "undo" "begin")
  
 (SETQ L 0 MID 0 MID 0 AN 0 BRG 0 DIST 0 A 0 B 0 C 0 D 0 MA 0 MB 0 MC 0 MD 0 MID 0 Z 0)
 (PROMPT "\nSelect lines to be annotated..")
 (setq ss1 (ssget)
       n (sslength ss1)
       index 0
       dim (getvar "DIMSCALE")
       ht (* dim 1.8)
 )
  
 (while (&amp;gt; n index)
  (setq l (ssname ss1 index)
        index (+ index 1)
        OFFSET (* 0.6 ht)
        L (ENTGET L)
        ST (CDR (ASSOC 10 L))
        END (CDR (ASSOC 11 L))
        AN (ANGLE ST END)
        BRG (CHGD (ANGTOS AN 1 4))
        AN (* AN (/ 180 PI))
        dAND AN
        dAND (- dAND 90)
        dAND (- 360 dAND)
  ); setq
   
  (IF (&amp;gt; dAND 360)
   (SETQ dAND (- dAND 360))
  )
  (IF (&amp;gt;= dAND 180)
   (SETQ dAND (+ dAND 180))
  ) 
  (IF (= dAND 540)
   (SETQ dAND 0)
  )
   
  (SETQ DIST (RTOS (DISTANCE ST END) 2 3)
        A (CAR ST)
        B (CDR ST)
        B (CAR B)
        C (CAR END)
        D (CDR END)
        D (CAR D)
        MA (+ A C)
        MB (+ B D)
        MC (/ MA 2)
        MD (/ MB 2)
        ANR (* (* (/ AN 360) 2) PI)
        MID (LIST MC MD)
  ); setq
   
  (IF (&amp;gt; dAND 180)
   (SETQ MID1 (POLAR MID (- ANR (* 0.5 PI)) OFFSET))
  )
  (IF (&amp;gt; dAND 180)
   (SETQ MID2 (POLAR MID (+ ANR (* 0.5 PI)) (+ OFFSET HT)))
  )
  (IF (&amp;lt;= dAND 180)
   (SETQ MID1 (POLAR MID (+ ANR (* 0.5 PI)) OFFSET))
  )
  (IF (&amp;lt;= dAND 180)
   (SETQ MID2 (POLAR MID (- ANR (* 0.5 PI)) (+ OFFSET HT)))
  )
  (SETQ Z (+ Z 1))
   
  (IF (= Z 1)
   (COMMAND "STYLE" "rjc" "rjc" HT "1.00" "" "" "" "")
  )
   
  (COMMAND "TEXT" "C" MID1 dAND BRG)
  (create_layer "bearing" 7) 
  (command "chprop" "si" "last" "layer" "bearing" "")
  
  (COMMAND "TEXT" "C" MID2 dAND DIST)
  (setq elist (entget (entlast)))
  (entmod (subst (cons '51 (/ pi -12)) (assoc '51 elist) elist))
   
  (create_layer "distance" 1) 
  (command "chprop" "si" "last" "layer" "distance" "")
 ); while
  
 (command "undo" "end")
 (setvar "cmdecho" 1)
  
 (princ) 
); c:oo

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 05:28:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/bearing-and-distance-lisp-text-layers/m-p/8843692#M982598</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2019-06-11T05:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Bearing and Distance Lisp - Text Layers</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/bearing-and-distance-lisp-text-layers/m-p/8845860#M982742</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747" target="_self"&gt;Moshe-A.&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;That worked really well. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I've added the CHGD function that I'd missed on the previous post. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;For the oblique text I meant 20d (sloping to the right) not 70d!&amp;nbsp;I made the change to lisp and it's working as I hoped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I really appreciate you taking the time to help me with this. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Thanks &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@38DF24EF580240D512020314976B5FC8/emoticons/1f642.png" alt=":cara_con_una_leve_sonrisa:" title=":cara_con_una_leve_sonrisa:" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Ross&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Below is the working lisp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;(defun CHGD(os / ns sl ct lt)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq ns "" sl (strlen os) ct 1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "osnap" "none")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(while (&amp;lt;= ct sl)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq lt (substr os ct 1))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(if (= lt "d")(setq lt "%%d"))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq ct (1+ ct) ns (strcat ns lt)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(defun create_layer (name clr)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(if (null (tblsearch "layer" name))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "layer" "new" name "color" clr name "")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;); change layer&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;(DEFUN C:OO ()&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setvar "cmdecho" 0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "undo" "begin")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ L 0 MID 0 MID 0 AN 0 BRG 0 DIST 0 A 0 B 0 C 0 D 0 MA 0 MB 0 MC 0 MD 0 MID 0 Z 0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(PROMPT "\nSelect lines to be annotated..")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq ss1 (ssget)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;n (sslength ss1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;index 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;dim (getvar "DIMSCALE")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ht (* dim 1.8)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(while (&amp;gt; n index)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq l (ssname ss1 index)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;index (+ index 1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;OFFSET (* 0.6 ht)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;L (ENTGET L)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ST (CDR (ASSOC 10 L))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;END (CDR (ASSOC 11 L))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;AN (ANGLE ST END)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;BRG (CHGD (ANGTOS AN 1 4))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;AN (* AN (/ 180 PI))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;dAND AN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;dAND (- dAND 90)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;dAND (- 360 dAND)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;); setq&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;gt; dAND 360)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ dAND (- dAND 360))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;gt;= dAND 180)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ dAND (+ dAND 180))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (= dAND 540)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ dAND 0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ DIST (RTOS (DISTANCE ST END) 2 3)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;A (CAR ST)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;B (CDR ST)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;B (CAR B)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;C (CAR END)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;D (CDR END)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;D (CAR D)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MA (+ A C)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MB (+ B D)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MC (/ MA 2)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MD (/ MB 2)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ANR (* (* (/ AN 360) 2) PI)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MID (LIST MC MD)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;); setq&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;gt; dAND 180)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ MID1 (POLAR MID (- ANR (* 0.5 PI)) OFFSET))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;gt; dAND 180)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ MID2 (POLAR MID (+ ANR (* 0.5 PI)) (+ OFFSET HT)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;lt;= dAND 180)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ MID1 (POLAR MID (+ ANR (* 0.5 PI)) OFFSET))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (&amp;lt;= dAND 180)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ MID2 (POLAR MID (- ANR (* 0.5 PI)) (+ OFFSET HT)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(SETQ Z (+ Z 1))&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(IF (= Z 1)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(COMMAND "STYLE" "rjc" "rjc" HT "1.00" "" "" "" "")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(COMMAND "TEXT" "C" MID1 dAND BRG)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(create_layer "bearing" 7) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "chprop" "si" "last" "layer" "bearing" "")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(COMMAND "TEXT" "C" MID2 dAND DIST)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setq elist (entget (entlast)))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(entmod (subst (cons '51 (/ pi 9)) (assoc '51 elist) elist))&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(create_layer "distance" 1) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "chprop" "si" "last" "layer" "distance" "")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;); while&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(command "undo" "end")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(setvar "cmdecho" 1)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;(princ) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;); c:oo&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 22:15:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/bearing-and-distance-lisp-text-layers/m-p/8845860#M982742</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-11T22:15:58Z</dc:date>
    </item>
  </channel>
</rss>

