Author Topic: How to get *.plt file's path and name?  (Read 1539 times)

0 Members and 1 Guest are viewing this topic.

connieleo

  • Guest
How to get *.plt file's path and name?
« on: July 19, 2006, 09:06:49 AM »
Afte I create *.plt files with plot dialog, I want to write the *.plt file's path and name in the *.txt ? How can I  get *.plt file's path and name after print dialog disappear? Thank a lot.

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: How to get *.plt file's path and name?
« Reply #1 on: July 21, 2006, 08:05:38 AM »
Assuming you are plotting to the default path...

Code: [Select]
(strcat
  (vla-get-DefaultPlotToFilePath
    (vla-get-output
      (vla-get-preferences (vlax-get-acad-object))
    )
  )
  "\\"
  (vl-string-right-trim ".dwg" (getvar "dwgname"))
  "-"
  (getvar "ctab")
  ".plt"
)

connieleo

  • Guest
Re: How to get *.plt file's path and name?
« Reply #2 on: July 21, 2006, 10:56:49 AM »
If I change the save path and plt name, I can't get it. Is the plt information exit in Regedit? Thants.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to get *.plt file's path and name?
« Reply #3 on: July 21, 2006, 11:54:07 AM »
Maybe this will help you.

Quote from: SMadsen

As far as I know, the previous plot settings are stored in the registry under the current profile name -HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\< releaseno. >\< versionspec >\Profiles\< profilename >\Previous plot settings\Model - but I'm not sure if it includes a plot-to-file record. In fact, I don't think it's included.

By getting the active profile from the preferences and the productkey, you can piece together a string to read the registry keys. For example:


Code: [Select]
(defun readPrevPlot ()
  (setq prefs         (vla-get-preferences (vlax-get-acad-object))
        activeProfile (vla-get-activeprofile (vla-get-profiles prefs))
        acadkey       (vlax-product-key)
  )
  (setq keyString (strcat "HKEY_CURRENT_USER\\" acadkey "\\Profiles\\"
                          activeProfile "\\Previous plot settings"))
  (princ (strcat "\nLast plot configuration file, model:  "
                 (cond ((vl-registry-read (strcat keyString "\\Model") "Cfg Name")) ("None"))))
  (princ (strcat "\nLast plot configuration file, layout: "
                 (cond ((vl-registry-read (strcat keyString "\\Layout") "Cfg Name")) ("None"))))
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.