AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

lisp safearray help

4 REPLIES 4
Reply
Message 1 of 5
tomislav_vargek
672 Views, 4 Replies

lisp safearray help

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))
)

 

4 REPLIES 4
Message 2 of 5

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,



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Message 3 of 5

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...

Message 4 of 5

ok, so i menaged to make safearray by spacing numbers from dot in between Smiley Embarassed

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?

Message 5 of 5

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.

Post to forums  

”Boost