Jump to content

Display objects in Viewport yes or no


pmadhwal7

Recommended Posts

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

 

image.png.196f185c6df37c0fc6ba6de60c6926d4.pngDrawing1.dwg

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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

 

image.png.726e7b08287310ed5456f759c5df3765.png

 

 

 

for refernce of qustion no 2 dwg sample attached

layout.dwg

Link to comment
Share on other sites

Use a field for your text to match the layout name: 

image.png.91c9fc7d9750f83833cd79fa17bc78bb.png

 

And use the filter command to get all your viewports to turn them on or off in the properties palette.

image.png.f31c34cd726541a15a5ed114b7b03a3d.png

 

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 by ronjonp
Link to comment
Share on other sites

13 hours ago, ronjonp said:

Use a field for your text to match the layout name: 

image.png.91c9fc7d9750f83833cd79fa17bc78bb.png

 

And use the filter command to get all your viewports to turn them on or off in the properties palette.

image.png.f31c34cd726541a15a5ed114b7b03a3d.png

 

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 by pmadhwal7
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by BIGAL
Link to comment
Share on other sites

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, 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)
)

 

Link to comment
Share on other sites

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?

  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

image.thumb.png.a218593d8097f70c00d376f959719bdd.png

Edited by pmadhwal7
Link to comment
Share on other sites

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

image.thumb.png.a218593d8097f70c00d376f959719bdd.png

My code does that? Did you try it?

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...