Author Topic: Test for Available Plotter  (Read 7079 times)

0 Members and 1 Guest are viewing this topic.

Ken Alexander

  • Newt
  • Posts: 61
Test for Available Plotter
« on: November 14, 2005, 10:29:46 PM »
I need to check for available plotters.  The problem is, what if a plotter is set up but a network connection is unplugged or not available.

I am using vlisp to test for plotters available and to test which, if any, plotters are set up in model or other layouts.

What property or method do I look at to see if there is a good connection to a network?

Thanks for any help.
Ken Alexander

LE

  • Guest
Re: Test for Available Plotter
« Reply #1 on: November 14, 2005, 10:47:49 PM »
I need to check for available plotters.  The problem is, what if a plotter is set up but a network connection is unplugged or not available.

I am using vlisp to test for plotters available and to test which, if any, plotters are set up in model or other layouts.

What property or method do I look at to see if there is a good connection to a network?

Thanks for any help.

I do not have code of my own about plotters.... but have you been at Jimmy B. www.jtbworld.com in the lisps section?

LE

  • Guest
Re: Test for Available Plotter
« Reply #2 on: November 14, 2005, 10:50:03 PM »

Ken Alexander

  • Newt
  • Posts: 61
Re: Test for Available Plotter
« Reply #3 on: November 14, 2005, 10:57:27 PM »
No.  I didn't look at this site prior.  After reviewing the various code in the link, unless I am missing something, the code provided in the examples will have the same problem.

The plotter may exist in the plot list but not available if a network connection is lost.
Ken Alexander

Ken Alexander

  • Newt
  • Posts: 61
Re: Test for Available Plotter
« Reply #4 on: November 14, 2005, 11:00:15 PM »
No.  I didn't look at this site prior.  After reviewing the various code in the link, unless I am missing something, the code provided in the examples will have the same problem.

The plotter may exist in the plot list but not available if a network connection is lost.

I should expand on this.....

The plotter does exist in the plot list but may not be available to plot to; this is my dilemma.
Ken Alexander

Ken Alexander

  • Newt
  • Posts: 61
Re: Test for Available Plotter
« Reply #5 on: November 14, 2005, 11:17:24 PM »
Here is my code so far:

(if plotlist
    (progn
      (setq playout (vla-get-layout
           (vla-get-modelspace
             (vla-get-activedocument
               (vlax-get-acad-object)
             )
           )
         )
       )
      (vla-RefreshPlotDeviceInfo playout)
      (setq plotters
        (mapcar 'strcase
           (vlax-safearray->list
             (vlax-variant-value
          (vla-GetPlotDeviceNames playout)))))
      (setq pconfig (strcase
            (vla-get-configname
         playout
            )
          )
      )
      (if (not (member pconfig plotters))
   (setq pconfig "NONE")
   )
   
      (initget "Yes, No")
      (setq ans
        (getkword "Do you wish to plot selected nest Yes/No? <Y> ")
      )
      (if (or (not ans) (= ans "Yes"))
   (progn
     (if (= pconfig "NONE")
       (progn
         (alert
      "No plotter has been set up for Model Space. \n
     Please right click on the Model Space Tab and Set up a plotter
     before using this function. "
         )
         (vla-endundomark
      (vla-get-activedocument (vlax-get-acad-object))
         )
         (command "._Undo" "1")
       )
       (progn
         (mapcar (function   (lambda   (x)
              (command "._-plot"
                  "Y"
                  ""
                  ""
                  ""
                  punit
                  ""
                  ""
                  "V"
                  x;(rtos x)
                  ""
                  "C"
                  ""
                  ""
                  ""
                  ""
                  ""
                  ""
                  ""
              )
            )
            )
            plotlist
         )
         (vla-endundomark
      (vla-get-activedocument (vlax-get-acad-object))
         )
         ;(command "._Undo" "1")
       )
     )
   )
   (vla-endundomark
     (vla-get-activedocument (vlax-get-acad-object))
   )
      )
    )
  )
Ken Alexander

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Test for Available Plotter
« Reply #6 on: November 15, 2005, 12:12:30 AM »
Ken,
Would the Simplest way be to wrap your plot command in an exception trap
.. or try (vl-cmdf  ? in place of command

I cant test it currently.

There may be a method in Windows Scripting to assert the printer connection, but thats a guess.

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.

Ken Alexander

  • Newt
  • Posts: 61
Re: Test for Available Plotter
« Reply #7 on: November 15, 2005, 01:06:06 AM »
Hi Kerry,

vl-cmdf or vl-catch-all-apply do not provide the information to say, "Plotter exists, but plotter exists on a network connection that is disconnected. Connect or change plotters and re-run.".

This is of course IF I am doing something wrong (which is very possible).

Pulling my hair our on this one.

Thanks folks for your insight.
Ken Alexander

Ken Alexander

  • Newt
  • Posts: 61
Re: Test for Available Plotter
« Reply #8 on: November 15, 2005, 01:14:10 AM »
.....got to go to bed.  I'll look and try again in the morning.


Thanks to all for their input thus far.
Ken Alexander

Sdoman

  • Guest
Re: Test for Available Plotter
« Reply #9 on: November 15, 2005, 07:40:45 AM »
Just an idea.  If you know the plotter IP address, then perhaps you could ping the plotter.  Maybe use the SHELL command to run PING, then save the result (somehow) in a DOS environment variable, return to AutoCAD and read that variable.
 

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: Test for Available Plotter
« Reply #10 on: November 15, 2005, 12:34:39 PM »
Ken,
I don't have time right now to try this, but if you could convert THIS to vlisp I think it's what you need.

Jeff

Ken Alexander

  • Newt
  • Posts: 61
Re: Test for Available Plotter
« Reply #11 on: November 15, 2005, 07:26:18 PM »
Ken,
I don't have time right now to try this, but if you could convert THIS to vlisp I think it's what you need.

Jeff

Thanks Jeff,

I'll take a look at this tonight.
Ken Alexander

Joe Burke

  • Guest
Re: Test for Available Plotter
« Reply #12 on: November 18, 2005, 08:57:05 AM »
Off topic, I'm new here and trying to fiind the lay of the land. Since this thread contains messages from a number of folks I know... (Luis, Jeff, Steve, Ken) well I'm just saying Hi.

Regards
Joe Burke

LE

  • Guest
Re: Test for Available Plotter
« Reply #13 on: November 18, 2005, 09:31:50 AM »
Off topic, I'm new here and trying to fiind the lay of the land. Since this thread contains messages from a number of folks I know... (Luis, Jeff, Steve, Ken) well I'm just saying Hi.

Regards
Joe Burke

Welcome to The Swamp Joe.

 :-)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Test for Available Plotter
« Reply #14 on: November 18, 2005, 09:39:52 AM »
Welcome to the swamp Joe.

- Michael Puckett.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst