<?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: Making default value in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614176#M111225</link>
    <description>&lt;P&gt;If you want to allow hitting enter then avoid setting bit 0 (value 1)&amp;nbsp;in initget. That will prevent a {ENTER} response.&lt;/P&gt;
&lt;PRE&gt;(setq landing "0.26"
       resp    (progn (initget "0.26 0.27 0.28 0.29 0.30")
                      (getkword (strcat "[0.26/0.27/0.28/0.29/0.30] &amp;lt;" landing "&amp;gt;: "))))
 (if (null resp)
  landing
  (setq landing resp))&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Dec 2017 16:54:15 GMT</pubDate>
    <dc:creator>Ranjit_Singh</dc:creator>
    <dc:date>2017-12-11T16:54:15Z</dc:date>
    <item>
      <title>Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614098#M111223</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I'm writing a LISP which contains a variable Landing. I made a list of options to choose using&amp;nbsp; Initget function.&lt;/P&gt;&lt;P&gt;Then i used Getkword function with those values. Like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(initget 1 "0.26 0.27 0.28 0.29 0.30")&lt;BR /&gt;(setq Landing "0.26")&lt;BR /&gt;(setq Landing (getkword (strcat "\nEnter the landing distance (m): [0.26/0.27/0.28/0.29/0.30] &amp;lt;" Landing "&amp;gt; :")))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The trouble is when i hit enter button without choosing any value, here it should take the default value as it's defined 0.26 but it never happened.&lt;/P&gt;&lt;P&gt;it works only when i go up and down in the list of options and choose it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me how can i make a value as default activated when i press enter without going up and down?&lt;/P&gt;&lt;P&gt;I tried to use cond and if like that :&lt;/P&gt;&lt;P&gt;(if (not Landing) (setq Landing "0.26")&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(initget 1 "0.26 0.27 0.28 0.29 0.30")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(setq Landing&lt;/P&gt;&lt;P&gt;(cond&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;(getkword (strcat "\nEnter the landing distance (m): [0.26/0.27/0.28/0.29/0.30] &amp;lt;" Landing "&amp;gt; :"))&lt;/P&gt;&lt;P&gt;(Landing)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;But it goes wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 16:26:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614098#M111223</guid>
      <dc:creator>Muhammed.OPERA</dc:creator>
      <dc:date>2017-12-11T16:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614163#M111224</link>
      <description>&lt;P&gt;Try it this way, which doesn't need you to pre-set the Landing value, so that whatever other-than-0.26 value you have used previously will remain as the default:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(initget&amp;nbsp;"0.26 0.27 0.28 0.29 0.30")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ;;&amp;nbsp;&lt;FONT color="#ff0000"&gt;without the&amp;nbsp;1 -- allow Enter&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;(setq Landing&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (cond&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (getkword &lt;FONT color="#0000ff"&gt;; use value it gets if User types it&amp;nbsp;in&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;(strcat&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;"\nEnter the landing distance (m): [0.26/0.27/0.28/0.29/0.30] &amp;lt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (cond&amp;nbsp;(Landing) ("0.26"))&lt;FONT color="#0000ff"&gt;; offer current value as default if present, otherwise 0.26&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&amp;gt; :"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ); strcat&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ); getkword&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Landing)&lt;FONT color="#0000ff"&gt;; if User hits Enter at (getkword) [nil return], use prior value if present &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ("0.26")&lt;FONT color="#0000ff"&gt;; use this value if User hits Enter with no prior value&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ); cond&lt;/P&gt;
&lt;P&gt;); setq&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 16:51:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614163#M111224</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-12-11T16:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614176#M111225</link>
      <description>&lt;P&gt;If you want to allow hitting enter then avoid setting bit 0 (value 1)&amp;nbsp;in initget. That will prevent a {ENTER} response.&lt;/P&gt;
