Author Topic: Print Server Name Change?  (Read 16009 times)

0 Members and 1 Guest are viewing this topic.

SDETERS

  • Guest
Print Server Name Change?
« on: February 08, 2010, 04:17:06 PM »
We just changed our Print server so we changed the name of all of our printers.

Now Every drawing our Special group goes into says it can not find the (printername_hgrps_1) and it is going to default to none plot device has been subsituted.  This takes a long time.

Is there a way around this?  Is there a lisp or script that could be run so I can change the printer name when the drawing gets opened.  

Thanks Shane  
« Last Edit: February 08, 2010, 04:27:54 PM by SDETERS »

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Print Server Name Change?
« Reply #1 on: February 08, 2010, 05:54:10 PM »
one might try using page setup overrides when publishing....for the short term
Be your Best


Michael Farrell
http://primeservicesglobal.com/

SDETERS

  • Guest
Re: Print Server Name Change?
« Reply #2 on: February 08, 2010, 06:02:15 PM »
That is what we are doing.

I did not know if there was an automated way of doing this or not?

Thanks for the feedback

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Print Server Name Change?
« Reply #3 on: February 08, 2010, 06:22:13 PM »
Sadly' I've been pushed down this this path more than once by some 'others' IT folks renaming both file and print servers at regular random intervals. ;)
I never looked into a programmatic solution like say a LISP, or VBA routine that would read the CTAB Page setup information, and IF it wasn't using your new one would then Import said pagesetup PSETUPIN and set that current on any and all Layout tabs it encountered.

You may want to boost this up to the Code Red folks and see if this nut has already been cracked up there.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Print Server Name Change?
« Reply #4 on: February 08, 2010, 06:32:43 PM »
As a work-around for things like this, I have created new page set-ups in a blank file and used TrueView to convert-in-place, to the same version, check the "set default set-up to none", and point to the template file.
If you are going to fly by the seat of your pants, expect friction burns.

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

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Print Server Name Change?
« Reply #5 on: February 08, 2010, 06:44:11 PM »
or if you wanted a solution while in the Drawing ..
Edit the FileName to suit your template

Code: [Select]
;;//---------------------------------------------------------------------------

(defun c:ChangePageSetups (/ old_expert)
    (setq old_expert (getvar "expert"))
    (setvar "expert" 5)
    ;; REVISE TO SUIT
    ;; (VL-CMDF "-psetupin" "PageSetupTemplate_FileName" "pageSetup_Name")
    (vl-cmdf "-psetupin" "c:/PageSetupTemplate.DWG" "*")
    (setvar "expert" old_expert)
    (princ)
)

;;//---------------------------------------------------------------------------
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

SDETERS

  • Guest
Re: Print Server Name Change?
« Reply #6 on: February 09, 2010, 08:51:00 AM »
This worked sort of good.

All we have in our pagesetup is *model*

it seems it does not like this so what I did is I went into our template and made a new pagesetup name

