<?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 error: no function definition: nil - on condition in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-no-function-definition-nil-on-condition/m-p/7645287#M110660</link>
    <description>&lt;P&gt;Hi everyone,&lt;BR /&gt;&lt;BR /&gt;In my current cad setup I have a few layers that populate automatically when a new drawing is created - this includes two layers "0_DIM" and "0_TEXT" which should only be active in the first viewport on the first sheet. In my viewport creation lisp theres a bit of code to create a new dimension layer and text layer specific to that viewport. This is based on layout names (SHT 01, SHT 02 etc..) and the CVPORT value.&lt;BR /&gt;&lt;BR /&gt;The code below is meant to decide which of these layers should be active before the dimension is created. The bottom portion with semicolons was what i had originally and worked for all viewports apart from the first one on the first sheet. I added the condition to account for this but always end up with the same error (error: no function definition: nil).&lt;BR /&gt;&lt;BR /&gt;I must have messed up somewhere with the condition, if anyone could lend a hand to fix this bit of code I would appreciate it very much!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;(defun C:DL ()
	(setq CVP
		 (getvar "CVPORT")
	)
	(setq CV0
		(rtos (- CVP 2) 2 0)
	)
	(setq SHT0
		(getvar "CTAB")
	)
	(setq SHT1
		(substr SHT0 6)
	)
	(cond
		((and(= SHT1 "1")(= CVP "2"))(setq LAY0 ("0_DIM"))(setq LAY1 ("0_TEXT")))
		(not((and(= SHT1 "1")(= CVP "2"))(setq LAY0(strcat "S0" SHT1 "V0" CV0 "-DIM"))(setq LAY1(strcat "S0" SHT1 "V0" CV0 "-TXT"))))
	)
;	(setq LAY0
;		(strcat "S0" SHT1 "V0" CV0 "-DIM")
;	)
;	(setq LAY1
;		(strcat "S0" SHT1 "V0" CV0 "-TXT")
;	)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Dec 2017 18:17:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-12-22T18:17:14Z</dc:date>
    <item>
      <title>error: no function definition: nil - on condition</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-no-function-definition-nil-on-condition/m-p/7645287#M110660</link>
      <description>&lt;P&gt;Hi everyone,&lt;BR /&gt;&lt;BR /&gt;In my current cad setup I have a few layers that populate automatically when a new drawing is created - this includes two layers "0_DIM" and "0_TEXT" which should only be active in the first viewport on the first sheet. In my viewport creation lisp theres a bit of code to create a new dimension layer and text layer specific to that viewport. This is based on layout names (SHT 01, SHT 02 etc..) and the CVPORT value.&lt;BR /&gt;&lt;BR /&gt;The code below is meant to decide which of these layers should be active before the dimension is created. The bottom portion with semicolons was what i had originally and worked for all viewports apart from the first one on the first sheet. I added the condition to account for this but always end up with the same error (error: no function definition: nil).&lt;BR /&gt;&lt;BR /&gt;I must have messed up somewhere with the condition, if anyone could lend a hand to fix this bit of code I would appreciate it very much!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;(defun C:DL ()
	(setq CVP
		 (getvar "CVPORT")
	)
	(setq CV0
		(rtos (- CVP 2) 2 0)
	)
	(setq SHT0
		(getvar "CTAB")
	)
	(setq SHT1
		(substr SHT0 6)
	)
	(cond
		((and(= SHT1 "1")(= CVP "2"))(setq LAY0 ("0_DIM"))(setq LAY1 ("0_TEXT")))
		(not((and(= SHT1 "1")(= CVP "2"))(setq LAY0(strcat "S0" SHT1 "V0" CV0 "-DIM"))(setq LAY1(strcat "S0" SHT1 "V0" CV0 "-TXT"))))
	)
;	(setq LAY0
;		(strcat "S0" SHT1 "V0" CV0 "-DIM")
;	)
;	(setq LAY1
;		(strcat "S0" SHT1 "V0" CV0 "-TXT")
;	)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 18:17:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-no-function-definition-nil-on-condition/m-p/7645287#M110660</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-22T18:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: error: no function definition: nil - on condition</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-no-function-definition-nil-on-condition/m-p/7645334#M110661</link>
      <description>&lt;P&gt;Try changing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp; (&lt;/FONT&gt;not&lt;FONT color="#ff0000"&gt;((&lt;/FONT&gt;and&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;&amp;nbsp; ((&lt;/STRONG&gt;&lt;/FONT&gt;not &lt;FONT color="#008000"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;and&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and having only &lt;EM&gt;three&lt;/EM&gt; right parentheses at the end of that line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#ff6600"&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; Come to think of it, you don't need that (not) test -- if the first condition is not satisfied, then its &lt;EM&gt;not&lt;/EM&gt;&amp;nbsp; being true is a given, and you can just do the other stuff as the fall-back none-of-the-above condition:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (&lt;FONT color="#008000"&gt;&lt;STRONG&gt;T&lt;/STRONG&gt;&lt;/FONT&gt; (setq LAY0 ....&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 18:39:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-no-function-definition-nil-on-condition/m-p/7645334#M110661</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-12-22T18:39:31Z</dc:date>
    </item>
  </channel>
</rss>

