Author Topic: workspace...  (Read 2022 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
workspace...
« on: May 29, 2006, 09:18:02 AM »
Hi all..

Question #1:

I'm trying to found a way to get the WORKSPACE list available.
something like..
(setq WS (getworkspacelist))

Question #2:
Is it possible to export this Workspace list without creating a routine ?

thanks.
Keep smile...

sinc

  • Guest
Re: workspace...
« Reply #1 on: May 29, 2006, 10:07:59 AM »
Hi all..

Question #1:

I'm trying to found a way to get the WORKSPACE list available.
something like..
(setq WS (getworkspacelist))

Question #2:
Is it possible to export this Workspace list without creating a routine ?

thanks.

CUI data does not seem to be included in the object model, so I don't think it can be accessed by third-party routines.  But why do you want to do either of those things?

The "Transfer" tab in the CUI can transfer Workspaces among profiles (as long as you have Partial CUIs loaded appropriately).

I would expect that to be sufficient.  Why do you need to access them via code?  If you want to change a default Workspace in your Enterprise CUI, just change it.  And you really shouldn't be changing private Workspaces created by your users - those should be under the control of the individual user.  I can't figure out why you would even want to list them...  So why do you need to access them in code at all?

If you are trying to write a routine that changes the current workspace, then I would not do that.  The purpose of the Workspace is for the USER to customize the USER's working environment.  It would be improper for a routine to say "I know best - you will have your workspace setup this way", even if it seems convenient for some reason or other.

But .CUI files are simple XML files.  So you may be able to figure out whatever you want by looking right at the .CUI file in a text editor, or by parsing the XML in a routine.  It would only show you which workspaces are defined in which CUI file, though - if you want to see what workspaces are currently-available, you would have to examine the User Preferences in order to see which CUI files are loaded, then parse those CUI files.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: workspace...
« Reply #2 on: May 29, 2006, 10:27:29 AM »
sinc...

Many users here work for diffrent departement..
so we have many profile setted for many diffrent menu..

ex:
a simple user can work on ELECTRICAL CIVIL and MECHANICAL in a same day..
depending the job..

so he need to change profile or workspace depending the AutoCAD version.
Also....the same PC can be use for 2 or 3 diffrent user.

The idea here is to set automaticly the good profile and/or workspace depending the "LOGINNAME" and the department setted in a variable drawing.

the all the youser need to do..is to open the drawing and the workspace or profile change for his use.

This Idea comes when i see users changing always the WSCURRENT or CPROFILE variable.
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: workspace...
« Reply #3 on: May 26, 2016, 10:16:29 AM »
Hi all,..just adding info on how I did this..
but it must be interesting to know if there is something more efficient or better codding..
Thank you.


Code: [Select]
(defun getworkspacelist (/ openlogfile logfile L1 WSlist)
(setvar 'cmdecho 0)
(setvar 'LOGFILEMODE 0)
(setq openlogfile (open (setq logfile (getvar 'LOGFILENAME)) "W"))
(write-line "" openlogfile)
(close openlogfile)
(setvar 'LOGFILEMODE 1)
(command "._WORKSPACE" "?")
  (graphscr)
(setvar 'LOGFILEMODE 0)
(setq openlogfile (open logfile "R"))
(setq L1 (read-line openlogfile))
(while L1

  (if (eq (substr L1 1 3) "---")
    (progn     
      (read-line openlogfile)
      (Setq L1 (read-Line openlogfile))
      (while (and L1
  (read L1)
  )
(setq WSlist (append WSlist (list L1)))
(Setq L1 (read-Line openlogfile))
)
      (setq L1 nil)
      )
    )
  (setq L1 (read-line openlogfile))
  )
(close openlogfile)
(princ)
  WSlist
)

(setq WS (getworkspacelist))
« Last Edit: May 26, 2016, 11:52:04 AM by Andrea »
Keep smile...