Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dang conversion from lisp to ActiveX

1 REPLY 1
Reply
Message 1 of 2
Anonymous
183 Views, 1 Reply

Dang conversion from lisp to ActiveX

I'm trying to convert a list of strings to an array that I can pass to a
.Net DLL. I get the following error:

Program error - lisp value has no coercion to VARIANT with this type:
#

when I use the following code:

(setq out (vlax-invoke-method
vbstrcls
"DrawBiFold"
$acad
fname
sc
(car mod_ins)
(cadr mod_ins)
(- unitID 1)
(gp:list->variantArray dim_list)
) ;_ end of vlax-invoke-method
) ;_ end of setq

(defun gp:list->variantArray (strList / arraySpace sArray)
; allocate space for an array of 2d points stored as doubles
(setq arraySpace (vlax-make-safearray
vlax-vbstring ; element type
(cons 0
(- (length strList) 1)
) ; array dimension
)
)
(setq sArray (vlax-safearray-fill arraySpace strList))
; return array variant
(vlax-make-variant sArray)
)

Can anyone see what I'm doing wrong?

Thanks,

Dale
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

BTW:

DIM_LIST = ("dod" "god" "mfd" "ord")

Dale


"Dale Levesque" wrote in message
news:5023950@discussion.autodesk.com...
I'm trying to convert a list of strings to an array that I can pass to a
.Net DLL. I get the following error:

Program error - lisp value has no coercion to VARIANT with this type:
#

when I use the following code:

(setq out (vlax-invoke-method
vbstrcls
"DrawBiFold"
$acad
fname
sc
(car mod_ins)
(cadr mod_ins)
(- unitID 1)
(gp:list->variantArray dim_list)
) ;_ end of vlax-invoke-method
) ;_ end of setq

(defun gp:list->variantArray (strList / arraySpace sArray)
; allocate space for an array of 2d points stored as doubles
(setq arraySpace (vlax-make-safearray
vlax-vbstring ; element type
(cons 0
(- (length strList) 1)
) ; array dimension
)
)
(setq sArray (vlax-safearray-fill arraySpace strList))
; return array variant
(vlax-make-variant sArray)
)

Can anyone see what I'm doing wrong?

Thanks,

Dale

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost