hi..i need help crating safearrays in lisp...i tried everything but can't get it to work...here is an example, and when i run it i get a message *bad argument type: fixnump: nil*
thanx for any help!
(defun c:prb(/ datah count hdist)
(vl-load-com)
(setq datah(vlax-make-safearray vlax-vbDouble '(0.3)))
(setq count 1)
(setq hdist 10)
(vlax-safearray-put-element datah count hdist)
(princ (vlax-safearray->list datah))
)
Hi,
Try this :
; create 5 lines which will make up a self-intersecting region
(setq lineObj1 (vla-AddLine mspace (vlax-3d-point '( 0.0 0.0 0.0)) (vlax-3d-point '(20.0 20.0 0.0))))
(setq lineObj2 (vla-AddLine mspace (vlax-3d-point '(20.0 20.0 0.0)) (vlax-3d-point '(10.0 0.0 0.0))))
(setq lineObj3 (vla-AddLine mspace (vlax-3d-point '(10.0 0.0 0.0)) (vlax-3d-point '(20.0 0.0 0.0))))
(setq lineObj4 (vla-AddLine mspace (vlax-3d-point '(20.0 0.0 0.0)) (vlax-3d-point '(10.0 20.0 0.0))))
(setq lineObj5 (vla-AddLine mspace (vlax-3d-point '(10.0 20.0 0.0)) (vlax-3d-point '( 0.0 0.0 0.0))))
(setq objArray (vlax-make-safearray vlax-vbObject '(0 . 4)))
(vlax-safearray-fill objArray (list lineObj1 lineObj2 lineObj3 lineObj4 lineObj5))
Does it help ?
Thanks,
that haven't worked,now i get 'bad argument type: VLA-OBJECT nil'....
obviously the line in which is safearray created is not creating....
is there something that needs to be loaded or something to work with safearrays...
ok, so i menaged to make safearray by spacing numbers from dot in between
so now is the problem i can't pass any variable arguments to vlax-safearray-put-element function, i can pass numbers but not variables(like count and hdist in my example), why is that?
ok,so i solved that too so now the problem is fill
(defun c:vla(/ point)
(vl-load-com)
(setq point (vlax-make-safearray vlax-vbDouble '(0 . 12)))
(setq count 1)
(setq hdist 10)
(vlax-safearray-put-element point count hdist)
(vlax-safearray-fill point '(1 2 3 4))
(vlax-safearray->list point)
)
when i run it i get 'vlax-safearray-fill failed. Invalid initialization list. '
Can't find what you're looking for? Ask the community or share your knowledge.