Code Red > AutoLISP (Vanilla / Visual)
scale image from center
PM:
Hi i use this code to scale images in layout for specific scales. The problem is that when i do the scale the image moves. Is it possible to scale from the center ?
--- Code - Auto/Visual Lisp: --- (defun c:myimgscale (/) (TEXTPAGE) (princ "\n")(princ "\n")(princ "\n")(progn (initget "1 2 3") (setq l (cond ((getkword "\nslelect image 1:1 : 1. for scale 1:500. 2. for scale 1:1000. 3. for scale 1:5000. " ) ) ("1") ) ) (if (eq l "1") ((lambda (/ ent) (while (not (setq ent (car (entsel))))) (command "_scale" ent "" (cdr (assoc 11 (entget ent))) 2) );end wile ); end lambda ); end if (if (eq l "2") ((lambda (/ ent) (while (not (setq ent (car (entsel))))) (command "_scale" ent "" (cdr (assoc 11 (entget ent))) 1) );end wile ); end lambda ); end if ((lambda (/ ent) (while (not (setq ent (car (entsel))))) (command "_scale" ent "" (cdr (assoc 11 (entget ent))) 0.2) );end wile ); end lambda ); end if ) ; end if
Thanks
ribarm:
Calculate center point and then provide that point to scale command...
PM:
I find a Lee Mac code.
--- Code - Auto/Visual Lisp: ---;; Scale About Center - Lee Mac (defun c:sac ( / ll sel obj ur ) (initget 6) (if (and (setq *scl* (cond ( (getdist (strcat "\nSpecify Scale Factor" (if *scl* (strcat " <" (rtos *scl* 2) ">: ") ": ")))) ( *scl* ) ) ) (ssget "_:L") ) (progn (vlax-for obj (setq sel (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))) (if (null (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'll 'ur)))) (vla-scaleentity obj (vlax-3D-point (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) (vlax-safearray->list ll) (vlax-safearray->list ur) ) ) *scl* ) ) ) (vla-delete sel) ) ) (princ))(vl-load-com) (princ)
can any one help to add this option menu with the specific scales from the previous code?
--- Code - Auto/Visual Lisp: --- (TEXTPAGE) (princ "\n")(princ "\n")(princ "\n")(progn (initget "1 2 3") (setq l (cond ((getkword "\nslelect image 1:1 : 1. for scale 1:500. 2. for scale 1:1000. 3. for scale 1:5000. " ) ) ("1") ) )
Thanks
BIGAL:
Try this it will make a dcl for you look at ans. There is examples at the top of the code, perfect for this type of "please choose".
--- Code: ---(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(if (not but)(setq but 1))
(setq ans (ah:butts but "V" '("Choose scale 1:X " " 100" " 200" " 300" " 400" " 500" )))
--- End code ---
PM:
HI BIGAL. i confused now. Can any one do the changes in post 3 ?
Thanks
Navigation
[0] Message Index
[#] Next page
Go to full version