<?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: Draw 2 lines and get the angle through Autolisp COMMANDS in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617759#M37118</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13275010"&gt;@theresa_kewley&lt;/a&gt;&amp;nbsp;Please upload your sample DWG .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sad to know ,&amp;nbsp; ACAD , can not handle .png&amp;nbsp; neither image.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Dec 2022 17:59:48 GMT</pubDate>
    <dc:creator>devitg</dc:creator>
    <dc:date>2022-12-13T17:59:48Z</dc:date>
    <item>
      <title>Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617420#M37112</link>
      <description>&lt;P&gt;Hello!&amp;nbsp; I am new to figuring out Autolisp programming.&amp;nbsp; I believe my biggest holdback is understanding what COMMANDS can return or how to access that information using the AUTOLISP.&amp;nbsp; I am attempting to fully automate majority of a program I’m working on.&amp;nbsp; I am stuck getting an angle of two lines drawn.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Set the points&lt;/LI&gt;&lt;LI&gt;Draw line 1&lt;/LI&gt;&lt;LI&gt;Draw line 2&lt;/LI&gt;&lt;LI&gt;Get the angle of line 1 and line2&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="general"&gt;;Get the angle of rotation
(setq point1Tension (list (car mountPoint1) (cadr mountPoint1) (+ (caddr mountPoint1) tension)))
(setq point1Compression (list (car mountPoint1) (cadr mountPoint1) (- (caddr mountPoint1) compression)))
(setq point2Compression (list (car mountPoint2) (cadr mountPoint2) (- (caddr mountPoint1) compression)))

(setq angle1Line1 (COMMAND "line" point1Tension point2Compression ""));Draw and get Line1 (CAN YOU SET LINE COLOR HERE?)
(setq angle1Line2 (COMMAND "line" point1Compression point2Compression ""));Draw and get Line2
(setq angle1 (COMMAND "MEASUREGEOM" "Angle" angle1Line1 angle1Line2 ""));get Angle 1&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Dec 2022 15:36:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617420#M37112</guid>
      <dc:creator>theresa_kewley</dc:creator>
      <dc:date>2022-12-13T15:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617430#M37113</link>
      <description>CAL command an option? In HELP in AutoCAD, look up the topic&lt;BR /&gt;"Obtain an Angle (CAL Command)"</description>
      <pubDate>Tue, 13 Dec 2022 15:41:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617430#M37113</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2022-12-13T15:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617432#M37114</link>
      <description>&lt;P&gt;Lisp has an &lt;A href="https://help.autodesk.com/view/ACD/2023/ENU/?guid=GUID-F28755D4-E89F-43EF-8E76-40518C7E2728" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;ANGLE&lt;/STRONG&gt;&lt;/A&gt; function which returns an angle in radians.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use the function below to return the angle in degrees:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun r2d (r) (* (/ r pi) 180.0))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 15:48:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617432#M37114</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2022-12-13T15:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617460#M37115</link>
      <description>&lt;P&gt;No no no, I would stop you here. Don't use commands. I do not say EVER but definitely not as your first choice. IF you are serious about programming.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(setq point1Tension (list (car mountPoint1) (cadr mountPoint1) (+ (caddr mountPoint1) tension)))
(setq point1Compression (list (car mountPoint1) (cadr mountPoint1) (- (caddr mountPoint1) compression)))
(setq point2Compression (list (car mountPoint2) (cadr mountPoint2) (- (caddr mountPoint1) compression)))


(setq Line1 (entmakex (list (cons 0 "LINE") (cons 10 point1Tension) (cons 11 point2Compression))))
(setq Line1ang (angle point1Tension point2Compression))
(setq Line2 (entmakex (list (cons 0 "LINE") (cons 10 point1Compression) (cons 11 point2Compression))))
(setq Line2ang (angle point1Compression point2Compression))