&lt;PRE&gt;(setq landing "0.26"
       resp    (progn (initget "0.26 0.27 0.28 0.29 0.30")
                      (getkword (strcat "[0.26/0.27/0.28/0.29/0.30] &amp;lt;" landing "&amp;gt;: "))))
 (if (null resp)
  landing
  (setq landing resp))&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Dec 2017 16:54:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614176#M111225</guid>
      <dc:creator>Ranjit_Singh</dc:creator>
      <dc:date>2017-12-11T16:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614468#M111226</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3261555"&gt;@Ranjit_Singh&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;for your time and attention&lt;/P&gt;&lt;P&gt;I have tried the two cases but it didn't work&amp;nbsp;&lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://forums.autodesk.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;Here is the full lisp till now (i'm working on it):&lt;/P&gt;&lt;P&gt;(defun C:OPERAStair()&lt;BR /&gt;;Making zero variables.&lt;BR /&gt;(setq Landing 0.00 Riser 0.00 Thickness 0.00 L1 0.00 L2 0.00 NoSteps 0 Point1 '(0 0)&lt;BR /&gt;Point2 '(0 0) Point3 '(0 0))&lt;BR /&gt;;Making layer&lt;BR /&gt;(command "layer" "new" "OPERA_Stair" "color" "red" "OPERA_Stair" "Ltype" "continuous" "OPERA_Stair" "LWeight" "0.35" "OPERA_Stair" "Make" "OPERA_Stair" "")&lt;BR /&gt;;Setting object properties into default ones.&lt;BR /&gt;(command "Color" "Bylayer" "")&lt;BR /&gt;(command "Linetype" "Set" "Bylayer" "")&lt;BR /&gt;(command "LWeight" "0.35")&lt;BR /&gt;;Asking for inputs.&lt;BR /&gt;(setq NoSteps (getint "\nEnter number of steps: "))&lt;BR /&gt;;Setting Landing distance.&lt;BR /&gt;(initget "0.26 0.27 0.28 0.29 0.30")&lt;BR /&gt;(setq Landing (getkword "\nEnter the landing distance (m): [0.26/0.27/0.28/0.29/0.30] &amp;lt;0.30&amp;gt; :"))&lt;BR /&gt;(if&lt;BR /&gt;(= Landing "0.26")&lt;BR /&gt;(setq Landing 0.26))&lt;BR /&gt;(if&lt;BR /&gt;(= Landing "0.27")&lt;BR /&gt;(setq Landing 0.27))&lt;BR /&gt;(if&lt;BR /&gt;(= Landing "0.28")&lt;BR /&gt;(setq Landing 0.28))&lt;BR /&gt;(if&lt;BR /&gt;(= Landing "0.29")&lt;BR /&gt;(setq Landing 0.29))&lt;BR /&gt;(if&lt;BR /&gt;(= Landing "0.30")&lt;BR /&gt;(setq Landing 0.30))&lt;BR /&gt;;Setting Riser distance.&lt;BR /&gt;(initget "0.14 0.15 0.16 0.17 0.18")&lt;BR /&gt;(setq Riser (getkword "\nEnter the riser distance (m): [0.14/0.15/0.16/0.17/0.18] &amp;lt;0.15&amp;gt; :"))&lt;BR /&gt;(setq RiserList (List 0.14 0.15 0.16 0.17 0.18))&lt;BR /&gt;(if&lt;BR /&gt;(= Riser "0.14")&lt;BR /&gt;(setq Riser (nth 1 RiserList)))&lt;BR /&gt;(if&lt;BR /&gt;(= Riser "0.15")&lt;BR /&gt;(setq Riser (nth 2 RiserList)))&lt;BR /&gt;(if&lt;BR /&gt;(= Riser "0.16")&lt;BR /&gt;(setq Riser (nth 3 RiserList)))&lt;BR /&gt;(if&lt;BR /&gt;(= Riser "0.17")&lt;BR /&gt;(setq Riser (nth 4 RiserList)))&lt;BR /&gt;(if&lt;BR /&gt;(= Riser "0.18")&lt;BR /&gt;(setq Riser (nth 5 RiserList)))&lt;BR /&gt;;Drawing starts here.&lt;BR /&gt;(Setq Point1 (getpoint "\nSpecify lower left corner of the section: "))&lt;BR /&gt;;Zooming area.&lt;BR /&gt;(setq Ptz1 Point1&lt;BR /&gt;Ptz2 (polar Ptz1 0 (* NoSteps Landing))&lt;BR /&gt;Ptz3 (polar Ptz2 (/ pi 2) (* NoSteps Riser))&lt;BR /&gt;Ptz4 (polar Ptz1 (* pi 1.25) 1)&lt;BR /&gt;Ptz5 (polar Ptz3 (* 0.25 pi) 1))&lt;BR /&gt;(command "Zoom" Ptz4 Ptz5)&lt;BR /&gt;;Repeat.&lt;BR /&gt;(repeat NoSteps&lt;BR /&gt;(setq Point2 (Polar Point1 (/ pi 2) Riser)&lt;BR /&gt;Point3 (polar Point2 0 Landing))&lt;BR /&gt;(command "PLine" Point1 Point2 Point3 "")&lt;BR /&gt;(setq Object1 (ssget "C" Point3 Point1))&lt;BR /&gt;(setq Object2 (entlast))&lt;BR /&gt;(command "Join" Object1 Object2 "")&lt;BR /&gt;;;(setq Object1 (ssget "w" Point1 Point3 '(List (cons 0 "PLINE") (cons 8 OPERA_Stair))))&lt;BR /&gt;;;(command "Join" (list Object1 Object1))&lt;BR /&gt;(setq Point1 Point3)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 18:30:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614468#M111226</guid>
      <dc:creator>Muhammed.OPERA</dc:creator>
      <dc:date>2017-12-11T18:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614570#M111227</link>
      <description>&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Hi,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Keep the variable Landing un-localized to be able to reset the value in the &lt;FONT color="#0000FF"&gt;cond&lt;/FONT&gt; function statement.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(or Landing (setq Landing "0.26"))
