paulosalvado Posted February 7, 2011 Posted February 7, 2011 (edited) Hello cad Gurus. How can i create multiple views quickly from the image that i attach? I have a lisp routine that creates that views but cant align the ucs to the rectangle created. The lisp that i have is this.... (Defun C:views () (Terpri) (Setq Numero (getint "Starting Number > ")) (Setq Sair 0) (Terpri) (Setq txt (getstring "txt > ")) (While (/= Sair T) (Setq Cont 0) (Terpri) (Setq Janela (car(entsel "Select view > "))) (Setq Janela (entget Janela)) (Setq Tamanho (length Janela)) (Setq X1 nil) (Setq X2 nil) (Setq Y1 nil) (Setq Y2 nil) (Setq X nil) (Setq Y nil) (While (< Cont Tamanho) (Setq Contagem (car(nth Cont Janela))) (If (= Contagem 10) (Progn (Setq X (cadr (nth Cont Janela))) (Setq Y (caddr(nth Cont Janela))) (If (= X1 nil) (Progn (Setq X1 X) ) ) (If (= Y1 nil) (Progn (Setq Y1 Y) ) ) ;************************************ (If (> X X1) (Progn (Setq X2 X) ) ) (If (< X X1) (Progn (Setq X1 X2) (Setq X1 X) ) ) ;************************************ (If (> Y Y1) (Progn (Setq Y2 Y) ) ) (If (< Y Y1) (Progn (Setq Y2 Y1) (Setq Y1 Y) ) ) ;************************************ ) ) (Setq Cont (1+ Cont)) ) (If (< Numero 10) (Progn (Setq Numero (itoa Numero)) (Setq Numero (strcat "0" Numero)) ) (Progn (Setq Numero (itoa Numero)) ) ) (Setq X (list X1 Y1)) (Setq Y (list X2 Y2)) (Command "-View") (Command "W") (Command (strcat txt " " Numero)) (Command X) (Command Y) (Setq Numero (atoi Numero)) (Setq Numero (1+ Numero)) ) ) Edited February 7, 2011 by paulosalvado Quote
Tharwat Posted February 7, 2011 Posted February 7, 2011 Please modify your code posting guideline . Read this. http://www.cadtutor.net/forum/showthread.php?9184-Code-posting-guidelines Quote
BIGAL Posted February 8, 2011 Posted February 8, 2011 Put "UCS OB Last UCS S mynewucswithnum" maybe in code as it creates each rectangle this will create a ucs for each rectangle as you go. Quote
Smirnoff Posted February 8, 2011 Posted February 8, 2011 Very fast coding but seems works. Works with polylines (rectangles) only. UCS direction by 'hand mode'. (defun c:mvu(/ cPrf cNum cEnt pLst lbPt cAng mPt xPt *error*) (vl-load-com) (defun *error*(msg) (command "_.ucs" "_w") (setvar "CMDECHO" 1) (princ "\nExit MVU") (princ) ); end princ (if (and (setq cPrf(getstring "\nSpecify view prefix: ")) (setq cNum(getint "\nSpecify first view number: ")) ); end and (progn (setvar "CMDECHO" 0) (while(setq cEnt(entsel (strcat "\nSelect rectangle for view [" (itoa cNum) "] or Spacebar to Exit > "))) (vla-GetBoundingBox (vlax-ename->vla-object(car cEnt)) 'mPt 'xPt) (vl-cmdf "_.ucs" "_w") (setq pLst(mapcar 'cdr(vl-remove-if-not '(lambda(c)(= 10(car c)))(entget(car cEnt)))) lbPt(trans(car(vl-sort pLst '(lambda(x1 x2)(<(car x1)(car x2)))))0 1) mPt(vlax-safearray->list mPt) xPt(vlax-safearray->list xPt) cAng(getangle lbPt "\nSpecify angle for X axis > ") ); end setq (if cAng (progn (vl-cmdf "_.ucs" "_z" (angtos cAng)) (command "_.zoom" "_w" (trans mPt 0 1)(trans xPt 0 1)) (command "-view" "_s" (strcat cPrf " "(itoa cNum))) (command "_.zoom" "_p") (setq cNum(1+ cNum)) ); end progn ); end if ); end while (command "_.ucs" "_w") (setvar "CMDECHO" 1) (princ "\nExit MVU") ); end progn ); end if (princ) ); and of c:mvu Quote
paulosalvado Posted February 11, 2011 Author Posted February 11, 2011 Many thanks guys Especially Smirnoff Sorry about the delay in thanking you but the work....its amazing how he replicate.... Regards Paulo Salvado Quote
Smirnoff Posted February 11, 2011 Posted February 11, 2011 You're welcome. Even if I did not then someone will always help you. If the conditions are reasonable, of course... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.