<?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: basic Autolisp in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652379#M141374</link>
    <description>&lt;P&gt;I just made another similar assignment. It is the same case. The L line is not horizontal. but all other dimensios are corrected. So maybe the centers of the arcs are not correct?&lt;/P&gt;</description>
    <pubDate>Tue, 26 May 2015 19:38:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-05-26T19:38:24Z</dc:date>
    <item>
      <title>basic Autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652064#M141369</link>
      <description>&lt;P&gt;Hello, I am starting to learn how to work with autolisp but I'm having a really hard time. Hope you can help me because I have few questions.&lt;/P&gt;
&lt;P&gt;1. I want to assign (don't know if this word is correct in this context) value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;In math it is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;H=30; R=0.35H&lt;/P&gt;
&lt;P&gt;But how do you write this in LISP language? (setq R (* 0.35 H) ?&lt;/P&gt;
&lt;P&gt;I have an example by which I made my assignment but I still don't get it.&lt;/P&gt;
&lt;P&gt;Here is my assignment and here is what came up with. maybe you could tell me the main things and tell where the mistakes are.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/170317i07620ADA3FA16B80/image-size/medium?v=mpbl-1&amp;amp;px=-1" border="0" alt="image1.JPG" title="image1.JPG" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;;------------------------------------------------
 ; baseline data&amp;amp;colon; p0, L, H, b, c, a, w, a1          
 ;------------------------------------------------

 ;--baseline data----------------------------
    (defun prduom ()
     (setq p0 (getpoint "\n mark base point p0:"))
     (setq L (getdist "\nWidth L &amp;lt;30&amp;gt;:"))
     (if (null L) (setq L 30)) 
     (setq H (getdist "\nHeight H &amp;lt;30&amp;gt;:"))
     (if (null H) (setq H 30))
     (setq b (* [0.35] H)
     (setq c (* [0.15] H)
     (setq a (* [0.85] H)
     (setq r (* [0.35] H)
     (setq a1 (- L a) 
     (setq W (getdist "\nPolyline width W &amp;lt;0.5&amp;gt;:"))
     (if (null w) (setq w 0.5))
     (setq m (getdist "\nScale  m &amp;lt;1.0&amp;gt;:"))
     (if (null m) (setq m 1.0))  
        )
 ;--evaluating coordinates-------------------------
    (defun skaic ()
     (setq p1 (polar p0 (/ pi 2.0) H))
     (setq p2 (polar p1 0 a1))
     (setq p3 (list (car p2) (- (cadr p2) c)))
     (setq p4 (polar p3 (* 1.75 pi) (* r (sqrt 2))))
     (setq p5 (polar p4 0 c))
     (setq p6 (polar p5 (* 1.75 pi) (* r (sqrt 2))))
     (setq p7 (list (car p6) (- (cadr p6) b)))
      )
 ;--drawing contour------------------------------
    (defun braiz ()
     (command "PLINE" p0 "w" w "" p1 p2 p3 "ARC" "ANGLE" "-90" p4 "L" p5 "ARC" "ANGLE" "90" p6 "L" p7 p0 "")
      (setq p2 (entlast))
      (command "SCALE" p2 "" p0 m )
     (setq PL2 (entlast))
     (command "hatch" "ansi31" 2 0 PL2 "")
    )    

 ;--Main Program-------------------------------------------
    (defun C:uzdv()
       (prduom)
       (skaic)
       (braiz)
       (princ)
    )&lt;/PRE&gt;
&lt;P&gt;Edited by&lt;BR /&gt;Discussion_Admin&lt;/P&gt;
&lt;P&gt;note please use the insert code option when post to the community&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2015 17:06:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652064#M141369</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-26T17:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: basic Autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652106#M141370</link>
      <description>&lt;DIV style="font-size: 12px; font-style: italic; color: blue; margin-left: 25px; margin-bottom: 25px; padding: 3px; border: 1px dotted black; font-family: verdana;"&gt;donbru wrote:&lt;BR /&gt;
&lt;P&gt;In math it is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;H=30; R=0.35H&lt;/P&gt;
&lt;P&gt;But how do you write this in LISP language? (setq R (* 0.35 H) ?&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;Specifically answering that question...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(setq h 30.0)
(setq r (* 0.35 h))&lt;/PRE&gt;
&lt;P&gt;I see you have some square brackets, those are not used. Only parenthesis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2015 16:33:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652106#M141370</guid>
      <dc:creator>rkmcswain</dc:creator>
      <dc:date>2015-05-26T16:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: basic Autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652151#M141371</link>
      <description>&lt;P&gt;Ok, thank you. I made some corrections and I have something not quite what I need but close&lt;/P&gt;
&lt;P&gt;.&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/170330i8E9B7F8408E948D1/image-size/small?v=mpbl-1&amp;amp;px=-1" border="0" alt="image1.JPG" title="image1.JPG" width="200" height="150" /&gt;this should be rotate 90 degrees to the right&lt;/P&gt;
&lt;P&gt;I also added the corrected program&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2015 17:00:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652151#M141371</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-26T17:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: basic Autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652252#M141372</link>
      <description>&lt;P&gt;Ok, the only way I get the horizontal line ( L) straight is when the line (b) is (0.15 H) or 4.5. So is the condition wrong or I made a mistake somewhere?&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2015 18:11:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652252#M141372</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-26T18:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: basic Autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652361#M141373</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Ok, the only way I get the horizontal line ( L) straight is when the line (b) is (0.15 H) or 4.5. So is the condition wrong or I made a mistake somewhere?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think their diagram is wrong about (b). &amp;nbsp;The arcs are not quite drawn in it as full 90-degree swings, but they need to be if two (R)'s plus a (c) are going to add up to (a) at 85% of H. &amp;nbsp;[And shouldn't that (a) be a proportion of &lt;EM&gt;L&lt;/EM&gt; rather than of H? &amp;nbsp;In this case they're equal, but presumably not always.] &amp;nbsp;Given quarter-circle arcs, they have two (R)'s plus (c) plus (b) making up the overall dimension in the direction parallel to H, and they add up to 110% of H. &amp;nbsp;It might be wrong in the visual implication that the side along the L dimension is perpendicular to the H side, rather than about the size of (b), but something doesn't add up.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2015 19:28:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652361#M141373</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-05-26T19:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: basic Autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652379#M141374</link>
      <description>&lt;P&gt;I just made another similar assignment. It is the same case. The L line is not horizontal. but all other dimensios are corrected. So maybe the centers of the arcs are not correct?&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2015 19:38:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652379#M141374</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-26T19:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: basic Autolisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652534#M141375</link>
      <description>&lt;P&gt;Hi donbru,&lt;/P&gt;
&lt;P&gt;I do not see any condition in the diagram that says 'arcs must be a quarter circle'...&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Fulfilling all diagram conditions, perhaps something like this will do the trick.&lt;/P&gt;
&lt;P&gt;Just a rough draft 'demo', as a starting point...&lt;/P&gt;
&lt;PRE&gt;(defun c:demo (/ A B C D F H H1 L1 OSM P0 P1 P2 P3 P4 P5 P6 P7 PF1 PF2 PMID1 PMID2 R)
  (if (and (setq p0 (getpoint "\nSpecify first point: "))
           (listp p0)
           (setq h (getdist "\nSpecify height: "))
      )
    (progn
      (setq osm (getvar 'OSMODE))
      (setvar 'OSMODE 0)
      (setq a     (* h 0.85)
            b     (* h 0.25)
            c     (* h 0.15)
            r     (* h 0.35)
            p1    (polar p0 (* pi 0.5) h)
            p2    (polar p1 0.0 c)
            p3    (polar p2 (* pi 1.5) c)
            h1    (/ (- h (+ b c)) 2.0)
            l1    (/ (- h (+ c c)) 2.0)
            p4    (list (+ (car p3) l1) (- (cadr p3) h1))
            p5    (polar p4 0.0 c)
            p6    (list (+ (car p5) l1) (- (cadr p5) h1))
            p7    (polar p6 (* pi 1.5) b)
            d     (distance p3 p4)
            f     (- r (sqrt (abs (- (* (* d 0.5) (* d 0.5)) (* r r)))))
            pmid1 (polar p3 (angle p3 p4) (* d 0.5))
            pf1   (polar pmid1 (+ (angle pmid1 p4) (* pi 0.5)) f)
            pmid2 (polar p5 (angle p5 p6) (* d 0.5))
            pf2   (polar pmid2 (+ (angle pmid2 p5) (* pi 0.5)) f)
      )
      (command "_pline" p0 p1 p2 p3 "_A" "_S" pf1 p4 "_L" p5 "_A" "_S" pf2 p6 "_L" p7 "_C")
      (setvar 'OSMODE osm)
    )
  )
  (princ)
)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2015 21:25:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/basic-autolisp/m-p/5652534#M141375</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-05-26T21:25:58Z</dc:date>
    </item>
  </channel>
</rss>

