change image height

change image height

Anonymous
Not applicable
613 Views
4 Replies
Message 1 of 5

change image height

Anonymous
Not applicable

I was attempting to increase an image's height by 2% with the code below, and I am getting 

error: ActiveX Server returned an error: Type mismatch 

 

 

Anybody know why?

 

(defun c:12 ()
  (setq e (car (entsel " select image "))
    ob (vlax-ename->vla-object e)
    y (vla-get-height ob)
   newy (* y 1.02)
  )
(vla-put-height ob newy)
)

0 Likes
Accepted solutions (1)
614 Views
4 Replies
Replies (4)
Message 2 of 5

Ajilal.Vijayan
Advisor
Advisor
Accepted solution

Hi,

Try the imageheight instead of height

Click the +sign to see the Code

Spoiler
 
(defun c:12 ()
  (setq e (car (entsel " select image "))
    ob (vlax-ename->vla-object e)
    y (vla-get-imageheight ob)
   newy (* y 1.02)
  )
(vla-put-imageheight ob newy)
)
Message 3 of 5

Lineabove
Collaborator
Collaborator

Ajilal, to make the lisp more flexible is it possible to prompt for the value you wish to increase the image ?

 

Mel

0 Likes
Message 4 of 5

Ajilal.Vijayan
Advisor
Advisor

Mel,

Yes use the (getint) function to prompt for an integer value and save the input to a variable.

Click the +sign to see the Code

Spoiler
 
(defun c:12 ( / e ob y hgt newy)
(setq e (car (entsel " \nselect image :"))
hgt (getint "\nEnter percentage of height to increase:")
ob (vlax-ename->vla-object e)
y (vla-get-imageheight ob)
newy (* y hgt)
);setq
(vla-put-imageheight ob newy)
);defun
Message 5 of 5

Lineabove
Collaborator
Collaborator

Thank you Ajilal.

 

This lisp is very useful.

0 Likes