AutoCAD Map 3D Developer

AutoCAD Map 3D Developer

Reply
Contributor
tomislav.vargek
Posts: 11
Registered: ‎10-29-2012
Message 1 of 5 (255 Views)

lisp safearray help

255 Views, 4 Replies
10-29-2012 06:56 AM

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:smileytongue:rb(/ 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))
)

 

ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 2 of 5 (244 Views)

Re: lisp safearray help

10-31-2012 07:53 AM in reply to: tomislav.vargek

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

Contributor
tomislav.vargek
Posts: 11
Registered: ‎10-29-2012
Message 3 of 5 (238 Views)

Re: lisp safearray help

11-03-2012 02:47 AM in reply to: tomislav.vargek

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

Contributor
tomislav.vargek
Posts: 11
Registered: ‎10-29-2012
Message 4 of 5 (224 Views)

Re: lisp safearray help

11-07-2012 06:34 AM in reply to: tomislav.vargek

ok, so i menaged to make safearray by spacing numbers from dot in between :smileyembarrassed:

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?

Contributor
tomislav.vargek
Posts: 11
Registered: ‎10-29-2012
Message 5 of 5 (223 Views)

Re: lisp safearray help

11-07-2012 06:46 AM in reply to: tomislav.vargek

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

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.