Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LISP: Check for Workspace

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
john.laidler
7558 Views, 5 Replies

LISP: Check for Workspace

I'm having difficulty with this, and need some help. 

 

What I need is to check to see if a specific workspace is created, and if so set it.  It not, then return with an error message.

I'm having trouble with accessing the already created workspaces, and verifying that the workspace is created.

 

John Laidler
AutoCAD, Inventor and Vault



Please use "Accept as Solution" & give "Kudos" if this response helped you.
5 REPLIES 5
Message 2 of 6
dbroad
in reply to: john.laidler

(getvar "wscurrent") will give you the current workspace.  I would definitely check that first.

 

After that you might look at this thread

 

 

Architect, Registered NC, VA, SC, & GA.
Message 3 of 6
BlackBox_
in reply to: john.laidler


@jclaidler wrote:

I'm having difficulty with this, and need some help. 

 

What I need is to check to see if a specific workspace is created, and if so set it.  It not, then return with an error message.

I'm having trouble with accessing the already created workspaces, and verifying that the workspace is created.

 


Do you have to iterate the existing workspaces provided by Main/Enterprise CUI(x), or is a simple T, or Nil returned value sufficient?

 

(defun _WSCURRENT (workspace)
  ;; Example:
  ;; (_WSCURRENT "YourWorkspaceNameHere")
  (not (vl-catch-all-error-p
         (vl-catch-all-apply 'setvar (list 'wscurrent workspace))
       )
  )
)

 



"How we think determines what we do, and what we do determines what we get."

Message 4 of 6
BlackBox_
in reply to: dbroad


@dbroad3 wrote:

(getvar "wscurrent") will give you the current workspace.  I would definitely check that first.

 

After that you might look at this thread

 

 


If obtaining a list of existing workspaces is essential, methinks it would be simpler, certainly more efficient, to instead employ a .NET LispFunction Method to return such, taking a single string argument (the CUI[x] to cull).

 

Cheers



"How we think determines what we do, and what we do determines what we get."

Message 5 of 6
john.laidler
in reply to: BlackBox_

Thanks... this is exactly what I needed.
John Laidler
AutoCAD, Inventor and Vault



Please use "Accept as Solution" & give "Kudos" if this response helped you.
Message 6 of 6
BlackBox_
in reply to: john.laidler


@jclaidler wrote:
Thanks... this is exactly what I needed.

You're welcome; I'm happy to help. 

 

Cheers :beer:



"How we think determines what we do, and what we do determines what we get."

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost