+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24
  1. #1
    Senior Member Small Fish's Avatar
    Using
    AutoCAD 2010
    Join Date
    May 2009
    Location
    Tauranga, New Zealand
    Posts
    203

    Default get current tab plotter device

    Registered forum members do not see this ad.

    In a dwg file that has more than one tab I would like to check
    if the plotter device is set to 'NONE' on any of the tabs.

    First I tried using :
    Code:
     
    (setq GetActivePlotDevice(vla-get-ConfigName
        (vla-get-ActiveLayout
        (vla-get-activedocument
          (vlax-get-acad-object)))))
    to find the plotter device in the current tab. This doesn't seem to work. Is there a way to find the plotter device name?

    I other questions but that is all for now - thanks

    cheers

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows Vista Home Premium (32-bit)
    Using
    AutoCAD 2010
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    10,248

    Default

    Perhaps something like this?

    Code:
    (defun GetPlotDevices (/ dvc)
      (vl-load-com)
      ;; Lee Mac  ~  26.02.10
    
      (vlax-map-collection
        (vla-get-layouts
          (vla-get-ActiveDocument
            (vlax-get-acad-object)))
        (function
          (lambda (layout)
            (vla-RefreshPlotDeviceInfo layout)
            (setq dvc
              (cons
                (cons
                  (vla-get-name layout)
                    (vla-get-ConfigName layout)) dvc)))))
      
      (reverse dvc))

  3. #3
    Forum Deity alanjt's Avatar
    Using
    Civil 3D 2009
    Join Date
    Apr 2008
    Posts
    3,862

    Default

    Code:
    (vla-get-configname
      (vla-get-activelayout
        (vla-get-activedocument
          (vlax-get-acad-object))))
    Works just fine for me. Returns "None" if nothing or the plotting device name.

    Edit: Oops, didn't realize you replied. I hit reply, got up for a second, sat back down and finished responding.
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...


  4. #4
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows Vista Home Premium (32-bit)
    Using
    AutoCAD 2010
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    10,248

    Default

    Quote Originally Posted by alanjt View Post
    Edit: Oops, didn't realize you replied. I hit reply, got up for a second, sat back down and finished responding.
    Hey, no worries dude

    As you say, the code that SmallFish posted seemed to be correct, but sometimes I find you have to call:

    Code:
    (vla-RefreshPlotDeviceInfo <layout>)
    first.

    Lee

  5. #5
    Forum Deity alanjt's Avatar
    Using
    Civil 3D 2009
    Join Date
    Apr 2008
    Posts
    3,862

    Default

    Quote Originally Posted by Lee Mac View Post
    Hey, no worries dude

    As you say, the code that SmallFish posted seemed to be correct, but sometimes I find you have to call:

    Code:
    (vla-RefreshPlotDeviceInfo <layout>)
    first.

    Lee
    That's true. I've encountered that in the past.
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...


  6. #6
    Forum Deity alanjt's Avatar
    Using
    Civil 3D 2009
    Join Date
    Apr 2008
    Posts
    3,862

    Default

    I was just curious...

    Code:
    (defun PlotDevices (/ #List)
      (vlax-for x (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
        (vla-refreshplotdeviceinfo x)
        (setq #List (cons (cons (vla-get-name x) (vla-get-configname x)) #List))
      ) ;_ vlax-for
      (reverse #List)
    ) ;_ defun
    Code:
    Command: (benchmark '( (getplotdevices) (plotdevices) ))
    Elapsed milliseconds / relative speed for 64 iteration(s):
    
        (PLOTDEVICES)........1203 / 1.17 <fastest>
        (GETPLOTDEVICES).....1407 / 1.00 <slowest>
    
    Command: (benchmark '( (getplotdevices) (plotdevices) ))
    Elapsed milliseconds / relative speed for 64 iteration(s):
    
        (GETPLOTDEVICES).....1218 / 1.00 <fastest>
        (PLOTDEVICES)........1219 / 1.00 <slowest>
    
    Command: (benchmark '( (getplotdevices) (plotdevices) ))
    Elapsed milliseconds / relative speed for 64 iteration(s):
    
        (PLOTDEVICES)........1219 / 1.01 <fastest>
        (GETPLOTDEVICES).....1234 / 1.00 <slowest>
    
    Command: (benchmark '( (getplotdevices) (plotdevices) ))
    Elapsed milliseconds / relative speed for 64 iteration(s):
    
        (GETPLOTDEVICES).....1219 / 1.00 <fastest>
        (PLOTDEVICES)........1219 / 1.00 <slowest>
    
    Command: (benchmark '( (getplotdevices) (plotdevices) ))
    Elapsed milliseconds / relative speed for 64 iteration(s):
    
        (PLOTDEVICES)........1218 / 1.00 <fastest>
        (GETPLOTDEVICES).....1219 / 1.00 <slowest>
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...


  7. #7
    Senior Member Small Fish's Avatar
    Using
    AutoCAD 2010
    Join Date
    May 2009
    Location
    Tauranga, New Zealand
    Posts
    203

    Default

    Thanks Alan and Lee mac

    .....so it was the old "vla-RefreshPlotDeviceInfo"
    function that I needed .

    cheers
    .

  8. #8
    Forum Deity alanjt's Avatar
    Using
    Civil 3D 2009
    Join Date
    Apr 2008
    Posts
    3,862

    Default

    Quote Originally Posted by Small Fish View Post
    Thanks Alan and Lee mac

    .....so it was the old "vla-RefreshPlotDeviceInfo"
    function that I needed .

    cheers
    .
    Enjoy and have a good weekend.
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...


  9. #9
    Senior Member Small Fish's Avatar
    Using
    AutoCAD 2010
    Join Date
    May 2009
    Location
    Tauranga, New Zealand
    Posts
    203

    Default

    One more question...
    I would like to alert/princ the user that there are one or more tabs that have 'none' as the plot device - how do I check for any 'none' pairs in the dvc dotted pair list?
    thanks

  10. #10
    Forum Deity alanjt's Avatar
    Using
    Civil 3D 2009
    Join Date
    Apr 2008
    Posts
    3,862

    Default

    Quote Originally Posted by Small Fish View Post
    One more question...
    I would like to alert/princ the user that there are one or more tabs that have 'none' as the plot device - how do I check for any 'none' pairs in the dvc dotted pair list?
    thanks
    Maybe something like this...
    Code:
    (and (setq #Alert "")
         (foreach x (GetPlotDevices)
           (and (eq "None" (cdr x))
                (setq #Alert (strcat #Alert (car x) "\n"))
           ) ;_ and
         ) ;_ foreach
         (alert (strcat "Layouts without defined plotter devices:\n\n" #Alert))
    ) ;_ and
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...


Similar Threads

  1. Extract device information
    By dhl in forum MEP
    Replies: 4
    Last Post: 28th Oct 2009, 12:49 am
  2. Electrical device
    By dhl in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 13th Oct 2009, 09:25 pm
  3. Auto-rotating device labels
    By magic_man1 in forum Autodesk Revit
    Replies: 0
    Last Post: 30th Sep 2009, 09:18 pm
  4. Plot Device Display
    By feargt in forum CAD Management
    Replies: 15
    Last Post: 15th May 2009, 03:35 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts