AutoCAD Map 3D Developer

Reply
Contributor
Posts: 11
Registered: ‎10-29-2012
Message 1 of 5 (234 Views)

lisp safearray help

234 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
Posts: 542
Registered: ‎06-09-2009
Message 2 of 5 (223 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
Posts: 11
Registered: ‎10-29-2012
Message 3 of 5 (217 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
Posts: 11
Registered: ‎10-29-2012
Message 4 of 5 (203 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
Posts: 11
Registered: ‎10-29-2012
Message 5 of 5 (202 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. '

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community