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

kemp

Usenet Archive
Joined
Dec 18, 2003
Messages
142
Reaction score
0
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
 
Have you set mSpace to (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
 
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
 
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
)
)
 
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
)
)
 
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.
 
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.
 

Member Recommended

QuickCAD 8
Price
–
Change
–
Autocad "Lite" RobbieB ·
Data Converters
Price
$103
Change
0%
Back
Top