<?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: VLA-OBJECT nil in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566432#M111835</link>
    <description>You only need the (vl-load-com) once per session. There is no need to execute it over and over. Having said that, it's not going to hurt anything.&lt;BR /&gt;&lt;BR /&gt;The error you mention simply means that a function is not being supplied a valid VLA-Object as an argument.&lt;BR /&gt;&lt;BR /&gt;Are you editing this in the VLIDE? If so, you can trace the error when it happens and it will be fairly clear.</description>
    <pubDate>Wed, 22 Nov 2017 19:36:40 GMT</pubDate>
    <dc:creator>rkmcswain</dc:creator>
    <dc:date>2017-11-22T19:36:40Z</dc:date>
    <item>
      <title>VLA-OBJECT nil</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566346#M111833</link>
      <description>&lt;P&gt;Hello All,&lt;BR /&gt;&lt;BR /&gt;I'm pretty new to VLA but it seems like a powerful tool in autolisp so I'm trying to learn.&lt;BR /&gt;&lt;BR /&gt;The LISP I've been working on is meant to give a dimension from centreline (origin point) to the user selected point, and then through VLA it changes various properties of the dimension. Sometimes it works flawlessly and for seemingly no reason, other times it gives me the "error: bad argument type: VLA-OBJECT nil".&lt;BR /&gt;&lt;BR /&gt;Could anyone shed some light on why this sometimes works and sometimes doesn't?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun C:OCL ()
                (setq pt1 
                                (getpoint "\nChoose a Point : ")
                )
                (setq pt2
                                (trans '(0 0 0) 0 1)
                )
                (setq x1
                                (car pt1)
                )
                (setq y1
                                (cadr pt1)
                )
                (setq z1
                                (caddr pt1)
                )
                (setq x
                                (car pt2)
                )
                (setq y
                                (cadr pt2)
                ) 
                (setq z 
                                (caddr pt2)
                )

                (setq li0
                                (list x y1 z1)
                )
                (command "DIMLINEAR" pt1 li0 pause)
                (command "_CHPROP" "LAST" "" "A" "YES" "")
                (command "SELECT" "LAST" "")
                (vl-load-com)
                (vlax-for oDim
                                (setq ss  
                                                (vla-get-activeselectionset *activeDoc*)
                                )
                                (vla-put-textoverride oDim "&amp;lt;&amp;gt; OCL")
                                (vla-put-HorizontalTextPosition oDim acFirstExtensionLine)
                                (vla-put-Arrowhead2Type oDim acArrowNone)
                                (vla-put-ExtLine2Suppress oDim :vlax-true)
                                (vla-put-DimLine2Suppress oDim :vlax-true)
                                (vla-put-ArrowheadSize oDim 2.5)
                                (vla-put-ExtensionLineExtend oDim 1.5)
                                (vla-put-ExtensionLineOffset oDim 2.5)
                                (vla-put-TextHeight oDim 2.5)
                                (vla-put-textgap oDim 0.8)
                )
                (princ)
)&lt;/PRE&gt;&lt;P&gt;Also,&lt;BR /&gt;&lt;BR /&gt;Is there a way to change 'Annotative Scale' on a dimension through VLA or LISP?&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Tyler&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 19:12:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566346#M111833</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-22T19:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: VLA-OBJECT nil</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566426#M111834</link>
      <description>&lt;P&gt;You have the global variable *activedoc* which if not available can cause the error sometimes. Maybe redefine the&amp;nbsp;variable in the code&lt;/P&gt;
