프로그램
캐드 분류

스케일 조정 리습 문의입니다.

컨텐츠 정보

본문

안녕하십니까. 새해 복 많이 받으시길 바랍니다.

첨부된 리습은 여러개의 객체를 선택해서 스케일을 일괄로 조정하는 리습입니다만, 특징이 선택 객체별 위치에서 스케일이 조정된다는 점입니다. 그래서 유용하게 사용중인데

cad2015(64비트)에서 작동을 안하고 오류 메세지가 뜨네요

혹 수정 가능하신가요?

– 아래는 리습 전문입니다.
;; ScaleAboutCenters.lsp [command name: SAC]
;; To Scale multiple objects, each About its own Center, by the same User-specified
;; scale factor.
;; Uses the middle of each object’s bounding box as the base point for scaling, to
;; keep objects centered at approximately the same position in the drawing.
;; [For Mtext, that will be based on the defined Mtext box width, not the extents
;; of the content; for a Block or Text, the center of its extents in the drawing, not
;; its insertion point; for an Arc, the center of its extents, not its geometric center;
;; some entity types’ (e.g. Spline’s) bounding box can sometimes reach beyond
;; its extents and affect results slightly.]
;; Rejects selection of objects on locked Layers, or without a “center” [Rays, Xlines].
;; Stores scale factor; offers as default on subsequent use in same editing session.
;; Kent Cooper, 6 May 2014

(defun C:Sca (/ *error* cmde ss inc ent)
(defun *error* (errmsg)
(if (not (wcmatch errmsg “Function cancelled,quit / exit abort,console break”))
(princ (strcat “nError: ” errmsg))
); end if
(command “_.undo” “_end”)
(setvar ‘cmdecho cmde)
(princ)
); end defun – *error*
(setq cmde (getvar ‘cmdecho))
(setvar ‘cmdecho 0)
(command “_.undo” “_begin”)
(setq *SACscl
(cond
( (getreal
(strcat
“nEnter Scale Factor : ”
); strcat
); getreal
); User-input condition
(*SACscl); Enter on subsequent use [prior value]
(1); Enter on first use
); cond & *SACscl
ss (ssget “:L” ‘((-4 . “”)))
;; not objects on Locked Layers or without finite extents
); setq
(repeat (setq inc (sslength ss))
(setq ent (ssname ss (setq inc (1- inc))))
(vla-getboundingbox (vlax-ename->vla-object ent) ‘minpt ‘maxpt)
(command
“.scale” ent “” “_none”
(mapcar ‘/ ; midpoint of bounding box
(mapcar ‘+ (vlax-safearray->list minpt) (vlax-safearray->list maxpt))
‘(2 2 2)
); mapcar
*SACscl
); command
); repeat
(command “_.undo” “_end”)
(setvar ‘cmdecho cmde)
(princ)
); defun
(vl-load-com)
(prompt “nType SAC to Scale objects About each one’s Center”)

관련자료

댓글 2 / 1 페이지

penpen07님의 댓글

(defun C:SAC (/ *error* cmde ss inc ent) (defun *error* (errmsg) (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break")) (princ (strcat "nError: " errmsg)) ) (command-s "_.undo" "_end") (setvar 'cmdecho cmde) (pri nc) ) (setq cmde (getvar 'cmdecho)) (setvar 'cmdecho 0) (command "_.undo" "_begin") (setq *SACscl (cond ( (getreal (strcat "nEnter Scale Factor <" (if *SACscl (rtos *SACscl 2 4) "1") ">: " )) ) (*SACscl) (1) ) ) (setq ss (ssget ":L" '((-4 . "")))) (repeat (setq inc (sslength ss)) (setq ent (ssname ss (setq inc (1- inc)))) (vla-getboundingbox (vlax-ename->vla-object ent) 'minpt 'maxpt) (command ".scale" ent "" "_none" (mapcar '/ (mapcar '+ (vlax-safearray->list minpt) (vlax-safearray->list maxpt)) '(2 2 2) ) *SACscl ) ) (command "_.undo" "_end") (setvar 'cmdecho cmde) (princ) )

 

error handling에는 command를 쓸 수 없어요.

전체 82 / 1 페이지
RSS
번호
제목
이름
알림 0