Author Topic: control PLOTTER NAME list  (Read 4719 times)

0 Members and 1 Guest are viewing this topic.

aicr317

  • Guest
control PLOTTER NAME list
« on: January 14, 2010, 01:01:54 AM »

(setq plotList
      (vlax-safearray->list
        (vlax-variant-value
          (vla-getplotdevicenames
            (vla-item
              (vla-get-layouts
                (vla-get-activedocument (vlax-get-acad-object))
              )
              "Model"
            )
          )
        )
      )
    )


;;;;
;;;;
;;;;it returned ("pdfFactory Pro" "Adobe PDF" "\\\\print\\HP5200" "DWG TO PDF.pc3" "FX 6030A0.PC3" "FX 6030A1.PC3" "FX 6030A2.PC3" "ROWE3100.PC3")

now i want to do like this , when i key-in "plot" in command,and i just want the "plotter name" only shows (" FX 6030A0.PC3" "ROWE3100.PC3")

how to get/put the plotter name table with lisp ???
« Last Edit: January 14, 2010, 01:33:52 PM by aicr317 »

aicr317

  • Guest
Re: PLOTTER NAME table
« Reply #1 on: January 14, 2010, 01:03:52 AM »
plotter name table

myloveflyer

  • Newt
  • Posts: 152
Re: PLOTTER NAME table
« Reply #2 on: January 14, 2010, 03:24:37 AM »
;;;this LISP come from China,Author 飞诗
(defun fsxm-getprn (/ strprint)    (setq strprint
  (vl-registry-read
    (strcat
      "HKEY_CURRENT_USER\\Software\\Microsoft\\"
      "Windows NT\\CurrentVersion\\Windows"
    )
    "Device"
  )
  )
  (substr strprint 1 (vl-string-search "," strprint))
)
Never give up !

aicr317

  • Guest
Re: PLOTTER NAME table
« Reply #3 on: January 14, 2010, 03:41:25 AM »
;;;this LISP come from China,Author 飞诗
(defun fsxm-getprn (/ strprint)    (setq strprint
  (vl-registry-read
    (strcat
      "HKEY_CURRENT_USER\\Software\\Microsoft\\"
      "Windows NT\\CurrentVersion\\Windows"
    )
    "Device"
  )
  )
  (substr strprint 1 (vl-string-search "," strprint))
)


