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

vla-setvariable

2 REPLIES 2
Reply
Message 1 of 3
Patrick.De.Neef
668 Views, 2 Replies

vla-setvariable

Hi

I'm trying to set the variable GRIDUNIT via (vla-setvariable *doc* "GRIDUNIT" ...)

 

although (type (getvar "GRIDUNIT")) returns LIST, whatever I try to construct a list

(for example, (setq GRID (list 1.0 1.0)) or '( 1.0 1.0)  )

I always get an error back:

error: lisp value has no coercion to VARIANT with this type:  (1.0 1.0)

 

Any idea ?

 

Regards

Patrick

2 REPLIES 2
Message 2 of 3
phanaem
in reply to: Patrick.De.Neef

There are 2 ways to invoke a method:

(vla-method <vla-object> argument1 ... )

(vlax-invoke <vla-object> method argument1..)

 

In your case, use one of the following:

(vla-setvariable
  *doc*
  "GRIDUNIT"
  (vlax-make-variant
    (vlax-safearray-fill
      (vlax-make-safearray
        vlax-vbDouble
        '(0 . 1)
      )
      (list 1.0 1.0)
    )
  )
)

 or

 

(vlax-invoke *doc* 'setvariable "GRIDUNIT" (list 2.0 2.0))

 

 

 

Message 3 of 3

Maybe there's some reason behind the scenes that you need to involve all those VL... elements [the document, invoking a method, possibly variant & safearray], but if not, you could simply do this:

 

(setvar 'gridunit '(1 1))

Kent Cooper, AIA

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

Post to forums  

Autodesk Design & Make Report

”Boost