Author Topic: How to insure plotstamp is always on when plotting and publishing  (Read 9051 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
Hello all,

I am looking for a way to insure that the plotstamp is always on when i print or publish drawings. I was looking in here and found a post which has this bit of code. I kinda understand it but also need to include the publish command and am not sure how to implement it?

Code: [Select]
Private Sub AcadDocument_BeginPlot(ByVal DrawingName As String)

ThisDrawing.SendCommand ("-plotstamp" & vbCr & "on" & vbCr & vbCr)

End Sub

Guest

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #1 on: August 24, 2007, 09:30:24 AM »
You can change it thru the registry prior to printing/plotting/publishing.

It's located here: HKCU\Software\Autodesk\.......\Profiles\<Your Profile Name>\Dialogs\PlotStamp

Change the PlotStamp setting to 1 to turn it on; 0 will turn it off.

ELOQUINTET

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #2 on: August 24, 2007, 09:55:59 AM »
ummmm and how would i incorporate this into a routine that runs when the plot or publish event happens. I know how to turn it on but want to not have to worry about turning it on. I want it to always be on.

Guest

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #3 on: August 24, 2007, 10:10:05 AM »
To do it using VBA will take more code than using LSP, so with that said, I offer up this little bit o' code that you can add into the ACAD.lsp file which will set the value to 1 (on) every time you start AutoCAD.

Code: [Select]

   (vl-load-com)
   (vl-registry-write (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar "cprofile") "\\Dialogs\\Plot Stamp\\") "PlotStamp" 1)

And that's all you need.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #4 on: August 24, 2007, 10:16:00 AM »
It's located here: HKCU\Software\Autodesk\.......\Profiles\<Your Profile Name>\Dialogs\PlotStamp
How did you find that?  I was looking thru the registry for just such a setting, and I could find the plotstamp stuff, but not the ON/OFF setting?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Guest

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #5 on: August 24, 2007, 10:20:18 AM »
It's located here: HKCU\Software\Autodesk\.......\Profiles\<Your Profile Name>\Dialogs\PlotStamp
How did you find that?  I was looking thru the registry for just such a setting, and I could find the plotstamp stuff, but not the ON/OFF setting?
I have my ways! :wink:

I just did a search for PLOTSTAMP and when I saw the REG_DWORD setting, I figured I was on to something.  So I turned on the plot stamp, jumped back to the registry, refreshed it, and yup!  The setting changed from 0 to 1.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #6 on: August 24, 2007, 10:23:14 AM »
I guess I gave up too soon :-(  That was just what I was looking for.  Since we now know where it is, I have a VBA solution if anybody is interested
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Guest

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #7 on: August 24, 2007, 10:24:47 AM »
I guess I gave up too soon :-(  That was just what I was looking for.  Since we now know where it is, I have a VBA solution if anybody is interested

Are you using a registry class to change the settings or do you have a reference to some file?  Just curious.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #8 on: August 24, 2007, 10:34:43 AM »
This is the registry code I have for creating custom keys.  It could be modified to change that plot stamp key as well.  I got the profile name, but haven't found the version key yet.  As soon as I get that, I can update that key as well.  Anyway, here is my reg code
Code: [Select]
Sub Create3dTepRegValues()  ' Must add reference to Windows Script Host Object Model
      Dim scrpt As New WshShell
      Dim DataVal As String
      Dim regKey As String
      regKey = "HKEY_CURRENT_USER\Software\Autodesk\Tep3D\VoltageClass"
      scrpt.RegWrite regKey, 138
      regKey = "HKEY_CURRENT_USER\Software\Autodesk\Tep3D\InsulatorType"
      scrpt.RegWrite regKey, 1
      regKey = "HKEY_CURRENT_USER\Software\Autodesk\Tep3D\ConnectionType"
      scrpt.RegWrite regKey, 1
      regKey = "HKEY_CURRENT_USER\Software\Autodesk\Tep3D\HighBus"
      scrpt.RegWrite regKey, 162
      regKey = "HKEY_CURRENT_USER\Software\Autodesk\Tep3D\LowBus"
      scrpt.RegWrite regKey, 90
      regKey = "HKEY_CURRENT_USER\Software\Autodesk\Tep3D\BusHighLow"
      scrpt.RegWrite regKey, 1
      regKey = "HKEY_CURRENT_USER\Software\Autodesk\Tep3D\PhaseSpacing"
      scrpt.RegWrite regKey, 120
End Sub

Function getRegVal(DataVal As String) As String
      Dim scrpt As New WshShell
      getRegVal = scrpt.RegRead(DataVal)
End Function

Function setRegVal(regKey As String, DataVal As String) As String
      Dim scrpt As New WshShell
      scrpt.RegWrite regKey, DataVal
End Function
The last 2 functions are my GET/SET functions I can call from other modules
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #9 on: August 24, 2007, 10:36:16 AM »
Are you using a registry class to change the settings or do you have a reference to some file?  Just curious.
Must add reference to Windows Script Host Object Model

On a side note, your (vlax-product-key) is what I need for the VBA solution.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Guest

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #10 on: August 24, 2007, 10:56:17 AM »
Are you using a registry class to change the settings or do you have a reference to some file?  Just curious.
Must add reference to Windows Script Host Object Model


Yeah... that's much better than the lines upon lines of code needed for the registry class.

Have you used the VLAX.cls from Frank O?  It works pretty good for evaluating LSP expressions from VBA.


Code: [Select]
Public Sub Vlax_Product_Key()
    Dim obj As VLAX
    Dim Key As String
    Dim Prof As String
   
    Set obj = New VLAX
    Key = obj.EvalLispExpression("(vlax-product-key)")
    Prof = obj.EvalLispExpression("(getvar ""cprofile"")")
   
    Debug.Print "HKEY_CURRENT_USER\" & Key & "\Profiles\" & Prof & "\Dialogs\Plot Stamp\PlotStamp"
End Sub

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #11 on: August 24, 2007, 11:07:16 AM »
Have you used the VLAX.cls from Frank O? 
no, I never really learned VLisp enough to use the vl stuff in lisp, so I never explored it in VBA.  Where does one get it?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Guest

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #12 on: August 24, 2007, 11:10:22 AM »
The file I posted in the previous reply has it.

ELOQUINTET

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #13 on: August 24, 2007, 01:23:20 PM »
hey guys wow you've been busy. i already have some code in our acad.lsp

(command "-plotstamp" "on" "")

to turn it on but i am looking for a more fool proof way so if it gets turned off during a session when the user plots it gets turned back on. I thought i could do this by adding this to the plot and publish buttons which i use but my boss says that sometimes she uses these but other times she types plot in which case it doesn't turn it on. That's why i was thinking it would be a better route to go the event route wherein if plot or publish commands are issued the plotstamp is turned on. do you understand what i'm wanting now?

Guest

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #14 on: August 24, 2007, 01:38:47 PM »
Okay... Here you go.  Using Duh's idea of the WshShell (which you'll need to add a reference to) and VLAX.cls here's what I came up with.  The attached file has everything you need.

Code: [Select]
Option Explicit

Public strPlotStampLocale As String


Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
    Dim oWsh As WshShell

    GetPlotStampLocation
    Select Case UCase(CommandName)
        Case Is = "PUBLISH"
            Set oWsh = New WshShell
            oWsh.RegWrite strPlotStampLocale, "1", "REG_DWORD"
            Set oWsh = Nothing
        Case Is = "PLOT"
            Set oWsh = New WshShell
            oWsh.RegWrite strPlotStampLocale, "1", "REG_DWORD"
            Set oWsh = Nothing
    End Select
End Sub

Private Sub GetPlotStampLocation()
    Dim obj As VLAX
    Dim Key As String
    Dim Prof As String
   
    Set obj = New VLAX
    Key = obj.EvalLispExpression("(vlax-product-key)")
    Prof = obj.EvalLispExpression("(getvar ""cprofile"")")
   
    strPlotStampLocale = "HKEY_CURRENT_USER\" & Key & "\Profiles\" & Prof & "\Dialogs\Plot Stamp\PlotStamp"
End Sub