(setq ang (- Line1ang Line2ang)) ;; radians
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 15:54:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617460#M37115</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2022-12-13T15:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617610#M37116</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;Ok.&amp;nbsp; Good to know!&amp;nbsp; I'll try to use commands less. Might make sense why I can't find much for them when searching, ha, ha.&lt;BR /&gt;&lt;BR /&gt;I'm having troubles understanding how the angle is calculated for angle.&amp;nbsp; Below is in image describing the angle I am trying to get.&amp;nbsp; I currently am getting angles to be 90 degrees.&amp;nbsp; I am assuming that I will need to change the UCS in order to get the correct angles from the points?&amp;nbsp; I am trying to understand how the angle is calculated to the x-axis.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AutoCad Question.png" style="width: 758px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1152076i3A0C1FFE432F1635/image-dimensions/758x316?v=v2" width="758" height="316" role="button" title="AutoCad Question.png" alt="AutoCad Question.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 16:47:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617610#M37116</guid>
      <dc:creator>theresa_kewley</dc:creator>
      <dc:date>2022-12-13T16:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617655#M37117</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13275010"&gt;@theresa_kewley&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;check this CANG command.&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;&lt;LI-CODE lang="lisp"&gt;; calculate an angle
(defun c:cang (/ p1 p2 p3 a1 a2 a3)
 (if (and
       (setq p1 (getpoint "\nPoint1 Tension: "))
       (setq p2 (getpoint "\nPoint2 Compression: "))
       (setq p3 (getpoint "\nPoint1 Compression: "))
     )
  (progn
   ; calc angles 
   (setq a1 (angle p2 p1))
   (setq a2 (angle p2 p3))

   (if (&amp;gt; a1 a2)
    (setq a3 (- a1 a2))
    (setq a3 (- a2 a1))
   )

   ; make sure sharp angle
   (if (&amp;gt; a3 pi)
    (setq a3 (- (* pi 2) a3))
   )

   
   (princ (strcat "\nAngle = " (angtos a3 1 4)))
  ); progn
 ); if  

 (princ) 
); c:cang&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 17:08:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617655#M37117</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2022-12-13T17:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617759#M37118</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13275010"&gt;@theresa_kewley&lt;/a&gt;&amp;nbsp;Please upload your sample DWG .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sad to know ,&amp;nbsp; ACAD , can not handle .png&amp;nbsp; neither image.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 17:59:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617759#M37118</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2022-12-13T17:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617820#M37119</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747"&gt;@Moshe-A&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is what happened when running the CANG lisp.&amp;nbsp; I believe it has to do with the UCS that it's getting 0.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="theresa_kewley_0-1670955827803.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1152108iD5EAC8011319A97B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="theresa_kewley_0-1670955827803.png" alt="theresa_kewley_0-1670955827803.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/58962"&gt;@devitg&lt;/a&gt;&amp;nbsp;Attached the file.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 18:28:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617820#M37119</guid>
      <dc:creator>theresa_kewley</dc:creator>
      <dc:date>2022-12-13T18:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617913#M37120</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13275010"&gt;@theresa_kewley&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;....
