Jump to content

Hi, Restore to WCS ?


andy_lee

Recommended Posts

Hi guys

 

Some times, there are some lisp code can't run on "UCS Mode" ,Only On "WCS",

How to do?

 

I think, maybe add "restore to WCS" at the beginning .

 

I need some code . help!

Link to comment
Share on other sites

(defun c:foo ( / vars... )

 (command "_.ucs" "_w")
 ...
 (etc...)
 ...
 (command "_.ucs" "_p")
 (princ)
)

 

Marko.Thank you!

When error ,how "(command "_.ucs" "_p")" ?o:)

Link to comment
Share on other sites

Add:

(command "_.ucs" "_p")

To the *error* function (if present), else define your own local *error* function containing this expression.

 

More information on how to define an *error* function can be found here.

Link to comment
Share on other sites

How add:

(command "_.ucs" "_p")

to this function ?

 

(defun c:test ( / *error* osm )
 
   (defun *error* ( msg )
       (if osm (setvar 'osmode osm))
       (if (not (member msg '("Function cancelled" "quit / exit abort")))
           (princ (strcat "\nError: " msg))
       )
       (princ)
   )

   (setq osm (getvar 'osmode))
   (setvar 'osmode 0)

   (rtos (getreal "\nPress Esc to exit, press Enter to force an error ..."))

   (setvar 'osmode osm)
   (princ)
)

Link to comment
Share on other sites

(defun c:test ( / *error* osm )
 
   (defun *error* ( msg )
       (if osm (setvar 'osmode osm))
       (if (= (getvar 'worlducs) 1) (command "_.ucs" "_p"))
       (if (not (member msg '("Function cancelled" "quit / exit abort")))
           (princ (strcat "\nError: " msg))
       )
       (princ)
   )

   (setq osm (getvar 'osmode))
   (setvar 'osmode 0)
   (command "_.ucs" "_w")

   (rtos (getreal "\nPress Esc to exit, press Enter to force an error ..."))

   (*error* nil)
   (princ)
)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...