Author Topic: Put Project in registry  (Read 3343 times)

0 Members and 1 Guest are viewing this topic.

SPDCad

  • Bull Frog
  • Posts: 453
Put Project in registry
« on: October 26, 2005, 10:02:45 AM »
I once new how to  do this, it has been awhile since I did this last, and well i guess I am having a memory laps, so here it goes;  :ugly:

How does one put a project in the registry if given the project name and paths.

Ie. Project = 03003
     Paths  =  “c:\; c:\03003\;c:\03003\working”

I got as far as this;

  (if (= vl-load-com Nil)(vl-load-com));
  (setq  PFL (GET-CPROFILE)
   PTH (strcat "HKEY_CURRENT_USER\\" (vlax-product-key))
      REG-KEY (strcat PTH "\\Profiles\\" PFL "\\Project Settings")
   PTHS (Lst2Str &PTHS ";")
   );

Just for note:
the subprogramme
     -GET-CPROFILE gets the current profile
     -Lst2Str converts a list to a string
AutoCAD 2010, w/ OpenDCL

visit: http://reachme.at/spd_designs

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Put Project in registry
« Reply #1 on: October 26, 2005, 01:01:49 PM »
Something like this maybe.

Code: [Select]
(setq profile (GET-CPROFILE)
(setq val_name "RefSearchPath")
(setq project_path "c:\\temp\\Project4")
(setq project_name "Project4")
(setq new_project (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\" profile "\\Project Settings\\" project_name))

(vl-registry-write new_project val_name project_path)
TheSwamp.org  (serving the CAD community since 2003)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Put Project in registry
« Reply #2 on: October 26, 2005, 01:33:18 PM »
I use these from my library  :
Code: [Select]
(defun SetprojectPath (ProjectName ProjectPath / regPath profile)
  (setq regPath (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles")
        profile (vl-registry-read regPath "")
  )
  (vl-registry-write
    (strcat regPath "\\" profile "\\Project Settings\\" ProjectName)
    "RefSearchPath"
    ProjectPath
  )
  (setvar "PROJECTNAME" ProjectName)
)


(defun GetprojectPath ()
  (vl-registry-read (strcat (setq regPath (strcat "HKEY_CURRENT_USER\\"
                                                  (vlax-product-key)
                                                  "\\Profiles"
                                          )
                            )
                            "\\"
                            (vl-registry-read regPath "")
                            "\\Project Settings\\"
                            (getvar "PROJECTNAME")
                    )
                    "RefSearchPath"
  )
)

.. So you could use something like this ;
Code: [Select]
(defun c:Test ()
(SetprojectPath "03003" "c:; c:\\03003;c:\\03003\\working")

)

.. or this, depending on what you actually want :
Code: [Select]
(defun c:Test ()
(SetprojectPath "03003"  "c:\\03003\\working")

)

which is essentially what Mark suggested.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Put Project in registry
« Reply #3 on: October 26, 2005, 01:38:52 PM »
Am I missing something? This is what I have in my library --

Code: [Select]
(defun SetProjectPath ( Name Path )
    ;;  if it exists it overwrites the path,
    ;;  otherwise it creates the entry
    ;;  path is a semi colon delimited string
    ;;  no hand holding, caller's responsibility
    ;;  to use properly   
    (vla-setprojectfilepath
        (vla-get-files
            (vla-get-preferences
                (vlax-get-acad-object)
            )
        )
        Name
        Path
    )
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Put Project in registry
« Reply #4 on: October 26, 2005, 01:46:20 PM »

of course !

.. suitably humbled ...  :oops:

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Put Project in registry
« Reply #5 on: October 26, 2005, 01:48:30 PM »
No no, I didn't post it to compete, I figured I was missing something!

Aren't I?

Does this truly achieve what SPDCad wants to do?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Put Project in registry
« Reply #6 on: October 26, 2005, 01:52:02 PM »
yep, except make the project current :)

unless I misunderstand  his requirements.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

SPDCad

  • Bull Frog
  • Posts: 453
Re: Put Project in registry
« Reply #7 on: October 26, 2005, 03:01:34 PM »
Thanks everyone one for the help.  I was able to do what I wanted with the information I was provided with. :-D
Thanks again.

AutoCAD 2010, w/ OpenDCL

visit: http://reachme.at/spd_designs