Jump to content

Don't even know if this is possible but.


NH3man!

Recommended Posts

I am having problems due to my file size. I have had to turn off auto save because if it tries to save the same time I am trying to do another function my system will lock up and go into fatal error and I loose all I have done from my last manual quick save. I try to remember to do it before I do anything that will cause the fatal error ( which are mainly from adding Xref's and trying to orbit my models) but I find that I don't as much as I would wish.

 

What I am asking is if it is possible to do a Save with a lisp if an orbit or and Xref command is called first.

 

I hope this is possible but if it is not I will just have to get better at saving before I do either of these.

 

Thanks

 

NH3man!

Link to comment
Share on other sites

I am having problems due to my file size. I have had to turn off auto save because if it tries to save the same time I am trying to do another function my system will lock up and go into fatal error and I loose all I have done from my last manual quick save. I try to remember to do it before I do anything that will cause the fatal error ( which are mainly from adding Xref's and trying to orbit my models) but I find that I don't as much as I would wish.

 

What I am asking is if it is possible to do a Save with a lisp if an orbit or and Xref command is called first.

 

I hope this is possible but if it is not I will just have to get better at saving before I do either of these.

 

Thanks

 

NH3man!

 

(defun C:so()
 (command"save" "")
 (command"orbit")
)

 

The only solution I can think of at the moment would be to create functins similar to the one above.

 

I'm not sure how you would replace crt+middle mouse to this though

 

Ollie

Link to comment
Share on other sites

I would suggest reactors being a solution

Im not sure if a quick save could work, a bit of trial and error.

here is an example, for any dims to go to dim layer

 

(vl-load-com)
(vlr-command-reactor nil '
  ((:vlr-commandWillStart . startCommand)
  (:vlr-commandEnded . endcancelCommand)
  (:vlr-commandCancelled . endcancelCommand))
 ); end vlr-command-reactor
;******************************************************
(defun startCommand (calling-reactor startcommandInfo)
(if (= 1 (getvar "dimlfac"))
 (setvar "dimclrt" 2)
 (setvar "dimclrt" 3)
 )
 (if (wcmatch (car startcommandInfo) "DIM*")
(progn
 (setq dimOldLayer (getvar "CLAYER"))
 (setvar "CLAYER" "dim"))
   ); end if
(princ)
);defun
;****************************************************
(defun endcancelCommand (calling-reactor endcommandInfo)
(if(wcmatch (car endcommandInfo)"DIM*")
 (progn
  (if (= dimoldlayer "dim")
   (setvar "CLAYER" "yellow")
   (setvar "CLAYER" dimoldlayer)
  )
  (setvar "dimclrt" 2)
 )
   ); end if 
(princ)
);defun

Link to comment
Share on other sites

I agree, a reactor would be a good call - hopefully the system won't freeze when the quick save is called.

 

It would have to be through VL however, as command calls do not mix with reactors. :geek:

 

Lee

Link to comment
Share on other sites

Depending on how orbit and xref are called in your setup, you could also use undefine and a new (defun) of the command. -David

Link to comment
Share on other sites

Not sure if this would work for you?

 

(defun c:ReON ()
 (vl-load-com)
 (if (not *Save:React*)
   (progn
     (setq *Save:React*
       (vlr-command-reactor nil
         (list
           (cons :vlr-CommandWillStart 'StrtComm))))
     (princ "\n<< Reactor Initiated >>")))
 (princ))

(defun StrtComm (React Args / *doc)
 (if (vl-position
       (strcase (car Args))
         '("3DORBIT"))  ; <<-- Populate Commands Here
   (progn
     (setq *doc
       (vla-get-ActiveDocument
         (vlax-get-acad-object)))
     (if (not (eq "" (vla-get-FullName *doc)))
       (vla-save *doc)
       (vla-saveas *doc
         (strcat
           (vla-get-Path *doc) "\\"
             (vla-get-name *doc))))))
 (princ))

(defun c:ReOFF ()
 (if *Save:React*
   (progn
     (vlr-remove *Save:React*)
     (setq *Save:React* nil)
     (princ "\n<< Reactor Deactivated >>")))
 (princ))
         

Link to comment
Share on other sites

Yer true, Ive always just let them run in the back ground not noticing them aye.

 

Also while you here,

What is the funtion to organise a list in order, I know their is one for words, but is their for numbers?

Link to comment
Share on other sites

Yer true, Ive always just let them run in the back ground not noticing them aye.

 

Also while you here,

What is the funtion to organise a list in order, I know their is one for words, but is their for numbers?

 

vl-sort can sort a list using a predicate function, hence:

 

(setq lst '(3 5 2 4 1))

(vl-sort lst
 (function
   (lambda (x y) (< x y))))

will return:

(1 2 3 4 5)

 

Lee

Link to comment
Share on other sites

I tried it Lee but how do I know it does a save. I don't see it in the command line. Is it an auto function that is not displayed?

Link to comment
Share on other sites

Yer, reactors work in the back ground, with no input/output from/to user.

 

Check the file, it will say when it was last saved

Link to comment
Share on other sites

I tried it Lee but how do I know it does a save. I don't see it in the command line. Is it an auto function that is not displayed?

 

As flower says, you won't visually see the results, as I have used the VL save method - so it won't show at the command line. :)

 

Lee

Link to comment
Share on other sites

That is great Lee. You will save me and I won't even know it till I go to reopen and all my work is still there. Thank you!

Link to comment
Share on other sites

No probs :)

 

Switch the reactor on and off using ReOn and ReOff, and you can use this if you like to give you some assurance that it has worked:

 

(defun c:ReON ()
 (vl-load-com)
 (if (not *Save:React*)
   (progn
     (setq *Save:React*
       (vlr-command-reactor nil
         (list
           (cons :vlr-CommandWillStart 'StrtComm))))
     (princ "\n<< Reactor Initiated >>")))
 (princ))

(defun StrtComm (React Args / *doc)
 (if (vl-position
       (strcase (car Args))
         '("3DORBIT"))  ; <<-- Populate Commands Here
   (progn
     (setq *doc
       (vla-get-ActiveDocument
         (vlax-get-acad-object)))
     (if (not (eq "" (vla-get-FullName *doc)))
       (vla-save *doc)
       (vla-saveas *doc
         (strcat
           (vla-get-Path *doc) "\\"
             (vla-get-name *doc))))
     (princ "\n** Document Saved **\n")))
 (princ))

(defun c:ReOFF ()
 (if *Save:React*
   (progn
     (vlr-remove *Save:React*)
     (setq *Save:React* nil)
     (princ "\n<< Reactor Deactivated >>")))
 (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...