&lt;PRE&gt;................
............ (setq *activedoc* (vla-get-activedocument (vlax-get-acad-object)))..
......&lt;/PRE&gt;
&lt;P&gt;If the code still faisl it could be that it cannot retrieve the activeselectionset? Try setting the oDim object right after after creating the dimension&lt;/P&gt;
&lt;PRE&gt;(setq oDim (vlax-ename-&amp;gt;vla-object (entlast)))&lt;/PRE&gt;
&lt;P&gt;You don't need a selectionset since you are dealing with only one entity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For changing annotative scale, look into &lt;EM&gt;&lt;STRONG&gt;-objectscale &lt;/STRONG&gt;&lt;/EM&gt;command.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 19:35:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566426#M111834</guid>
      <dc:creator>Ranjit_Singh</dc:creator>
      <dc:date>2017-11-22T19:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: VLA-OBJECT nil</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566432#M111835</link>
      <description>You only need the (vl-load-com) once per session. There is no need to execute it over and over. Having said that, it's not going to hurt anything.&lt;BR /&gt;&lt;BR /&gt;The error you mention simply means that a function is not being supplied a valid VLA-Object as an argument.&lt;BR /&gt;&lt;BR /&gt;Are you editing this in the VLIDE? If so, you can trace the error when it happens and it will be fairly clear.</description>
      <pubDate>Wed, 22 Nov 2017 19:36:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566432#M111835</guid>
      <dc:creator>rkmcswain</dc:creator>
      <dc:date>2017-11-22T19:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: VLA-OBJECT nil</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566513#M111836</link>
      <description>&lt;P&gt;Not positive, but I don't think&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (command "SELECT" "LAST" "")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;leaves that selection "active."&amp;nbsp; What happens if you replace that with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (sssetfirst nil (ssget "L"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which will leave it selected/highlighted/gripped, and therefore I hope what it would consider "active"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 20:06:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566513#M111836</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-11-22T20:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: VLA-OBJECT nil</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566652#M111837</link>
      <description>&lt;P&gt;Hi Ranjit,&lt;BR /&gt;&lt;BR /&gt;Thanks for the speedy response.&lt;BR /&gt;&lt;BR /&gt;How would I go about redefining a global variable through the code (I have very limited coding experience)?&lt;BR /&gt;&lt;BR /&gt;I think you're correct in this line causing the error. It doesnt seem to have issues getting the active selection set, it works properly in some dwg files, and not in others.&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 21:04:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566652#M111837</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-22T21:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: VLA-OBJECT nil</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566659#M111838</link>
      <description>&lt;P&gt;Hi McSwain,&lt;BR /&gt;&lt;BR /&gt;I haven't even heard of VLIDE, but i will most definitely check it out! all of my editing right now is done in notepad. probably a very poor decision.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Tyler&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 21:07:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566659#M111838</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-22T21:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: VLA-OBJECT nil</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566683#M111839</link>
      <description>&lt;P&gt;I thought I already specified it, but here it is again in your code&lt;/P&gt;
&lt;PRE&gt;(defun c:ocl  ()
 (setq pt1 (getpoint "\nChoose a Point : "))
 (setq pt2 (trans '(0 0 0) 0 1))
 (setq x1 (car pt1))
 (setq y1 (cadr pt1))
 (setq z1 (caddr pt1))
 (setq x (car pt2))
 (setq y (cadr pt2))
 (setq z (caddr pt2))
 (setq li0 (list x y1 z1))
 (command "DIMLINEAR" pt1 li0 pause)
 (command "_CHPROP" "LAST" "" "A" "YES" "")
 (command "SELECT" "LAST" "")
 (vl-load-com)
 (vlax-for odim  (setq ss (vla-get-activeselectionset &lt;FONT color="#0000ff"&gt;(setq *activedoc* (vla-get-activedocument (vlax-get-acad-object)))&lt;/FONT&gt;))
  (vla-put-textoverride odim "&amp;lt;&amp;gt; OCL")
  (vla-put-horizontaltextposition odim acfirstextensionline)
  (vla-put-arrowhead2type odim acarrownone)
  (vla-put-extline2suppress odim :vlax-true)
  (vla-put-dimline2suppress odim :vlax-true)
  (vla-put-arrowheadsize odim 2.5)
  (vla-put-extensionlineextend odim 1.5)
  (vla-put-extensionlineoffset odim 2.5)
  (vla-put-textheight odim 2.5)
  (vla-put-textgap odim 0.8))
 (princ))&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Nov 2017 21:18:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566683#M111839</guid>
      <dc:creator>Ranjit_Singh</dc:creator>
      <dc:date>2017-11-22T21:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: VLA-OBJECT nil</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566742#M111840</link>
      <description>&lt;P&gt;Thank you so much Ranjit! The combination of redefining the *activedoc* variable, as well setting the odim and not using the selection set seems to have sorted out the issue.&lt;BR /&gt;&lt;BR /&gt;Cheers.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 21:46:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-object-nil/m-p/7566742#M111840</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-22T21:46:33Z</dc:date>
    </item>
  </channel>
</rss>

