Deby Ferdian Posted March 21, 2016 Author Posted March 21, 2016 (edited) It's Awesome! Thank you.. Thank you.. Thank you.. Thank you so much.. Thank you all! Specially for @tombu & @Grr.. That's a greate code what I've ever seen ever.. (it's because I'm newbie here! ^_^") I've been replaced that code to my lsp doc and try with another combination methode and think. Is it possible could be add with any command or options? such as I try to insert Autosnap of Ontrack & Polar functions but without any interfere to which one of where's the buttons have been pressed. Please, see bellow here: (defun c:TGG (/ ) (if (not *ans*) (setq *ans* "Osmode")) (initget "Osmode 3dosmode [color=red][b]lineWeight onTrack Polar[/b][/color]") (setq *ans* (cond ( (getkword (strcat "\nToggle [Osmode/3dosmode/[color=red][b]lineWeight/onTrack/Polar[/b][/color]] <" *ans* ">: "))) ( *ans* ))) (cond ((= *ans* "Osmode") (if (= (getvar 'Osmode ) 24751) (progn (setvar "Osmode" 8367) (princ (strcat "\nOSMODE is set to \"" (rtos(getvar "Osmode") 2 0) "\" (ON)" )) );progn true (progn (setvar "Osmode" 24751) (princ (strcat "\nOSMODE is set to \"" (rtos(getvar "Osmode") 2 0) "\" (OFF)" )) );progn false );if ) ((= *ans* "3dosmode") (if (= (getvar '3dosmode ) 63) (progn (setvar "3dosmode" 62) (princ (strcat "\n3D-osmode is set to \"" (rtos(getvar "3dosmode") 2 0) "\" (ON)" )) );progn true (progn (setvar "3dosmode" 63) (princ (strcat "\n3D-osmode is set to \"" (rtos(getvar "3dosmode") 2 0) "\" (OFF)" )) );progn false );if ) ((= *ans* "lineWeight") (if (= (getvar 'Lwdisplay ) 0) (progn (setvar 'LWDISPLAY 1 ) (princ (strcat "\nLWDISPLAY is set to \"" (rtos(getvar 'Lwdisplay ) 2 0) "\" (ON)" )) );progn true (progn (setvar 'LWDISPLAY 0 ) (princ (strcat "\nLWDISPLAY is set to \"" (rtos(getvar 'Lwdisplay ) 2 0) "\" (OFF)" )) );progn false );if )[color=red][b] ((= *ans* "onTrack") (if (= (getvar 'Autosnap ) 39) (progn (setvar 'Autosnap 55 ) (princ (strcat "\nAUTOSNAP is set to \"" (rtos(getvar 'Autosnap ) 2 0) "\" (ON)" )) );progn true (progn (setvar 'Autosnap 39 ) (princ (strcat "\nAUTOSNAP is set to \"" (rtos(getvar 'Autosnap ) 2 0) "\" (OFF)" )) );progn false );if ) ((= *ans* "Polar") (if (= (getvar 'Autosnap ) 39) (progn (setvar 'Autosnap 47 ) (princ (strcat "\nAUTOSNAP is set to \"" (rtos(getvar 'Autosnap ) 2 0) "\" (ON)" )) );progn true (progn (setvar 'Autosnap 39 ) (princ (strcat "\nAUTOSNAP is set to \"" (rtos(getvar 'Autosnap ) 2 0) "\" (OFF)" ))[/b][/color] );progn false );if ) );cond (princ) );defun Edited March 21, 2016 by Deby Ferdian there are more paragraph sign! Quote
Deby Ferdian Posted March 22, 2016 Author Posted March 22, 2016 Or, this code that what has given by @tombu! It's greate code before when I used it for OSMODE & 3DOSMODE function so far it's works fine and very greate.. but in otherwise when I try with AUTOSNAP for "POLAR" & "ONTRACK". Why??? could you help me? (defun c:OTR ( / csnap) (setq csnap (getvar "Autosnap")) (cond ((= csnap 24)(setvar "Autosnap" 0)) ((< csnap 16)(setvar "Autosnap"(+ csnap 16))) ((> csnap 16)(setvar "Autosnap"(- csnap 16))) ) (cond ((= csnap 24)(princ)) ; ((= csnap 24)(command "'_dsettings")) ((< csnap 16)(princ "\n<Object Snap Tracking off>")) ((>= csnap 16)(princ "\n<Object Snap Tracking on>")) ) (princ) ) (defun c:PLR ( / csnap) (setq csnap (getvar "Autosnap")) (cond ((= csnap 24)(setvar "Autosnap" 0)) ((< csnap (setvar "Autosnap"(+ csnap )) ((> csnap (setvar "Autosnap"(- csnap )) ) (cond ((= csnap 24)(princ)) ; ((= csnap 24)(command "'_dsettings")) ((< csnap (princ "\n<Polar off>")) ((>= csnap (princ "\n<Polar on>")) ) (princ) ) Quote
Lee Mac Posted March 22, 2016 Posted March 22, 2016 Similar to the OSMODE system variable, the AUTOSNAP system variable is bit-coded, therefore, you will need to use bitwise operations (i.e. logior/logand/boole) to enable or disable the settings. Quote
tombu Posted March 22, 2016 Posted March 22, 2016 Or, this code that what has given by @tombu! It's greate code before when I used it for OSMODE & 3DOSMODE function so far it's works fine and very greate.. but in otherwise when I try with AUTOSNAP for "POLAR" & "ONTRACK". Why??? could you help me? Following Lee's code example above for tosnap which was much cleaner than mine try: (defun c:OTR ( / csnap) (princ (if (zerop (logand 16 (setvar 'autosnap (boole 6 16 (getvar 'autosnap))))) "\n<OsTrack off>" "\n<OsTrack on>")) (princ) ) (defun c:PLR ( / csnap) (princ (if (zerop (logand 8 (setvar 'autosnap (boole 6 8 (getvar 'autosnap))))) "\n<Polar off>" "\n<Polar on>")) (princ) ) Important thing to remember is using this method to toggle turns specific things on/off where setting a value as in your code affects everything controlled by that System Variable. When on my osmode is usually set to 2125, but the osmode toggle examples Lee & I gave you only turned osmode off & on without changing which object snaps were selected. Of course if you get into customizing the CUI diesel is much better for this stuff. My macro for toggling osnap on/off: Display Name: $(if,$(and,16384,$(getvar,osmode)),,!.)OSNAP Ctrl+F Command Name: OSNAP Ctrl+F Description: Toggles running object snaps on and off: ^F Macro: ^F Happy coding! Quote
Deby Ferdian Posted March 22, 2016 Author Posted March 22, 2016 Thank you very much! for you all you have so much make me felt helped it's very useful and helpfully too many for me.. Thank you again for @tombu, @Grr, @Lee Mac, @marko_ribar, @BKT, @broncos15 and @David Bethel you have got me very well and you were also using the english with a generally that normally people used as a common language and then so to makes me very very easy to get understanding well too. You have understanding about my language too which as I know as you know too if my language knowledge is more than less.. Thank you so much! Quote
Deby Ferdian Posted March 23, 2016 Author Posted March 23, 2016 (edited) Hey, I have a question more.. How about re-assign "F2" for "TEXTSCR" as a toggle show/hide ? I'd always looking for this one in an oftentimes to make it be surely at the CUI option but it just appear CTRL+F2 for "textscr" and while I test it out it won't be Hiding anymore like the persist happening with while when we are going to the press "F2" only in Fullscreen/Maximize/Fullwindow/Cleanscreen mode only. Edited March 23, 2016 by Deby Ferdian to make definitely! Quote
marko_ribar Posted March 23, 2016 Posted March 23, 2016 Have you looked into (textscr) and (graphscr) ALISP functions, they may be worth of looking for? Quote
Deby Ferdian Posted March 23, 2016 Author Posted March 23, 2016 Haha.. It's ~AWESOME~ thank you @marko_ribar! Quote
Deby Ferdian Posted March 23, 2016 Author Posted March 23, 2016 This is be harder similar of the example.. May I ask it in here in the same topic I write? I think this is not too far from this topic this is still same about. How if I want to create a keyboard shortcut of "ESC" ? Not just the only ^C/^C^C/(command) for a cancel function but for all aborting any procceding will proccessing in one act. but this is an excatly persist when we are getting press the "ESC" button. How to we could to make this happen ? Is it can be done ? Quote
tombu Posted March 23, 2016 Posted March 23, 2016 ai_deselect - Removes all objects from the selection set (command) - Cancels commands Quote
Deby Ferdian Posted March 23, 2016 Author Posted March 23, 2016 (edited) But it can't used in transparency mode while another one command is currenty in use or is running, such as; I was in the process of making the line but the middle of a sudden I want to cancel it all of them and this applies to a dialog box or pop-up windows that appears.. Edited March 23, 2016 by Deby Ferdian add and fix my word of tranparecy! Quote
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.