Author Topic: Page Setup problems  (Read 6258 times)

0 Members and 1 Guest are viewing this topic.

baglover

  • Guest
Page Setup problems
« on: August 05, 2019, 02:08:19 PM »
Hopefully the LISP geniuses here can help me.

After a new server was installed, all of our AutoCAD Page Setups stopped working.  The reason... our printer and plotters drivers were on the old server. Each device associated to a page setup, was linked to the old plotter.

The simple solution would be to have a LISP routine to change the location of where the printer/plotters get their drivers. After spending days reading and testing, this doesn't seem to be a feasible solution.

I've been able to delete all of the old page setups, and to load new updated page setups (with the same names and pointing to the new server) but the Current page setup, retains the name and still points to the old server.

What I think I need is a routine that will take the name of the existing page setup, set it as a variable. 

Then after loading the new page setups from a template, set the page setup to NONE.

And then set the page setup back to the name saved as a variable. Which hopefully reads the updated page setup info.

My understanding of basic LISP is limited, but I could not find a way to accomplish this. 

Any help would be appreciated.

-Brian-

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Page Setup problems
« Reply #1 on: August 05, 2019, 03:00:55 PM »
Welcome to TheSwamp! See if this helps any:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ r)
  2.     ;; Store a list of ((configname . vlalayout))
  3.     (setq r (cons (cons (vla-get-configname x) x) r))
  4.     ;; Set to none
  5.     (vla-put-configname x "None")
  6.   )
  7.   ;; Import your page setups now
  8.   ;;
  9.   ;; Set name back to previous config <-not sure if this works
  10.   (foreach x r (vla-put-configname (cdr x) (car x)))
  11.   (princ)
  12. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

baglover

  • Guest
Re: Page Setup problems
« Reply #2 on: August 05, 2019, 04:43:58 PM »
Thanks for the quick response.

I think it worked as I described, but unfortunately, it set the previous Page Setup name back into the Current Page Setup, but it did not update it with the new server location for the drivers.


57gmc

  • Bull Frog
  • Posts: 358
Re: Page Setup problems
« Reply #3 on: August 06, 2019, 10:16:44 AM »
Have you updated your pc3 files? They are what store the printer location. If your new pc3 files have the same name, you shouldn't need to update the page setups.

baglover

  • Guest
Re: Page Setup problems
« Reply #4 on: August 06, 2019, 01:03:59 PM »
Yes, the .PC3's are updated.  What isn't updating is the Current Page Setup. 

It is keeping the page setup name it previously had, as well as the old plotter source.  In this case the replaced server.

I moved the ;; Import your pages setups now to above the defining the function "Foo" because it was not importing the page setups.

Does it need to be part of the "Foo" function?

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Page Setup problems
« Reply #5 on: August 06, 2019, 01:55:50 PM »
Use something like so:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ r)
  2.     (vla-delete ps)
  3.   )
  4.     ;; Store a list of ((configname . vlalayout))
  5.     (setq r (cons (cons (vla-get-configname x) x) r))
  6.     ;; Set to none mot sure if this is doing anything .. might be causing problems?
  7.     (vla-put-configname x "Blank")
  8.   )
  9.   (vl-cmdf "-psetupin" "Server3.dwt" "*")
  10.   ;;
  11.   ;; Set name back to previous config <-not sure if this works
  12.   (foreach x r (vla-put-configname (cdr x) (car x)))
  13.   (princ)
  14. )

Although as mentioned, if you updated your pc3 files on the server AND they are in the same location AND have the same names as the old ones you should not have to do this?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

57gmc

  • Bull Frog
  • Posts: 358
Re: Page Setup problems
« Reply #6 on: August 06, 2019, 01:58:13 PM »
In the pic below, the pc3 file is specified. Are you using new plotters with new names? As long as the plotter pc3 file has the same name as the one specified in the page setup, it should just work. If you changed plotters and the pc3 has a different name, I would recommend changing the page setups in your templates and then importing those page setups into your working file from the template.

baglover

  • Guest
Re: Page Setup problems
« Reply #7 on: August 06, 2019, 02:34:57 PM »
I have updated ALL of the .PC3s on the new server.

All of them point to the proper location.

When I load the updated Page Setups, all of the .PC3s are pointing to the new server, except the "Current Page Setup" which points to the old location.

Now if this were for a few hundred files, I'd tell everyone, just re-select the Page Setup on the list that matches the Current Page Setup.

