NH3man! Posted July 2, 2009 Share Posted July 2, 2009 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! Quote Link to comment Share on other sites More sharing options...
ollie Posted July 2, 2009 Share Posted July 2, 2009 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 Quote Link to comment Share on other sites More sharing options...
flowerrobot Posted July 2, 2009 Share Posted July 2, 2009 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 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 2, 2009 Share Posted July 2, 2009 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. Lee Quote Link to comment Share on other sites More sharing options...
David Bethel Posted July 2, 2009 Share Posted July 2, 2009 Depending on how orbit and xref are called in your setup, you could also use undefine and a new (defun) of the command. -David Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 2, 2009 Share Posted July 2, 2009 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)) Quote Link to comment Share on other sites More sharing options...
flowerrobot Posted July 2, 2009 Share Posted July 2, 2009 Nice idear of being able to turn it off, instead of always on... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 2, 2009 Share Posted July 2, 2009 Nice idear of being able to turn it off, instead of always on... Thanks Easier than rebooting AutoCAD every time Quote Link to comment Share on other sites More sharing options...
flowerrobot Posted July 2, 2009 Share Posted July 2, 2009 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? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 2, 2009 Share Posted July 2, 2009 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 Quote Link to comment Share on other sites More sharing options...
NH3man! Posted July 3, 2009 Author Share Posted July 3, 2009 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? Quote Link to comment Share on other sites More sharing options...
flowerrobot Posted July 3, 2009 Share Posted July 3, 2009 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 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 3, 2009 Share Posted July 3, 2009 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 Quote Link to comment Share on other sites More sharing options...
NH3man! Posted July 4, 2009 Author Share Posted July 4, 2009 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! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 5, 2009 Share Posted July 5, 2009 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)) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.