IT IS NOT I AM LOOKING FOR....

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: PLOTTER NAME table
« Reply #4 on: January 14, 2010, 08:37:10 AM »
Try this on your list:
Code: [Select]
(vl-remove-if-not '(lambda(x) (vl-string-search ".PC3" (strcase x))) plotList)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

aicr317

  • Guest
Re: PLOTTER NAME table
« Reply #5 on: January 14, 2010, 11:56:39 AM »
Try this on your list:
Code: [Select]
(vl-remove-if-not '(lambda(x) (vl-string-search ".PC3" (strcase x))) plotList)

Perhaps i am not Description it clearly,i means when i "file" --->"PLOT",then it open this dialog,i just want the name list only shows something i Designated!!!

in other words,i want to control this list ,

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: control PLOTTER NAME list
« Reply #6 on: January 14, 2010, 01:42:31 PM »
Surely that setting just lists all the available devices, so, to edit the list I would think you would need to uninstall the device surely?  :|

Best I can do is what you already have:

Code: [Select]
;; cfg  =  Plot Configuration Name

(defun GetPlotDevices (cfg)
 
  (if (not
        (vl-catch-all-error-p
          (setq cfg (vl-catch-all-apply
                      (function vla-item)
                        (list (vla-get-PlotConfigurations
                                (vla-get-ActiveDocument
                                  (vlax-get-acad-object))) cfg)))))
    (progn
      (vla-RefreshPlotDeviceInfo cfg)
      (vlax-invoke cfg 'GetPlotDeviceNames))))

aicr317

  • Guest
Re: control PLOTTER NAME list
« Reply #7 on: January 14, 2010, 02:04:51 PM »
Surely that setting just lists all the available devices, so, to edit the list I would think you would need to uninstall the device surely?  :|

Best I can do is what you already have:

Code: [Select]
;; cfg  =  Plot Configuration Name

(defun GetPlotDevices (cfg)
 
  (if (not
        (vl-catch-all-error-p
          (setq cfg (vl-catch-all-apply
                      (function vla-item)
                        (list (vla-get-PlotConfigurations
                                (vla-get-ActiveDocument
                                  (vlax-get-acad-object))) cfg)))))
    (progn
      (vla-RefreshPlotDeviceInfo cfg)
      (vlax-invoke cfg 'GetPlotDeviceNames))))

in the past, i have a lisp to set system default plotter,perhaps it can also set the plotter in cad,now i can not find it!!!

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: control PLOTTER NAME list
« Reply #8 on: January 14, 2010, 02:16:07 PM »
Surely that setting just lists all the available devices, so, to edit the list I would think you would need to uninstall the device surely?  :|

Best I can do is what you already have:

Code: [Select]
;; cfg  =  Plot Configuration Name

(defun GetPlotDevices (cfg)
 
  (if (not
        (vl-catch-all-error-p
          (setq cfg (vl-catch-all-apply
                      (function vla-item)
                        (list (vla-get-PlotConfigurations
                                (vla-get-ActiveDocument
                                  (vlax-get-acad-object))) cfg)))))
    (progn
      (vla-RefreshPlotDeviceInfo cfg)
      (vlax-invoke cfg 'GetPlotDeviceNames))))

in the past, i have a lisp to set system default plotter,perhaps it can also set the plotter in cad,now i can not find it!!!

Ah, I thought you wanted to remove plotters from the list...   :-o

aicr317

  • Guest
Re: control PLOTTER NAME list
« Reply #9 on: January 14, 2010, 02:22:57 PM »
how can i do ,first i think must get the list as a result,then delete

rhino

  • Guest
Re: control PLOTTER NAME list
« Reply #10 on: January 14, 2010, 02:26:27 PM »
Try this on your list:
Code: [Select]
(vl-remove-if-not '(lambda(x) (vl-string-search ".PC3" (strcase x))) plotList)

Perhaps i am not Description it clearly,i means when i "file" --->"PLOT",then it open this dialog,i just want the name list only shows something i Designated!!!

in other words,i want to control this list ,

dude... you can't control that list without uninstalling those printers or editing some windows registry entries (which can cause serious problems if not executed properly) - the best you can do is to create your own plot routine and dialog box to control which plotting devices u want to allow the user to plot to!

you can see this link/code http://www.jefferypsanders.com/autolisp_selectplotter.html which is similar to what lee and alan  have posted.

btw u can filter the list further by using

(vl-remove-if-not '(lambda(x) (vl-string-search "plotter_name.PC3" (strcase x))) plotList)
« Last Edit: January 15, 2010, 08:18:54 AM by rhino »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: control PLOTTER NAME list
« Reply #11 on: January 14, 2010, 02:28:20 PM »
How about this (for active layout):

Code: [Select]
;; DvcName  =  Name of Plot Device

(defun PutPlotDevice (DvcNme)
  (vl-load-com)
  ;; Lee Mac  ~  14.01.10
 
  (setq lay (vla-get-ActiveLayout
              (vla-get-ActiveDocument
                (vlax-get-acad-object))))
 
  (vla-RefreshPlotDeviceinfo lay)

  (if (vl-position (strcase DvcNme)
        (mapcar (function strcase)
          (vlax-safearray->list
            (vlax-variant-value
              (vla-getPlotDeviceNames lay)))))

    (not (vl-catch-all-error-p
           (vl-catch-all-apply
             (function vla-put-configname)
               (list lay DvcNme))))))

aicr317

  • Guest
Re: control PLOTTER NAME list
« Reply #12 on: January 14, 2010, 02:32:57 PM »
How about this (for active layout):

Code: [Select]
;; DvcName  =  Name of Plot Device

(defun PutPlotDevice (DvcNme)
  (vl-load-com)
  ;; Lee Mac  ~  14.01.10
 
  (setq lay (vla-get-ActiveLayout
              (vla-get-ActiveDocument
                (vlax-get-acad-object))))
 
  (vla-RefreshPlotDeviceinfo lay)

  (if (vl-position (strcase DvcNme)
        (mapcar (function strcase)
          (vlax-safearray->list
            (vlax-variant-value
              (vla-getPlotDeviceNames lay)))))

    (not (vl-catch-all-error-p
           (vl-catch-all-apply
             (function vla-put-configname)
               (list lay DvcNme))))))

nick work !!!wonderful!!!

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: control PLOTTER NAME list
« Reply #13 on: January 14, 2010, 02:35:13 PM »
How about this (for active layout):

Code: [Select]
;; DvcName  =  Name of Plot Device

(defun PutPlotDevice (DvcNme)
  (vl-load-com)
  ;; Lee Mac  ~  14.01.10
 
  (setq lay (vla-get-ActiveLayout
              (vla-get-ActiveDocument
                (vlax-get-acad-object))))
 
  (vla-RefreshPlotDeviceinfo lay)

  (if (vl-position (strcase DvcNme)
        (mapcar (function strcase)
          (vlax-safearray->list
            (vlax-variant-value
              (vla-getPlotDeviceNames lay)))))

    (not (vl-catch-all-error-p
           (vl-catch-all-apply
             (function vla-put-configname)
               (list lay DvcNme))))))

nick work !!!wonderful!!!

You're welcome.  :-)

aicr317

  • Guest
Re: control PLOTTER NAME list
« Reply #14 on: January 14, 2010, 02:37:35 PM »
I THINK IF CAN SET THIS VALUE , AS WELL AS YOUR PutPlotDevice