Author Topic: Prevent users changing plotdevice (or at least alert them)  (Read 2072 times)

0 Members and 1 Guest are viewing this topic.

bilançikur

  • Newt
  • Posts: 82
Prevent users changing plotdevice (or at least alert them)
« on: March 06, 2017, 02:22:36 AM »


Hi all,

I have searched the internet but was not able to find anything about this. Maybe I search with the wrong keywords, my bad.

Here's the thing; there are users in our company that keep switching the page setup plotter, sometimes without even realising they do.

I have set all our layouts in many dwg files "dwg to pdf" and I want to keep it that way, just for the ease of plotting multiple pdf's into 1 file. This works fast an convenient.

Is there a way to prevent users from changing the plot device? In model space I dont care what happens but in the layouts I want to keep the plot devide "dwg to pdf".

If not, then just a simple alert would be best (alert "You will be punnished!").

Thanks a lot for thinking with me.

Chris

  • Swamp Rat
  • Posts: 548
Re: Prevent users changing plotdevice (or at least alert them)
« Reply #1 on: March 06, 2017, 07:32:54 AM »
As an alternative, do you use named page setups?  if you do, you could just restore it in your batch plot, then it doesnt matter what they do.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Prevent users changing plotdevice (or at least alert them)
« Reply #2 on: March 06, 2017, 08:22:05 AM »
one can add a reactor

bilançikur

  • Newt
  • Posts: 82
Re: Prevent users changing plotdevice (or at least alert them)
« Reply #3 on: March 06, 2017, 08:44:12 AM »
Chris & Vovka, thanks for the reply.

I will investigate the "named page setups" for I do not know it.

The reactor was my first guess but I wouldnt know where to look to get started.

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Prevent users changing plotdevice (or at least alert them)
« Reply #4 on: March 06, 2017, 09:12:02 AM »
The reactor was my first guess but I wouldnt know where to look to get started.
Code: [Select]
(or (vl-some (function (lambda (r) (= (vlr-data r) "LayoutCheck")))
     (cdar (vlr-reactors :VLR-AcDb-Reactor))
    )
    (vlr-acdb-reactor "LayoutCheck" (list (cons :vlr-objectModified 'LayoutCheck)))
)
(defun LayoutCheck (reactor_object obj / ent)
  (setq ent (entget (cadr obj)))
  (if (= (cdr (assoc 0 ent)) "LAYOUT")
    (if (/= (cdr (assoc 0 ent)) "dwg to pdf.pc3")
      (alert "You will be punnished!")
    )
  )
)

Chris

  • Swamp Rat
  • Posts: 548
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

bilançikur

  • Newt
  • Posts: 82
Re: Prevent users changing plotdevice (or at least alert them)
« Reply #6 on: March 07, 2017, 03:47:36 AM »
The reactor was my first guess but I wouldnt know where to look to get started.
Code: [Select]
(or (vl-some (function (lambda (r) (= (vlr-data r) "LayoutCheck")))
     (cdar (vlr-reactors :VLR-AcDb-Reactor))
    )
    (vlr-acdb-reactor "LayoutCheck" (list (cons :vlr-objectModified 'LayoutCheck)))
)
(defun LayoutCheck (reactor_object obj / ent)
  (setq ent (entget (cadr obj)))
  (if (= (cdr (assoc 0 ent)) "LAYOUT")
    (if (/= (cdr (assoc 0 ent)) "dwg to pdf.pc3")
      (alert "You will be punnished!")
    )
  )
)

This would be the way to go I think. A reactor that would give a message that the Plot Device was changed wich is not allowed.
But I have tried this routine and it keeps alerting, whens saving the drawing, when switching layouts etc.
The plot device's name is correct on all layouts but still it alerts.

Maybe it needs more thinking, only alert if the plot device's name was changed from "DWG To PDF.pc5" to anything else.
But I have no clue. If you could help it would be cool.
If not, then is't is okay as well, I am glad with the help so far.

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Prevent users changing plotdevice (or at least alert them)
« Reply #7 on: March 07, 2017, 05:25:37 AM »
oh, sorry my bad
change
Code: [Select]
(/= (cdr (assoc 0 ent)) "dwg to pdf.pc3")to
Code: [Select]
(/= (cdr (assoc 2 ent)) "dwg to pdf.pc3")
you may also add strcase when comparing strings

bilançikur

  • Newt
  • Posts: 82
Re: Prevent users changing plotdevice (or at least alert them)
« Reply #8 on: March 08, 2017, 01:42:39 AM »
No probs VovKa but the modification doesn't change the behaviour of the program.
Let's call it a day for I don't have a clue how to make the reactor work like how I want.
Thanks again.