now I get the lisp to work now I need to set that new pagesetup name to current.  Like I said I do not know much lisp at all.  Would you please provide a couple extra lines to set my new pagesetup name to current.  Then I think I would be set.  Thanks for all the help and feedback.

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Re: Print Server Name Change?
« Reply #7 on: February 09, 2010, 09:43:52 AM »
not sure about the setting of a pagesetup current but here is a stripped down version of one that i use in my office.  Ive kept the error handling process in the `PSETUP-IN' routine for you to decide whether to keep or not.

Code: [Select]
(defun copy_page-setup (DwgName / psetups $acadver$ $typelib$ $classname$ $dbxDoc$)
  (setq $AcadVer$  (atoi (getvar "acadver"))
        $TypeLib$   (findfile "AxDb.dll")
        $ClassName$ (strcat "ObjectDBX.AxDbDocument" "." (itoa $AcadVer$))
        $dbxdoc$   (vla-GetInterfaceObject (vlax-get-acad-object) $ClassName$))

  (setq *acad* (vlax-get-acad-object))
  (setq *active-document* (vla-get-activedocument *acad*))
 
  (setq psetups (vla-get-plotconfigurations *active-document*))

  (vla-open $dbxdoc$ DwgName)
 
  (vlax-for x
            (setq dbxdoc-collection (vla-get-plotconfigurations $dbxdoc$))
            (setq name (vla-get-name x))
            (vla-copyobjects
              $dbxdoc$
              (vlax-safearray-fill
                (vlax-make-safearray vlax-vbobject '(0 . 0))
                (list (vla-item dbxdoc-collection name)))
              psetups ))

  (vlax-release-object $dbxdoc$)
  (princ)
  )

;; BEGIN MAIN
(defun c:psetup-in ( / *error* ERROR-LST-)
  ;;
  ;; BEGIN SETUP
       (setq
         ERROR-LST-
                    '("AUTOSNAP" "OSMODE" "APERTURE" "HPSPACE" "HPASSOC"
                      "MIRRTEXT" "AUPREC" "LUPREC" "DIMZIN" "CECOLOR" "CLAYER")
         ERROR-LST- (mapcar (function (lambda (a) (list 'setvar a (getvar a)))) ERROR-LST-)
       );_end setq

       (defun *error* (msg)
          (command) (command)
          (mapcar 'eval ERROR-LST-)
          )

  ;; END SETUP
  ;;

  ;;
  ;; BEGIN CODE

   (setq *acad-object* (vlax-get-acad-object))
   (setq *active-document* (vla-get-activedocument *acad-object*))
   ;;
   ;; delete existing pagesetups
   (vlax-map-collection (vla-get-plotconfigurations *active-document*) 'vla-delete)

   ;;
   ;; import the new ones
   (copy_page-setup "C:\\tmp\\Test-PageSetups-ABS08.dwt")

  ;; END CODE
  ;;

  ;;
  ;; BEGIN CLEANUP
 
  (*error* "")
  ;; END CLEANUP
  ;;
  (princ)
)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

SDETERS

  • Guest
Re: Print Server Name Change?
« Reply #8 on: February 09, 2010, 10:34:11 AM »
Sorry I get an error saying "error: malformed list on input"  When I try to run this program.

I modified the code for my appropriate dwt file.

Is there anything else I need to add to it?  Sorry for being a pain in the a--.

Thanks 

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Re: Print Server Name Change?
« Reply #9 on: February 09, 2010, 11:41:02 AM »
no that just means that i dont have a parentheses or something (I messed up when i was deleting stuff). let me fix it.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Re: Print Server Name Change?
« Reply #10 on: February 09, 2010, 11:43:48 AM »
*hummm* nope it seems okay. Are you sure you copied it correctly? I would copy and paste one more time to be sure.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

SDETERS

  • Guest
Re: Print Server Name Change?
« Reply #11 on: February 09, 2010, 11:56:27 AM »
Yep I got it now.  I was the one who messed up copying and pasting.

I Still have the problem with the page setup manager wanting to use *model*.   Please see JPEG file.

 In my DWT file I have this set as for example *model* (ME) set to current.

It got the ME name but it did not set that name to current.

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Re: Print Server Name Change?
« Reply #12 on: February 09, 2010, 03:55:53 PM »
I stated that i didnt know of a way to set the page setup; they are just a collection of settings. However, you can manually set the plotting STUFF...

-e.g. Here is how to set the pc3 file or plotter used.
Code: [Select]
(vla-put-configname
  (vla-get-layout
    (vla-get-PaperSpace
      (vla-get-ActiveDocument
(vlax-get-object "AutoCAD.Application")
      )
    )
  )
  "Ghostscript.pc3"
)
;; or
(vla-put-configname
  (vla-get-layout
    (vla-get-PaperSpace
      (vla-get-ActiveDocument
(vlax-get-object "AutoCAD.Application")
      )
    )
  )
  "None"
)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

SDETERS

  • Guest
Re: Print Server Name Change?
« Reply #13 on: February 09, 2010, 04:03:40 PM »
oh OK Sorry I get lost sometimes in the lisp programs.  I do not know how you come up with all of the calls and code and parentheses and such.  I really do appreciate your help. 

Thanks again  Off to look at your other suggestion.

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Re: Print Server Name Change?
« Reply #14 on: February 09, 2010, 05:32:20 PM »
Try this one:
Code: [Select]
(vla-put-configname
  (vla-get-layout
    (vla-get-PaperSpace
      (vla-get-ActiveDocument
(vlax-get-object "AutoCAD.Application")
      )
    )
  )
  "Ghostscript.pc3"
)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org