However, I have over 9,500 active drawing files right now, and I am trying to globally update them so I'm not taking a production hit for weeks.

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Page Setup problems
« Reply #8 on: August 06, 2019, 02:43:38 PM »
Paste this code into your command line on one of your drawings that has an issue and post the results printed:
Code - Auto/Visual Lisp: [Select]

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Page Setup problems
« Reply #9 on: August 06, 2019, 03:08:39 PM »
Look into the settings for DWGCONVERT.  There's some for dealing with named page set ups.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Page Setup problems
« Reply #10 on: August 06, 2019, 03:13:19 PM »
You could also try this .. in my mind the concept is sound but you'll have to test. Comments in the code so you know what's happening.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ d ps r)
  2.   ;; RJP » 2019-08-06
  3.   ;; Delete existing plot configs
  4.     (vla-delete x)
  5.   )
  6.   ;; Import new plot settings
  7.   (vl-cmdf "-psetupin" "Server3.dwt" "*")
  8.   ;; Get these new plot settings
  9.     (or (= 0 (vlax-get x 'modeltype)) (setq r (cons (cons (vla-get-configname x) x) r)))
  10.   )
  11.   ;; Go to modelspace
  12.   (setvar 'ctab "Model")
  13.   ;; Foreach layout
  14.     ;; Check if a tab has the same pageetup name in the list of new settings
  15.     (cond ((setq ps (cdr (assoc (vla-get-configname x) r)))
  16.            ;; Copy the new settings to the tab
  17.            (vl-catch-all-apply 'vla-copyfrom (list x ps))
  18.            ;; Refresh plot info
  19.            (vlax-invoke x 'refreshplotdeviceinfo)
  20.           )
  21.     )
  22.   )
  23.   (princ)
  24. )
« Last Edit: August 06, 2019, 04:02:53 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

baglover

  • Guest
Re: Page Setup problems
« Reply #11 on: August 06, 2019, 03:17:06 PM »
Ronjonp - thanks again for all of the assistance.

Here are the results.

"\\\\rrj-s1\\OceTDS450"
"\\\\rrj-sbs2011\\CAD Copier BW KM C364" "\\\\rrj-sbs2011\\CAD Copier BW KM C364"


The first response I don't understand, as the Oce Plotter is not a page setup for the drawing I used.

Also, I do not have an RRJ-S1 server, so I have no idea where that info is coming from.




baglover

  • Guest
Re: Page Setup problems
« Reply #12 on: August 06, 2019, 03:20:15 PM »
DGORSMAN,

I started with the DWGCONVERT command, but I could not get it to update the "CURRENT PAGE SETUP".

If I don't update that, then my batch update solution only half works.

Thanks for the suggestion.

baglover

  • Guest
Re: Page Setup problems
« Reply #13 on: August 06, 2019, 03:48:11 PM »
ronjonp,

The last version of FOO that you posted crashes in Model Space with the following error:

-psetupin Enter file name: Server3.dwt Enter user defined page setup(s) to import or [?]: *
Command: Regenerating model - caching viewports.
; error: Too many actual parameters


ronjonp

  • Needs a day job
  • Posts: 7526
Re: Page Setup problems
« Reply #14 on: August 06, 2019, 04:00:50 PM »
Ronjonp - thanks again for all of the assistance.

Here are the results.

"\\\\rrj-s1\\OceTDS450"
"\\\\rrj-sbs2011\\CAD Copier BW KM C364" "\\\\rrj-sbs2011\\CAD Copier BW KM C364"


The first response I don't understand, as the Oce Plotter is not a page setup for the drawing I used.

Also, I do not have an RRJ-S1 server, so I have no idea where that info is coming from.
Just a guess but if your server name is hardcoded into the config name then it might be as easy as stripping the path and appending the name of the new server like so ( untested ).
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ i srv str)
  2.   ;; RJP » 2019-08-06
  3.   (if (setq srv (getenv "logonserver"))
  4.       ;; Name does not already have the new server in it
  5.       (cond ((and (not (vl-string-search srv (setq str (vla-get-configname x))))
  6.                   ;; AND it has a path
  7.                   (setq i (vl-string-position (ascii "\\") str 0 t))
  8.              )
  9.              ;; Strip the path and append the new server name
  10.              (vla-put-configname x (strcat srv (substr str (1+ i))))
  11.             )
  12.       )
  13.     )
  14.     (print "Logon Server name not defined!")
  15.   )
  16.   (princ)
  17. )
« Last Edit: August 06, 2019, 04:05:50 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC