Jump to content

Script command for next layout tab.


ibnut

Recommended Posts

I'd like to write a script that will shift everything on every layout tab 6 inches to the left, but can't seem to find a command to switch to the next layout tab. I was wondering if such a command existed and if not, if there was a better way to go about doing so.

 

Thanks!

Link to comment
Share on other sites

using lisp you can use the foreach subr; similar to this

(foreach lay (layoutlist)(command "_layout" "_Set" lay "_pspace" "move" "all" "" "0,0" "-6,0"))

Link to comment
Share on other sites

Thanks for the tips, both lisps worked perfectly.

 

Another problem that I was running into was that my xrefs were also being moved even though I have them unloaded. Is there a way to get the xrefs to stay put?

Link to comment
Share on other sites

Maybe this?

 

(defun c:objmove (/ ss)
 (foreach lay (layoutlist)
   (if (setq ss (ssget "X" (list (cons 410 lay))))
     (progn
   (foreach e (mapcar 'cadr (ssnamex ss))
     (if (= (logand (cdr (assoc 70 (tblsearch "BLOCK" (cdr (assoc 2 (entget e)))))) 4) 4)
       (ssdel e ss))))
     (princ (strcat "\nNo Objects Found in layout " lay))))
 (command "_move" ss "" "0,0" "-6,0")
 (princ))

Link to comment
Share on other sites

  • 2 weeks later...

Sorry, I've been busy for the last two weeks and haven't had a chance to check up on my thread.

 

I'm getting a "; error: bad argument type: stringp nil" message when I try to run the latest lisp that Lee Mac posted.

 

Is there something that I'm missing in the code?

 

Back to my original post, the drawing area available from my titleblock shifted to the left ~6" and I'd like to write a lisp that will shift everything on my layout pages 6" to the left. The first two lisps worked perfectly, but it was also shifting my titleblock (xref'd) despite it being unloaded.

Link to comment
Share on other sites

My apologies ibnut - I did not test my posted LISP at all, and, upon looking at it again now, I can see that I made quite a few mistakes in my haste to post the code. - my apologies:

 

(defun c:objmove  (/ vlst ovar ss)
 (setq vlst '("CTAB" "CMDECHO" "OSMODE")
   ovar (mapcar 'getvar vlst))
 (mapcar 'setvar (cdr vlst) '(0 0))
 (foreach lay    (layoutlist)
   (setvar "CTAB" lay)
   (if    (setq ss (ssget "X" (list (cons 410 lay))))
     (progn
   (foreach e  (mapcar 'cadr (ssnamex ss))
     (if (and (eq "INSERT" (cdr (assoc 0 (entget e))))
          (= (logand (cdr (assoc 70 (tblsearch "BLOCK" (cdr (assoc 2 (entget e)))))) 4) 4))
       (ssdel e ss)))
     (if ss (command "_move" ss "" "0,0" "-6,0")))
     (princ (strcat "\nNo Objects Found in layout " lay))))
 (mapcar 'setvar vlst ovar)
 (princ))

Link to comment
Share on other sites

Thanks Lee Mac!

 

After playing around with the first code you posted, I kind of "ghetto-modified" it to get it to do what I needed it to do (luckily all my xrefs were inserted at 0,0).

 

(foreach lay (layoutlist) (setvar "CTAB" lay) (command "_pspace" "move" "window" "0,0" "18.5,11" "" "0,0" "-6,0"))

 

I will definitely try out what you've just posted in case I run into a situation where xrefs were not inserted at 0,0. Thanks!

Link to comment
Share on other sites

Thanks Lee Mac!

 

After playing around with the first code you posted, I kind of "ghetto-modified" it to get it to do what I needed it to do (luckily all my xrefs were inserted at 0,0).

 

(foreach lay (layoutlist) (setvar "CTAB" lay) (command "_pspace" "move" "window" "0,0" "18.5,11" "" "0,0" "-6,0"))

I will definitely try out what you've just posted in case I run into a situation where xrefs were not inserted at 0,0. Thanks!

 

 

Well, I'm glad you found a solution in the end anyway :)

Link to comment
Share on other sites

  • 1 month later...
Hello Lee,

Is there any command that make to move the model sapce to layout space.

 

Hello Wakibd

 

If you have a new question, it is much better to create a new thread in the relevant forum, so that the whole community can have a go at answering your query.

 

Lee

Link to comment
Share on other sites

Hello Wakibd

 

If you have a new question, it is much better to create a new thread in the relevant forum, so that the whole community can have a go at answering your query.

 

Lee

ditto....the command you want is "chspace"

Link to comment
Share on other sites

Actually I like to do the following operation. If I model space it should go automitcally paper space and do the following thing.But if the drawing in paper space it ignire first command then it do the following thing. The command you give to me it does not work. If you have anything please let me know

 

(defun c:zqc()(command "chspace")

(command "zoom")(command "extents")(command "yes")

(command "qsave")(command "close")(command

"")

)

Link to comment
Share on other sites

Actually I like to do the following operation. If I model space it should go automitcally paper space and do the following thing.But if the drawing in paper space it ignire first command then it do the following thing.

The command I have it does not work

 

 

(defun c:zqc()(command "chspace")

(command "zoom")(command "extents")(command "yes")

(command "qsave")(command "close")(command

"")

)

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