(initget "0.26 0.27 0.28 0.29 0.30")
(setq Landing (cond ((getkword (strcat "\nEnter the landing distance (m): [0.26/0.27/0.28/0.29/0.30] &amp;lt;" Landing "&amp;gt; :")))
                    (Landing))
  )&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Dec 2017 19:00:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614570#M111227</guid>
      <dc:creator>_Tharwat</dc:creator>
      <dc:date>2017-12-11T19:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614623#M111228</link>
      <description>&lt;P&gt;A couple of things....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't do all those separate (if) tests for the Landing value, replacing text values from (getkword) with equivalent real-number values.&amp;nbsp; You can just do this, to cover any choice, without &lt;EM&gt;any&lt;/EM&gt;&amp;nbsp; (if) function, much less a separate one for every potential value:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(setq Landing (&lt;FONT color="#0000ff"&gt;&lt;STRONG&gt;atof&lt;/STRONG&gt;&lt;/FONT&gt; Landing))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do the same with the Riser value, but if you have some reason to stick with your (nth)-based approach [why you're doing it differently from the Landing value, I can't imagine], you need to fix something:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;(if&lt;BR /&gt;(= Riser "0.14")&lt;BR /&gt;(setq Riser (nth &lt;FONT color="#ff0000"&gt;1&lt;/FONT&gt; RiserList)))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(if&lt;BR /&gt;(= Riser "0.14")&lt;BR /&gt;(setq Riser (nth&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; RiserList)))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;because 0 is the index number for the first item in a list, which in your list is the 0.14 value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The current state of things doesn't seem to incorporate either of the other suggestions about the (getkword)/(cond) approaches.&amp;nbsp;&amp;nbsp;Can you be more detailed about what you mean by "it didn't work"?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 19:17:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614623#M111228</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-12-11T19:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614652#M111229</link>
      <description>&lt;P&gt;Or even save it to the bulletin board for other drawngs in the same AutoCAD session.&lt;/P&gt;
