Author Topic: saving and loading support paths  (Read 2984 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
saving and loading support paths
« on: July 14, 2005, 11:53:06 AM »
i have this lisp which i am hoping i can get some help improving. my boss wants me to create a toolbar which would allow the user to save the current support paths and then be able to load either the local support path or the server path. i modified this lisp creating a local and server save and load lisp. how can i read which is the active profile and save the current search paths to the appropriate files so the load function would work? or is there a better way i might be able to acheive this?

Code: [Select]
;;; Copyright (C) 1997-2003 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com / http://jtbworld.vze.com
;;; E-mail: info@jtbworld.com / jtbworld@hotmail.com
;;;
;;; Save and loads support paths to a text file
;;;
;;; Change the path as wished

(defun C:ssp (/ files paths f)
  (vl-load-com)
  (setq files (vla-get-files (vla-get-preferences (vlax-get-acad-object))))
  (setq paths (vla-get-supportpath files))
  (setq f (open "c:\\0_LISP_FILES/paths.txt" "w"))
  (write-line paths f)
  (close f)
  (princ)
)

(defun C:lsp (/ files paths f)
  (vl-load-com)
  (setq files (vla-get-files (vla-get-preferences (vlax-get-acad-object))))
  (setq f (open "c:\\0_LISP_FILES/paths.txt" "r"))
  (setq paths (read-line f))
  (close f)
  (vla-put-supportpath files paths)
  (princ)
)

pmvliet

  • Guest
saving and loading support paths
« Reply #1 on: July 14, 2005, 12:24:28 PM »
is this with intentions of a laptop user who maybe connected to the network or possibly out in the field running standalone?

You could extract the given paths and compare it to the known set of local or network drives. If it equals one, you know what it is currently set at.

Pieter

Crank

  • Water Moccasin
  • Posts: 1503
saving and loading support paths
« Reply #2 on: July 14, 2005, 12:32:03 PM »
If you make 2 diffferent workspaces, then you only have to change the variable WSCURRENT.

Stupid typos :P
Vault Professional 2023     +     AEC Collection

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
saving and loading support paths
« Reply #3 on: July 14, 2005, 12:33:50 PM »
Maybe create three environment variables which contain the paths then simply switch the path by reading the variables.
Code: [Select]

(setenv "E_USER_PATH" "<current user path>")
(setenv "E_LOCAL_PATH" "<local path>")
(setenv "E_NETWORK_PATH" "<network path>")
TheSwamp.org  (serving the CAD community since 2003)

ELOQUINTET

  • Guest
saving and loading support paths
« Reply #4 on: July 14, 2005, 02:07:54 PM »
mark could i incorporate that into the code i provided or no. i was thinking i would like to have the load path routine prompt the user to load the local or server path. i'm not sure how to put this all together?

ELOQUINTET

  • Guest
saving and loading support paths
« Reply #5 on: July 14, 2005, 02:09:54 PM »
and no this isn't for field use, our server is shakey so i want to easily be able to switch when it goes on the fritz. also i'm the only one with 2006 here so the workspace option won't work.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
saving and loading support paths
« Reply #6 on: July 14, 2005, 02:17:36 PM »
Something like this might do it.
Code: [Select]

(vla-put-supportpath (getenv "<network path>"))
TheSwamp.org  (serving the CAD community since 2003)

pmvliet

  • Guest
saving and loading support paths
« Reply #7 on: July 14, 2005, 02:45:17 PM »
since you want it run via toolbars.
have Mark's  routine defined with a defun c:X1
then have your toolbar ^c^cX1 to initiate.

X1 can be defined to export the current user search paths to file.

next button can be defined as X2 and can set the search paths local.

The third button can be defined as X3 and can set the search paths to the network.

If you only want 2 buttons, combine X1 into the start of X2 and X3.

Pieter