mdchuyen Posted August 15 Posted August 15 Thank you guys on the forum for helping me process the series like the content and wishes in the drawing I attached. Thank you Test.dwg Quote
Nikon Posted August 15 Posted August 15 @mdchuyen This lisp can replace all blocks with a horizontal one. But these blocks will have the same name as the horizontal block. replac.lsp 1 Quote
ronjonp Posted August 15 Posted August 15 (edited) For that simple example try this. Be aware that the new block names will be "P2B" rather than "P2B#" (defun c:foo (/ s) (cond ((null (tblobjname "block" "P2B")) (entmake '((0 . "BLOCK") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbBlockReference") (2 . "P2B") (10 0. 0. 0.) (70 . 0) ) ) (entmake '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (67 . 0) (8 . "DC-PHU") (100 . "AcDbPolyline") (90 . 4) (70 . 1) (43 . 0.) (38 . 0.) (39 . 0.) (10 23.87326421258058 13.68140906092549) (10 -23.87326421258058 13.6814090609255) (10 -23.87326421258058 -13.68140906092547) (10 23.87326421258058 -13.68140906092549) ) ) (entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0"))) ) ) (if (setq s (ssget ":L" '((0 . "INSERT") (2 . "P2B*")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (entmod (append (entget e) '((2 . "P2B")))) ) ) (princ) ) Edited August 15 by ronjonp 1 Quote
mdchuyen Posted August 16 Author Posted August 16 14 hours ago, Nikon said: @mdchuyen This lisp can replace all blocks with a horizontal one. But these blocks will have the same name as the horizontal block. replac.lsp 2.61 kB · 2 downloads Great, thanks for your help Quote
mdchuyen Posted August 16 Author Posted August 16 4 hours ago, ronjonp said: For that simple example try this. Be aware that the new block names will be "P2B" rather than "P2B#" (defun c:foo (/ s) (cond ((null (tblobjname "block" "P2B")) (entmake '((0 . "BLOCK") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbBlockReference") (2 . "P2B") (10 0. 0. 0.) (70 . 0) ) ) (entmake '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (67 . 0) (8 . "DC-PHU") (100 . "AcDbPolyline") (90 . 4) (70 . 1) (43 . 0.) (38 . 0.) (39 . 0.) (10 23.87326421258058 13.68140906092549) (10 -23.87326421258058 13.6814090609255) (10 -23.87326421258058 -13.68140906092547) (10 23.87326421258058 -13.68140906092549) ) ) (entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0"))) ) ) (if (setq s (ssget ":L" '((0 . "INSERT") (2 . "P2B*")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (entmod (append (entget e) '((2 . "P2B")))) ) ) (princ) ) Great, thanks for your help Quote
mdchuyen Posted August 16 Author Posted August 16 10 minutes ago, ronjonp said: Glad to help If the object is not a block but a rectangle, can you help me fix it? Quote
ronjonp Posted August 16 Posted August 16 28 minutes ago, mdchuyen said: If the object is not a block but a rectangle, can you help me fix it? Probably not sorry. Quote
BIGAL Posted August 16 Posted August 16 (edited) Try this, note you need to do the is it a block "INSERT" or a "LWPOLYLINE" choice. (defun c:wow ( / oldsnap d1 d2 plent) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 1) (while (setq pt (getpoint "\nPick control corner Enter to exit ")) (setq ss (ssget pt)) (setq plent (ssname ss 0)) (setq lay (cdr (assoc 8 (entget plent)))) (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget plent)))) (setq d1 (distance (car co-ord) (cadr co-ord))) (setq d2 (distance (cadr co-ord) (caddr co-ord))) (if (< d2 d1) (command "rectang" "D" d1 d2 pt (getvar 'extmax)) (command "rectang" "D" d2 d1 pt (getvar 'extmax)) ) (command "erase" plent "") ) (setvar 'osmode oldsnap) (princ) ) (c:wow) Edited August 16 by BIGAL 1 Quote
mdchuyen Posted August 17 Author Posted August 17 2 hours ago, BIGAL said: Try this, note you need to do the is it a block "INSERT" or a "LWPOLYLINE" choice. (defun c:wow ( / oldsnap d1 d2 plent) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 1) (while (setq pt (getpoint "\nPick control corner Enter to exit ")) (setq ss (ssget pt)) (setq plent (ssname ss 0)) (setq lay (cdr (assoc 8 (entget plent)))) (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget plent)))) (setq d1 (distance (car co-ord) (cadr co-ord))) (setq d2 (distance (cadr co-ord) (caddr co-ord))) (if (< d2 d1) (command "rectang" "D" d1 d2 pt (getvar 'extmax)) (command "rectang" "D" d2 d1 pt (getvar 'extmax)) ) (command "erase" plent "") ) (setvar 'osmode oldsnap) (princ) ) (c:wow) I want to rotate these viewports horizontally. The center of rotation is the center of this rectangle. Thank you Test1.dwg Quote
BIGAL Posted August 17 Posted August 17 (edited) Yes can be done I make layouts and use a UCS method so each mview matches the layout angle. There is walk a long a pline so rectangs rotate and other version more a copy but all rectangs horizontal. Hint (command "UCS" "Z" ang "plan" "") There is a little bit more than just take the rectang angle as shown in image above the correct title block is used for the layout generation. It normally needs a bit of customisation to suit your company so its not free but real cheap like the price of a cup of coffee. Edited August 17 by BIGAL 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.