some functions simply aren't working. in ACAD 2k4

Discussion in 'AutoCAD' started by kemp, Dec 22, 2003.

  1. kemp

    kemp Guest

    I am having trouble getting some functions to work, even if I simply cut and
    paste the examples in the autoLisp reference. Take for example:
    (setq mycircle (vla-addCircle mSpace (vlax-3d-point '(3.0 3.0 0.0)) 2.0))
    results in this:
    ; error: bad argument type: VLA-OBJECT nil

    I do set (vla-load-com) first. If I run the vlax-3d-point.... on it's own it
    returns #<variant 8197 ...> like the documentation says it should. I've
    tried cut and paste on several variations of this with the same results.

    What am I doing wrong? Other VLA objects are working....and I've unloaded
    all my custom menus and lisps to see if there was some kind of
    conflict...and I've tried this on several computers here all using ACAD 2004

    Any ideas? Thanks

    kemp
     
    kemp, Dec 22, 2003
    #1
  2. Jimmy Bergmark, Dec 22, 2003
    #2
  3. kemp

    kemp Guest

    I did not set mSpace, but now that I have the results are the same. No
    errors came from setting mSpace though. Just when I run the vla-getCircle
    method. The results are the same if I use the (vlax-invoke-method mspace
    'addcircle..... method too

    Hope someone knows what else I am screwing up.

    Thanks,
    kemp
     
    kemp, Dec 22, 2003
    #3
  4. kemp

    R.K. McSwain Guest

    What about this?

    (vl-load-com)
    (setq mycircle (vla-addcircle
    (vlax-get (vlax-get (vlax-get-acad-object) "ActiveDocument")
    "ModelSpace"
    )
    (vlax-3d-point '(3.0 3.0 0.0))
    2.0
    )
    )
     
    R.K. McSwain, Dec 22, 2003
    #4
  5. kemp

    kemp Guest

    This does work. Hopefully I can port this method to all the others that
    don't.

    Thanks,
    kemp

    What about this?

    (vl-load-com)
    (setq mycircle (vla-addcircle
    (vlax-get (vlax-get (vlax-get-acad-object) "ActiveDocument")
    "ModelSpace"
    )
    (vlax-3d-point '(3.0 3.0 0.0))
    2.0
    )
    )
     
    kemp, Dec 22, 2003
    #5
  6. kemp

    R.K. McSwain Guest

    Same as:

    (setq acadobject (vlax-get-acad-object))
    (setq activedoc (vlax-get acadobject "ActiveDocument"))
    (setq modelspc (vlax-get activedoc "ModelSpace"))
    (setq mycircle (vla-addcircle modelspc (vlax-3d-point '(3.0 3.0 0.0)) 2.0 ))

    The reason it wasn't working before is one of your objects was not set.
    Start at the top of the object model and work your way down to the desired object/property/method.
     
    R.K. McSwain, Dec 22, 2003
    #6
  7. kemp

    kemp Guest

    Thanks for the information. After toiling with this lisp routine all day it
    finally works due to the information I recieved from you all. I appreciate
    it.

    Thanks a bunch,
    kemp

    Same as:

    (setq acadobject (vlax-get-acad-object))
    (setq activedoc (vlax-get acadobject "ActiveDocument"))
    (setq modelspc (vlax-get activedoc "ModelSpace"))
    (setq mycircle (vla-addcircle modelspc (vlax-3d-point '(3.0 3.0 0.0)) 2.0 ))

    The reason it wasn't working before is one of your objects was not set.
    Start at the top of the object model and work your way down to the desired
    object/property/method.
     
    kemp, Dec 23, 2003
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.