|
You should have posted PDF or DWG at first place... This explains everything, and yes it's quite tricky...
HTH, M.R.Code:(defun TUCS ( bl_name / ucsf v ) (if (= (getvar 'worlducs) 0) (progn (command "_.UCS" "_W") (setq ucsf t) ) ) (command "_.-INSERT" bl_name "\\") (while (< 0 (getvar 'cmdactive)) (command "") ) (setq v (mapcar '- '(0.0 0.0) (getvar 'lastpoint))) (command "_.MOVE" (ssget "_X") "" "_non" "@" "_non" '(0.0 0.0 0.0)) (if ucsf (progn (command "_.UCS" "_P") (command "_.UCS" "_M" "_non" (trans (mapcar '+ (trans '(0.0 0.0 0.0) 1 0) v) 0 1)) ) (command "_.UCS" "_X" 180) ) (princ) )
Its works only if Block insertion point = WCS origin. For this reason I switch minus sign with plus sign under MAPCAR functions. Please check yourself.
Its seems to works as bellow, but all that I want is a way to change the bloody line (CONS 10 what???) inside ENTMAKE function (see my code, please).
Thank you.
Code:(defun TUCS (bl_name / ucsf v) (if (= (getvar 'worlducs) 0) (progn (command "_.UCS" "_W") (setq ucsf t) ) ) (command "_.-INSERT" bl_name "\\") (while (< 0 (getvar 'cmdactive)) (command "") ) ;;(setq v (mapcar '- '(0.0 0.0 0.0) (getvar 'lastpoint))) (setq v (mapcar '+ '(0.0 0.0 0.0) (getvar 'lastpoint))) (princ "\nv=")(princ v) (command "_.MOVE" (ssget "_X") "" "_non" "@" "_non" '(0.0 0.0 0.0)) (if ucsf (progn (command "_.UCS" "_P") ;; (command "_.UCS" "_M" "_non" (trans (mapcar '+ (trans '(0.0 0.0 0.0) 1 0) v) 0 1)) (command "_.UCS" "_M" "_non" (trans (mapcar '- (trans '(0.0 0.0 0.0) 1 0) v) 0 1)) ) (command "_.UCS" "_X" 180) ) (princ) )
Well if it works now for you, I'd stick with solution... I personally think that creating temporary UCS is somewhat wrong way, especially if its name is used sometime again in some other code and you failed to eliminate it from memory or saved DWG with it... So I strongly suggest that you avoid this kind of situations and use ordinary UCS "Previous" option whenever it's possible... Memory of stored UCS is empty and no evident reasons for possible error situations are avoided... And if you plan to use saved UCS, only then it's approving if you're to eliminate it after routine execution or through error handlers in cases the code terminates in not standard way...