&lt;P&gt;Of course the symbol name could probably be more unique.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 19:24:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614652#M111229</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2017-12-11T19:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614693#M111230</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3037613"&gt;@Muhammed.OPERA&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3261555"&gt;@Ranjit_Singh&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;for your time and attention&lt;/P&gt;
&lt;P&gt;I have tried the two cases but it didn't work&amp;nbsp;&lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://forums.autodesk.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;
&lt;P&gt;Here is the full lisp till now (i'm working on it):&lt;/P&gt;
&lt;P&gt;........&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would recommend using environment variables. See below code. No error trap and minimal testing.&lt;/P&gt;
&lt;PRE&gt;(defun c:operastair&amp;nbsp; (/ dat landing nosteps object1 object2 point1 point2 point3 ptz1 ptz2 ptz3 ptz4 ptz5 resp riser thickness)&lt;BR /&gt;&amp;nbsp;(if (setq dat (getenv "landing"))&lt;BR /&gt;&amp;nbsp; (setq landing (atof dat))&lt;BR /&gt;&amp;nbsp; (progn (setenv "landing" "0.26") (setq landing 0.26)))&lt;BR /&gt;&amp;nbsp;(if (setq dat (getenv "riser"))&lt;BR /&gt;&amp;nbsp; (setq riser (atof dat))&lt;BR /&gt;&amp;nbsp; (progn (setenv "riser" "0.14") (setq riser 0.14)))&lt;BR /&gt;&amp;nbsp;(setq thickness 0.00&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nosteps 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point1 '(0 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point2 '(0 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point3 '(0 0))&lt;BR /&gt;&amp;nbsp;(command "layer" "new" "OPERA_Stair" "color" "red" "OPERA_Stair" "Ltype" "continuous" "OPERA_Stair" "LWeight" "0.35" "OPERA_Stair" "Make" "OPERA_Stair" "")&lt;BR /&gt;&amp;nbsp;(command "Color" "Bylayer" "")&lt;BR /&gt;&amp;nbsp;(command "Linetype" "Set" "Bylayer" "")&lt;BR /&gt;&amp;nbsp;(command "LWeight" "0.35")&lt;BR /&gt;&amp;nbsp;(setq nosteps (getint "\nEnter number of steps: "))&lt;BR /&gt;&amp;nbsp;(initget "0.26 0.27 0.28 0.29 0.30")&lt;BR /&gt;&amp;nbsp;(cond ((setq resp (getkword&lt;BR /&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (strcat "\nEnter the landing distance (m): [0.26/0.27/0.28/0.29/0.30] &amp;lt;" (getenv "landing") "&amp;gt; :")))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setenv "landing" resp)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq landing (atof resp))))&lt;BR /&gt;&amp;nbsp;(initget "0.14 0.15 0.16 0.17 0.18")&lt;BR /&gt;&amp;nbsp;(cond ((setq resp (getkword&lt;BR /&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (strcat "\nEnter the riser distance (m): [0.14/0.15/0.16/0.17/0.18] &amp;lt;" (getenv "riser") "&amp;gt; :")))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setenv "riser" resp)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq riser (atof resp))))&lt;BR /&gt;&amp;nbsp;(setq point1 (getpoint "\nSpecify lower left corner of the section: "))&lt;BR /&gt;&amp;nbsp;(setq ptz1 point1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptz2 (polar ptz1 0 (* nosteps landing))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptz3 (polar ptz2 (/ pi 2) (* nosteps riser))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptz4 (polar ptz1 (* pi 1.25) 1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptz5 (polar ptz3 (* 0.25 pi) 1))&lt;BR /&gt;&amp;nbsp;(command "Zoom" ptz4 ptz5)&lt;BR /&gt;&amp;nbsp;(repeat nosteps&lt;BR /&gt;&amp;nbsp; (setq point2 (polar point1 (/ pi 2) riser)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point3 (polar point2 0 landing))&lt;BR /&gt;&amp;nbsp; (command "PLine" point1 point2 point3 "")&lt;BR /&gt;&amp;nbsp; (setq object1 (ssget "C" point3 point1))&lt;BR /&gt;&amp;nbsp; (setq object2 (entlast))&lt;BR /&gt;&amp;nbsp; (command "Join" object1 object2 "")&lt;BR /&gt;&amp;nbsp; (setq point1 point3))&lt;BR /&gt;&amp;nbsp;(princ))&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stairs_enviro_var.gif" style="width: 589px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/437748i4226F8FC24F1BD07/image-size/large?v=v2&amp;amp;px=999" role="button" title="stairs_enviro_var.gif" alt="stairs_enviro_var.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 20:01:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614693#M111230</guid>
      <dc:creator>Ranjit_Singh</dc:creator>
      <dc:date>2017-12-11T20:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614774#M111231</link>
      <description>&lt;P&gt;Just to throw in another consideration:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my experience, the riser height of steps is &lt;EM&gt;not&lt;/EM&gt;&amp;nbsp; something we dictate in advance, but is determined&amp;nbsp;as a &lt;EM&gt;result&lt;/EM&gt;&amp;nbsp; of&amp;nbsp;the floor-to-floor height, which is determined by things like block coursing, bearing plate depths, framing depths, sheathing and flooring thicknesses, etc.&amp;nbsp; We don't usually specify either the number of steps nor what the riser height is to be, but divide the structurally-determined floor-to-floor height by the smallest number of steps that will cover that&amp;nbsp;distance at or below&amp;nbsp;the maximum riser height allowed in the Code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a routine that draws Stair Sections that way, see Stairs.lsp, &amp;gt;&lt;A href="http://cadtips.cadalyst.com/misc-user-tools/tip-2294-draw-stairs-plan-view" target="_blank"&gt;here&lt;/A&gt;&amp;lt;.&amp;nbsp; Their web sub-page is mis-named -- it does sections as well as plans.&amp;nbsp; It asks for the floor-to-floor height, the maximum allowable riser height,&amp;nbsp;and some other stuff, and &lt;EM&gt;it calculates the actual riser height needed to achieve that transition in the fewest number of code-compliant risers, and the number of those needed&lt;/EM&gt;.&amp;nbsp; [It's in imperial units and uses defaults from the most common Building Code in the US, so you'll have to change defaults, as well as things like Layer names and colors, but the concept should translate easily enough.]&amp;nbsp; And it&amp;nbsp;figures out some other things for you, such as a 2-run stair if needed [with some choices], a railing line, the difference between wood and steel-pan step profiles, etc.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 20:01:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7614774#M111231</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-12-11T20:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7615069#M111232</link>
      <description>&lt;P&gt;My contribution. I would like to keep the setting open for typing eg. ".28" or picking on the screen... or just a different value...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW in my country we're using this formula:&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;2*riser + landing = 630 mm&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:OperaStairs ( / NoSteps)

  (initget (+ 1 2 3))
  (setq NoSteps (getint "\nNumber of steps: "))

  (or *Landing*
      (setq *Landing* "0.30"))
  (initget "0.26 0.27 0.28 0.29 0.30")
  (setq *Landing* (vl-princ-to-string (cond ((getdist (strcat "\nLanding distance (m): [0.26/0.27/0.28/0.29/0.30] &amp;lt;" *Landing* "&amp;gt;: ")))
					    (*Landing*))))

  (or *Riser*
      (setq *Riser* "0.15"))
  (initget "0.14 0.15 0.16 0.17 0.18")
  (setq *Riser* (vl-princ-to-string (cond ((getdist (strcat "\nRiser distance (m): [0.14/0.15/0.16/0.17/0.18] &amp;lt;" *Riser* "&amp;gt;: ")))
					  (*Riser*))))

  (or (tblsearch "LAYER" "OPERA_Stair")
      (command "_.LAYER" "new" "OPERA_Stair" "color" "red" "OPERA_Stair" "LWeight" "0.35" "OPERA_Stair" ""))

  (if (setq pnt (getpoint "\nSpecify lower left corner of the section: "))
    (progn
      (vl-cmdf "_PLINE" "_none" pnt)
      (repeat NoSteps
	(vl-cmdf "_none" (strcat "@" *Landing* ",0")
		 "_none" (strcat "@0," *Riser*)))
      (vl-cmdf ""
	       "CHPROP" "_Last" "" "_Layer" "OPERA_Stair" "")))
  (princ)
)&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Dec 2017 22:02:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7615069#M111232</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2017-12-11T22:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7617919#M111233</link>
      <description>&lt;P&gt;Thanks verrrrrrrrry much for you all &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3261555"&gt;@Ranjit_Singh&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3930636"&gt;@john.uhden&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/660967"&gt;@_Tharwat&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I really appreciate your very helpful comments and your concern&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 18:37:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7617919#M111233</guid>
      <dc:creator>Muhammed.OPERA</dc:creator>
      <dc:date>2017-12-12T18:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7618093#M111234</link>
      <description>&lt;P&gt;I made it using :&lt;/P&gt;&lt;PRE&gt;(if
  (= riser nil)
  (setq riser "0.15")
)&lt;/PRE&gt;&lt;P&gt;It's greatly working with you help guys.&lt;/P&gt;&lt;P&gt;Thanks a lot.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 19:21:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7618093#M111234</guid>
      <dc:creator>Muhammed.OPERA</dc:creator>
      <dc:date>2017-12-12T19:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7618129#M111235</link>
      <description>&lt;P&gt;One way or another... or another... or another... all with same result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(if (= riser nil)
  (setq riser "0.15"))

(if (not riser)
  (setq riser "0.15"))

(if (null riser)
  (setq riser "0.15"))

(or riser
    (setq riser "0.15"))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 19:29:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7618129#M111235</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2017-12-12T19:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7618168#M111236</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;One way or another... or another... or another... all with same result.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Another:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(setq riser (cond (riser) ("0.15")))&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 19:38:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7618168#M111236</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-12-12T19:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Making default value</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7618762#M111237</link>
      <description>&lt;P&gt;"gonna getcha getcha getcha getcha..."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a strong suspicion that you are blonde.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, being inferior, I like the OR version the best.&lt;/P&gt;
&lt;P&gt;Though technically it should be (or (and (= (type riser) 'STR)(distof riser)) ...)&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 23:38:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/making-default-value/m-p/7618762#M111237</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2017-12-12T23:38:40Z</dc:date>
    </item>
  </channel>
</rss>

