Search the Community
Showing results for tags 'vpclip'.
-
Rectangle to viewports LISP help:How do you increase the overall scale of a viewport.
3dwannab posted a topic in AutoLISP, Visual LISP & DCL
See screenshot of what my routine does. It creates new vports from closed LWpolylines and locks them. I just don't know how to do the same as this below. GIF of Routine: CODE: ;; ----------------------=={ VP_Clip_All_LWPS }==------------------------- ;; ----------------------------------------------------------------------- ;; AUTHOR & ADDITIONAL CODE ;; Author: 3dwannab, Copyright © 2018. ;; Error functions: LeeMac Help pages. www.lee-mac.com. ;; ABOUT / NOTES ;; Creates new VIEWPORT/s from existing closed LWPOLYLINE/s. ;; FUNCTION SYNTAX ;; Short-cut VP_CALLS ;; Long-cut VP_Clip_All_LWPS ;; VERSION DATE INFO ;; Version 1.0 27-07-2018 Initial release. ;; TO DO LIST ;; Increase the overall scale of the VIEWPORT from 1:20 to 1:2 for example. ;; ----------------------------------------------------------------------- ;; ------------------=={ VP_Clip_All_LWPS START }==----------------------- (defun c:---VP_Clip_All_LWPS (/) (progn (LOAD "VP_Clip_All_LWPS") (C:VP_Clip_All_LWPS))) (defun c:VP_CALLS () (c:VP_Clip_All_LWPS)) (defun c:VP_Clip_All_LWPS (/ ent_vp i ss_1 var_cmde var_os y ) (setq *error* LM:error) (LM:startundo) (setq var_cmde (getvar "cmdecho")) (setq var_os (getvar "osmode")) (setvar 'cmdecho 0) (setvar 'osmode 0) (cond ((> (getvar 'CVPORT) 1) (princ "\n ** Command not allowed in Model Tab ** ")) ( (while (not (and (setq ent_vp (car (entsel "\nPlease select 1 VIEWPORT,\nthen any closed LWPOLYLINES within to create\nnew VPs from\n: --------------------------------------------------------- :\n")) ent_vp_data (if ent_vp (entget ent_vp)) ) (= (cdr (assoc 0 ent_vp_data)) "VIEWPORT") (progn (if (setq ss_1 (ssget '((0 . "LWPOLYLINE") (-4 . "=") (70 . 1)))) (progn (command "_.vports" "_lock" "_on" ent_vp "") (command "_.copybase" '(0 0) ent_vp "") (entdel ent_vp) (repeat (setq i (sslength ss_1)) (command "_.pasteclip" "_non" '(0 0)) (setq ent_last (entlast)) (command "_.vpclip" ent_last (ssname ss_1 (setq i (1- i)))) ) (repeat (setq y (sslength ss_1)) (command "_.vpclip" (ssname ss_1 (setq y (1- y))) "_D") ) ) (progn (princ "\n*** Nothing Selected ***\n")(princ) ) ) ) ) ) (princ (strcat "\n >>> " (itoa (setq ss_1_len (sslength ss_1))) (if (> ss_1_len 1) " new viewports have been created" " new viewport has been created") " <<< \n")) ) ) ) (*error* nil)(princ) (princ) ) ;; ----------------------------------------------------------------------- ;; ---------------------=={ Functions START }==--------------------------- (vl-load-com) (defun LM:error (errmsg) (and acDoc (vla-EndUndoMark acDoc)) (and errmsg (not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*")) (princ (strcat "\n<< Error: " errmsg " >>\n")) ) (setvar 'cmdecho var_cmde) (setvar 'osmode var_os) ) (princ) (defun LM:startundo () (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc)) ) (princ) ;; ----------------------------------------------------------------------- ;; -----------------------=={ Functions END }==-- ------------------------ (princ "\nVP_Clip_All_LWPS.lsp loaded | Version 1.0 | by 3dwannab.\n") (princ "\nType \"VP_Clip_All_LWPS\" OR \"VP_CALLS\" to run.\n") (princ) ;; ----------------------------------------------------------------------- ;; --------------------=={ VP_Clip_All_LWPS END }==----------------------- ;; EOL