pmadhwal7 Posted March 20, 2023 Posted March 20, 2023 Hi, all 1.is any body know how to turn Display objects in Viewport yes or no in all layouts in one single command or through lisp, 2.after hiding the viewports change the sheet no with reference to layout no dwg and screen shot attached Drawing1.dwg Quote
BIGAL Posted March 20, 2023 Posted March 20, 2023 Post a dwg for Q2. Need say a block with attribute. Turn certain layers on/off is the VPLAYER command, or are you talking about zooming to a certain spot in Model then setting the layout MVIEW to a scale based on that point. 1 Quote
Steven P Posted March 21, 2023 Posted March 21, 2023 Would this help: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vplayer-lisp/td-p/8106029 (Answer by BeeKee) Quote
pmadhwal7 Posted March 21, 2023 Author Posted March 21, 2023 Please see this image actually what i want to do after selecting viewport i would like to turn off or on disply object in all vieport for refernce of qustion no 2 dwg sample attached layout.dwg Quote
ronjonp Posted March 21, 2023 Posted March 21, 2023 (edited) Use a field for your text to match the layout name: And use the filter command to get all your viewports to turn them on or off in the properties palette. Or use this code: (defun c:foo (/ s) (if (setq s (ssget "_X" '((0 . "VIEWPORT") (-4 . "!=") (69 . 1)))) (foreach e (mapcar 'cadr (ssnamex s)) ;; This line needed for uninitialized tabs (setvar 'ctab (cdr (assoc 410 (entget e)))) (vlax-put (vlax-ename->vla-object e) 'viewporton 0) ) ) (princ) ) Edited March 22, 2023 by ronjonp Quote
pmadhwal7 Posted March 22, 2023 Author Posted March 22, 2023 (edited) 13 hours ago, ronjonp said: Use a field for your text to match the layout name: And use the filter command to get all your viewports to turn them on or off in the properties palette. Or use this code: (defun c:foo (/ s) (if (setq s (ssget "_X" '((0 . "VIEWPORT") (-4 . "!=") (69 . 1)))) (foreach e (mapcar 'cadr (ssnamex s)) ;; This line needed for unitialized tabs (setvar 'ctab (cdr (assoc 410 (entget e)))) (vlax-put (vlax-ename->vla-object e) 'viewporton 0) ) ) (princ) ) working but only in one layout is it possibale to do it in all layout field command add another text but i have exsiting format which is final sample is this not possibale to do it in one go throught lisp Edited March 22, 2023 by pmadhwal7 Quote
SLW210 Posted March 22, 2023 Posted March 22, 2023 See if this helps... Solved: Turn on/off all viewports on all layouts without switching layouts - Autodesk Community - AutoCAD For the CTAB, use a Find and Replace and just add the String for CTAB field. (%<\AcVar ctab \f "%tc1">%) Quote
pmadhwal7 Posted March 22, 2023 Author Posted March 22, 2023 3 hours ago, SLW210 said: See if this helps... Solved: Turn on/off all viewports on all layouts without switching layouts - Autodesk Community - AutoCAD For the CTAB, use a Find and Replace and just add the String for CTAB field. (%<\AcVar ctab \f "%tc1">%) code provided in this link was working on only 1 layout tab and alos please explain find and replace CTAB Quote
BIGAL Posted March 23, 2023 Posted March 23, 2023 I just clicked on the text field then pasted into text what SLW210 posted and the layout name appeared. Copied to another layout to check it was morning. Quote
pmadhwal7 Posted March 25, 2023 Author Posted March 25, 2023 On 3/23/2023 at 5:39 AM, BIGAL said: I just clicked on the text field then pasted into text what SLW210 posted and the layout name appeared. Copied to another layout to check it was morning. Can you modify it for me? https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/turn-on-off-all-viewports-on-all-layouts-without-switching/td-p/6390402 Quote
BIGAL Posted March 26, 2023 Posted March 26, 2023 (edited) Again just went to your dwg clicked on the tab 100 then dbl clicked text and pasted (%<\AcVar ctab \f "%tc1">%) do this to your template dwg then its set up forever. Edited March 26, 2023 by BIGAL Quote
pmadhwal7 Posted March 27, 2023 Author Posted March 27, 2023 On 3/26/2023 at 5:37 AM, BIGAL said: Again just went to your dwg clicked on the tab 100 then dbl clicked text and pasted (%<\AcVar ctab \f "%tc1">%) do this to your template dwg then its set up forever. Sorry to say sir but I am unable to understand can you explain it where and which auto cad command I use because field command not editable I can't change it, Quote
BIGAL Posted March 27, 2023 Posted March 27, 2023 Copy this to clipboard (%<\AcVar ctab \f "%tc1">%) Open your dwg Go to layout Double click text at top Do CTRL+V the text should change to the name of the layout Save the drawing as a Template drawing a DWT and use it as your master dwg for your projects. Quote
ronjonp Posted March 27, 2023 Posted March 27, 2023 5 hours ago, pmadhwal7 said: Sorry to say sir but I am unable to understand can you explain it where and which auto cad command I use because field command not editable I can't change it, Assuming you have consistency in your drawings, try this: (defun c:foo (/ s) (if (setq s (ssget "_X" '((0 . "TEXT") (1 . "Sheet No. *")))) (foreach o (mapcar 'cadr (ssnamex s)) (vla-put-textstring (vlax-ename->vla-object o) "Sheet No. %<\\AcVar ctab>%") ) ) (princ) ) Quote
pmadhwal7 Posted March 28, 2023 Author Posted March 28, 2023 15 hours ago, BIGAL said: Copy this to clipboard (%<\AcVar ctab \f "%tc1">%) Open your dwg Go to layout Double click text at top Do CTRL+V the text should change to the name of the layout Save the drawing as a Template drawing a DWT and use it as your master dwg for your projects. is this method done in all layout one by one? 1 Quote
pmadhwal7 Posted March 28, 2023 Author Posted March 28, 2023 15 hours ago, ronjonp said: Assuming you have consistency in your drawings, try this: (defun c:foo (/ s) (if (setq s (ssget "_X" '((0 . "TEXT") (1 . "Sheet No. *")))) (foreach o (mapcar 'cadr (ssnamex s)) (vla-put-textstring (vlax-ename->vla-object o) "Sheet No. %<\\AcVar ctab>%") ) ) (princ) ) no actually i want to change sheet not at top middle of the layout sheet Quote
ronjonp Posted March 28, 2023 Posted March 28, 2023 5 minutes ago, pmadhwal7 said: no actually i want to change sheet not at top middle of the layout sheet Not sure what you're asking for. The code was based on your sample drawing. Quote
pmadhwal7 Posted March 30, 2023 Author Posted March 30, 2023 (edited) On 3/28/2023 at 7:37 PM, ronjonp said: Not sure what you're asking for. The code was based on your sample drawing. check in bottom actual layout sheet no is 100 but in top it's different that top mentioned sheet no i want to change in one go. in short green text replaced by red text Edited March 30, 2023 by pmadhwal7 Quote
ronjonp Posted March 30, 2023 Posted March 30, 2023 5 hours ago, pmadhwal7 said: check in bottom actual layout sheet no is 100 but in top it's different that top mentioned sheet no i want to change in one go. in short green text replaced by red text My code does that? Did you try it? Quote
pmadhwal7 Posted March 31, 2023 Author Posted March 31, 2023 14 hours ago, ronjonp said: My code does that? Did you try it? yes i tried but not working 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.