Author Topic: How to insure plotstamp is always on when plotting and publishing  (Read 9053 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

ELOQUINTET

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #15 on: August 24, 2007, 01:55:11 PM »
matt,

first of all thank you for helping me out. i have a couple of questions.

1 refresh my memory on how i add a reference to wshshell

2 would it be possible to also incorporate a regen when plotting and a regen and qsave when publishing.

we actually have a traditional plotstamp and a filename stamp which is rtext and requires a regen. the qsave in the publish is so we there won't be any unsaved changes which would prevent us from saving the dsd file. i have this built into our buttons but would like to fool proof this process too.

Is this possible?

Guest

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #16 on: August 24, 2007, 02:01:03 PM »
matt,

first of all thank you for helping me out.

No problem.  You're welcome.


1 refresh my memory on how i add a reference to wshshell

Tools --> References


2 would it be possible to also incorporate a regen when plotting and a regen and qsave when publishing.

we actually have a traditional plotstamp and a filename stamp which is rtext and requires a regen. the qsave in the publish is so we there won't be any unsaved changes which would prevent us from saving the dsd file. i have this built into our buttons but would like to fool proof this process too.

Is this possible?

RTEXT is history....Use FIELDS instead.  There are options you can set that determine whey they get updated.

ELOQUINTET

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #17 on: August 24, 2007, 02:10:10 PM »
Matt i have both of them loaded but when i try to add a reference to WshShell it does not appear in the list? All I see under WSH is wshcontrollerlibrary is this it?

I tried using fields for this but found that it did not always update but rtext did so I used that. I don't recall exactly what the problem was so maybe I will have to revisit that when I have more time. Now I'm most concerned with the plotstamp.

Guest

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #18 on: August 24, 2007, 02:12:10 PM »
Matt i have both of them loaded but when i try to add a reference to WshShell it does not appear in the list? All I see under WSH is wshcontrollerlibrary is this it?

I tried using fields for this but found that it did not always update but rtext did so I used that. I don't recall exactly what the problem was so maybe I will have to revisit that when I have more time. Now I'm most concerned with the plotstamp.

Both of WHAT loaded??  The DVB I posted already has a reference to WshShell (it shows up at the top of the list, already checked).

ELOQUINTET

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #19 on: August 24, 2007, 02:28:25 PM »
yes i kinda figured it out on my own that WSH was an abbreviation for Windows Script Host. Forgive me I'm a novice but when you said I needed to add something you neglected to tell me that you already added it  :| It appears to be working just as I wanted it to so thank you very much sir. I will have to try to reproduce my Fields problem and report it to you but this will have to wait until monday as I have something else to do today. Thanks again

Guest

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #20 on: August 24, 2007, 02:30:07 PM »
You're welcome.  Glad you got it working.

ELOQUINTET

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #21 on: December 06, 2007, 12:14:54 PM »
Hey guys I just got a new computer in our department and the vba routine I had running to insure the plotstamp is updated upon printing is now giving me an error upon startup. When I click on debug it highlights this line:

Set obj = New VLAX

Do I need to put some files on this new computer to get it to work?

ELOQUINTET

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #22 on: December 06, 2007, 04:38:24 PM »
i think i figured out the problem. the new computer only has office 2002 whereas others have 2003 and the excel 11.0 is missing from the references. so is there anyway i can make it work across multiple versions or no?

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #23 on: December 07, 2007, 12:32:36 PM »
there is a way, but I dont know how to do it.  I think Bob knows how.  I vaguely remember him doing something like that
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)

Bob Wahr

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #24 on: December 07, 2007, 02:12:05 PM »
Wasn't my problem so I don't remember what I came up with, although I somewhat remember it happening.  It seems like it was here though so a search might turn it up.

ELOQUINTET

  • Guest
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #25 on: December 10, 2007, 08:46:45 AM »
I got them to update the office and it works now. I was more curious than anything to see if it is possible.

Bryco

  • Water Moccasin
  • Posts: 1882
Re: How to insure plotstamp is always on when plotting and publishing
« Reply #26 on: December 10, 2007, 10:49:28 AM »
You don't need to add a reference to excell to use it.
Late bind it  like below.
   
Code: [Select]
Dim Excel As Object
    'Dim Excel As Excel.Application
    Dim ExcelWorkbook As Object
    'Dim ExcelWorkbook As Workbook
    Dim ExcelSheet As Object
    'Dim ExcelSheet As WorkSheet

The bad part is intellisense doesn't work and latebinding is very slow.

I couldn't find a way to uncheck a wrong reference (say 2003 on the 2002) programmatically, so the late binding is the easiest way to handle multi -versions