(setq angle1Line1 (COMMAND "line" point1Tension point2Compression ""));Draw and get Line1 (CAN YOU SET LINE COLOR HERE?)
(setq angle1Line2 (COMMAND "line" point1Compression point2Compression ""));Draw and get Line2
....&lt;/LI-CODE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Read about the&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt; (command)&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;function in the AutoLisp Reference, and you will find that &lt;STRONG&gt;&lt;EM&gt;it always returns nil&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp; So you can't do the syntax above and get anything stored into your angle1Line1/2 variables.&amp;nbsp; You can do it this way [whether you use&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt; (command)&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;or&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt; (entmake{x})&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;....
(COMMAND "line" point1Tension point2Compression ""); Draw ...
(setq angle1Line1 (entlast)); ... and get Line1
....&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And no, you can't do the color of the Line within the command, but you could either set the CECOLOR System Variable &lt;EM&gt;before&lt;/EM&gt; you draw it [but then you need to set it back afterwards], or change its color &lt;EM&gt;after&lt;/EM&gt; it's drawn, by several methods including a CHPROP command, imposing a color override in entity data, applying it as a VLA property, or maybe the simplest:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;(setpropertyvalue (entlast) "Color" &lt;EM&gt;&lt;FONT color="#00CCFF"&gt;YourDesiredColor&lt;/FONT&gt;&lt;/EM&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 19:21:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11617913#M37120</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-12-13T19:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11618074#M37121</link>
      <description>&lt;P&gt;This ? For obtain angle IN plane XY or WITH plane XY&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun C:ID-Angle ( / pt_o pt_f dxf_11 ang ang_z)
  (initget 8)
  (setq pt_o (getpoint "\nSpecify the first point: "))
  (if (null pt_o) (setq pt_o (getvar "lastpoint")))
  (cond
    (pt_o
      (initget 41)
      (setq pt_f (getpoint pt_o "\nSpecify the second point: "))
      (cond
        (pt_f
          (setq dxf_11
            (trans
              (mapcar
                '(lambda (x / ) (/ x (distance (trans pt_o 1 0) (trans pt_f 1 0))))
                (mapcar '- (trans pt_f 1 0) (trans pt_o 1 0))
              )
              0 1 T
            )
          )
          (if (zerop (car dxf_11))
            (setq ang "infinite")
            (setq ang (angtos (atan (/ (cadr dxf_11) (car dxf_11)))))
          )
          (if (= (caddr dxf_11) 1.0)
            (setq ang_z "infinite")
            (if (zerop (caddr dxf_11))
              (setq ang_z (angtos 0.0))
              (setq ang_z (angtos (atan (sqrt (/ 1.0 (- (/ 1.0 (* (caddr dxf_11) (caddr dxf_11))) 1.0))))))
            )
          )
          (prompt (strcat "\nAngle in the plane XY = " ang " - Angle with the plane XY = " ang_z))
          (alert (strcat "Angle in the plane XY = " ang " - Angle with the plane XY = " ang_z))
        )
      )
    )
  )
  (prin1)
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Dec 2022 20:11:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11618074#M37121</guid>
      <dc:creator>CADaSchtroumpf</dc:creator>
      <dc:date>2022-12-13T20:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11618079#M37122</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13275010"&gt;@theresa_kewley&lt;/a&gt;&amp;nbsp;wrote:....&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;....
(setq angle1 (COMMAND "MEASUREGEOM" "Angle" angle1Line1 angle1Line2 ""));get Angle 1&lt;/LI-CODE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The MEASUREGEOM Angle option won't accept entity names, but requires picking a point on something, maybe because the returned value could be different depending on &lt;EM&gt;where&lt;/EM&gt; you pick on it.&amp;nbsp; But the angle can be measured this way [&lt;EM&gt;without even drawing the Lines&lt;/EM&gt;]:&lt;/P&gt;
&lt;P&gt;(command "MEASUREGEOM" "Angle" "" point2Compression point1Tension point2Compression "_exit")&lt;/P&gt;
&lt;P&gt;And it shows you the result in degrees -- no need to convert radians.&amp;nbsp; &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;However&lt;/STRONG&gt;&lt;/FONT&gt;, I'm not sure how to put that into a variable, since (command) returns nil.&amp;nbsp; There's a LASTANGLE System Variable, but this result does not go into that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A complication here is that you want an angle between Lines in the Z direction, whereas the (angle) function works only in the XY plane of the current UCS.&amp;nbsp; So a calculation is probably needed, and it does not require changing the UCS -- Pythagoras is your friend.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 20:29:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11618079#M37122</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-12-13T20:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11618080#M37123</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13275010"&gt;@theresa_kewley&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you only start learning autolisp and you are jumping to hardcore?&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;of course we need ucs here,&amp;nbsp;check this fix:&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;; calculate an angle
(defun c:cang (/ p1 p2 p3 a1 a2 a3)
 (setvar "cmdecho" 0)
 (command "undo" "begin")

 (command "ucs" "w")
 (command "ucs" "z" -90)
 (command "ucs" "x"  90)
  
 (if (and
       (setq p1 (getpoint "\nPoint1 Tension: "))
       (setq p2 (getpoint "\nPoint2 Compression: "))
       (setq p3 (getpoint "\nPoint1 Compression: "))
     )
  (progn
   
   ; calc angles 
   (setq a1 (angle p2 p1))
   (setq a2 (angle p2 p3))

   (if (&amp;gt; a1 a2)
    (setq a3 (- a1 a2))
    (setq a3 (- a2 a1))
   )

   ; make sure sharp angle
   (if (&amp;gt; a3 pi)
    (setq a3 (- (* pi 2) a3))
   )

   
   (princ (strcat "\nAngle = " (angtos a3 1 4)))
  ); progn
 ); if  

 (command "ucs" "w")

 (command "undo" "end")
 (setvar "cmdecho" 1)
  
 (princ) 
); c:cang&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 20:12:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11618080#M37123</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2022-12-13T20:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11618276#M37124</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13275010"&gt;@theresa_kewley&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is a better version, let you measure angle from any 3 points in 3d.&lt;/P&gt;&lt;P&gt;of course there is an advanced way to do it by selecting lines (instead of specifying points) and reading objects database xyz but hey you are still a beginner so take it step by step.&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;; Calculate an angle
(defun c:cang (/ savExp p1 p2 p3 a1 a2 a3 cucs)
 (setvar "cmdecho" 0)		; turn command echo off
 (command "undo" "begin")	; start undo

 (if (and
       (setq p1 (getpoint "\nPoint1 Tension: "))
       (setq p2 (getpoint "\nPoint2 Compression: "))
       (setq p3 (getpoint "\nPoint1 Compression: "))
     )
  (progn
   (setq savExp (getvar "expert")) ; save expert value
   (setvar "expert" 5) 		   ; allows ucs save work smoothly
   
   (command "ucs" "save" (setq cucs "$cang"))  ; save current ucs
   (command "ucs" "3p" p2 p3 p1)  	       ; create ucs on 3 points

   ; convert points from wcs to ucs
   (setq p1 (trans p1 0 1))
   (setq p2 (trans p2 0 1))
   (setq p3 (trans p3 0 1))
   
   ; calc angles 
   (setq a1 (angle p2 p1))
   (setq a2 (angle p2 p3))

   (if (&amp;gt; a1 a2)
    (setq a3 (- a1 a2))
    (setq a3 (- a2 a1))
   )

   ; make sure sharp angle
   (if (&amp;gt; a3 pi)
    (setq a3 (- (* pi 2) a3))
   )
   
   (princ (strcat "\nAngle = " (angtos a3 1 4)))
   
   (command "ucs" "restore" cucs)  ; restore ucs
   (command "ucs" "delete"  cucs)  ; delete  ucs
   
   (setvar "expert" savExp)	   ; restore normal expert behavior
  ); progn
 ); if  
  
 (command "undo" "end") ; close undo
 (setvar "cmdecho" 1)	; restore command echo
  
 (princ) 
); c:cang&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 21:48:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11618276#M37124</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2022-12-13T21:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11618697#M37125</link>
      <description>&lt;P&gt;My $0.05&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq p1 (getpoint "\nPoint1 Tension: "))
       (setq p2 (getpoint p1 "\nPoint2 Compression: "))
       (setq p3 (getpoint p2 "\nPoint1 Compression: "))&lt;/LI-CODE&gt;&lt;P&gt;Just an illustration of showing where your picking from.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I would look at setting osnaps as you go looks like end is correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq oldsnap (getvar 'osmode)) ; get the current osnaps settings

(setvar 'osmode 1)
(setq p1 (getpoint "\nPoint1 Tension: ")
       p2 (getpoint p1 "\nPoint2 Compression: ")
       p3 (getpoint p2 "\nPoint1 Compression: "))
(setvar 'osmode oldsnap) ; if last getpoint or set to another snap for next get&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 14 Dec 2022 03:54:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11618697#M37125</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2022-12-14T03:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11619974#M37126</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;A complication here is that you want an angle between Lines in the Z direction, whereas the (angle) function works only in the XY plane of the current UCS.&amp;nbsp; So a calculation is probably needed, and it does not require changing the UCS -- Pythagoras is your friend.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Actually, a little trigonometry can do it, without bothering Pythagoras.&amp;nbsp; After the establishment of the point1Tension / point1Compression / point2Compression variables in Message 1, and assuming the point2compression point is above [as in your image, but could also be below] &lt;EM&gt;both&lt;/EM&gt; the point1 locations, then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;(setq p1T point1Tension p1C point1Compression p2C point2Compression); [simplify variable names for use below]&lt;/FONT&gt;&lt;BR /&gt;(setq&lt;BR /&gt;&amp;nbsp; verC (- (caddr p2C) (caddr p1C))&lt;BR /&gt;&amp;nbsp; verT (- (caddr p2C) (caddr p1T))&lt;BR /&gt;&amp;nbsp; horC (distance p1C (list (car p2C) (cadr p2C) (caddr p1C)))&lt;BR /&gt;&amp;nbsp; horT (distance p1T (list (car p2C) (cadr p2C) (caddr p1T)))&lt;BR /&gt;&amp;nbsp; angC (atan (/ verC horC))&lt;BR /&gt;&amp;nbsp; angT (atan (/ verT horT))&lt;BR /&gt;&amp;nbsp; angbetween (abs (- angT angC))&lt;BR /&gt;)&lt;BR /&gt;(prompt (strcat "\nAngle between lines is " (angtos angbetween) "."))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That reports the angle in whatever your current angular Units mode and precision settings are.&amp;nbsp; The Lines are &lt;EM&gt;not needed&lt;/EM&gt;&amp;nbsp;to find the angle, though you can have them drawn if you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the point2 apex location might sometimes fall vertically &lt;EM&gt;between&lt;/EM&gt; the Z coordinates of the two point1 locations, it could be made to check for that, and if that's the case, the angle between would be the &lt;EM&gt;sum&lt;/EM&gt; of the two calculated angles:&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;&amp;nbsp; angbetween (+ angT angC)&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 14:32:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11619974#M37126</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-12-14T14:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Draw 2 lines and get the angle through Autolisp COMMANDS</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11620980#M37127</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13275010"&gt;@theresa_kewley&lt;/a&gt;&amp;nbsp;My way to do it , the old scalene triangle resolution .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pt 2 shall be pick at the need angle vertex , do not matter the Coordinate system&amp;nbsp; , as I test it work for any triangle .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;;;;;;;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
;; Design by Gabo CALOS DE VIT from CORDOBA ARGENTINA
;;;    Copyleft 1995-2022 by Gabriel Calos De Vit ; DEVITG@GMAIL.COM    
;;

 ; Hecho por  Gabo CALOS DE VIT de CORDOBA ARGENTINA
;;;    Copyleft 1995-2022 por Gabriel Calos De Vit 
;; DEVITG@GMAIL.COM 
;;******************************************************  

(DEFUN ASIN  (NUM)
  (COND
    ((EQUAL NUM 1 1e-12) (/ PI 2))
    ((EQUAL NUM -1 1e-12) (/ PI -2))
    ((&amp;lt; -1 NUM 1)
     (ATAN NUM (SQRT (- 1 (EXPT NUM 2))))
     )
    )
  )






  (SETQ ACAD-OBJ (VLAX-GET-ACAD-OBJECT)) ;_ el programa ACAD 
  (SETQ ADOC (VLA-GET-ACTIVEDOCUMENT ACAD-OBJ)) ;_ el DWG que esta abierto-
  (SETQ MODEL (VLA-GET-MODELSPACE ADOC))



(VL-LOAD-COM)
(DEFUN C:ANG,  (/
;;;1/2AA
;;;A
;;;A+B+C/2
;;;AA
;;;AA-DEG
;;;B
;;;C
;;;P1
;;;P2
;;;P3
;;;PLIST
;;;ROOT
;;;SEMI-B
;;;SEMI-C
;;;SIN1/2AA
                )
  (SETVAR 'OSMODE 8)
  (IF (AND
        (SETQ P1 (GETPOINT "\nPoint1 Tension, : "))
        (SETQ P2 (GETPOINT "\nPoint2 Compression, @ angle vertex: "))
        (SETQ P3 (GETPOINT "\nPoint1 Compression: "))
        )
    (PROGN
      (SETQ PLIST (LIST P1 P2 P3));just to see the points

      (SETQ A (DISTANCE P1 P3))
      (SETQ B (DISTANCE P1 P2))
      (SETQ C (DISTANCE P2 P3))

      (SETQ A+B+C/2 (/ (+ A B C) 2.0))

      (SETQ SEMI-B (- A+B+C/2 B))

      (SETQ SEMI-C (- A+B+C/2 C))

      (SETQ ROOT (/ (* SEMI-C SEMI-B) (* B C)))

      (SETQ SIN1/2AA (SQRT ROOT))



      (SETQ 1/2AA (ASIN SIN1/2AA))

      (SETQ AA-DEG (angtos(SETQ AA (* 2 1/2AA))1 4))

      
     
      ) ; progn
    ) ;end if
  (alert (strcat "AA = "AA-DEG )) 
  ) ;end defun ang,













&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Need to localize variables&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 21:09:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-2-lines-and-get-the-angle-through-autolisp-commands/m-p/11620980#M37127</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2022-12-14T21:09:38Z</dc:date>
    </item>
  </channel>
</rss>

