Randolph Posted September 17, 2009 Share Posted September 17, 2009 Thank you for beeing part of this forum. This is my problem: I very often use the SLICE command to cut solids. This is my simple shortcut: (DEFUN C:S ()(COMMAND "_SLICE")) As in most cases I cut parallel to the UCS planes, I almost always have to type one of the following options: [...XY/YZ/ZX...] xy With hundreds of cuts per day, this becomes tiresome. And this is my question: To speed up modelling, it would be very helpful to have 3 shortcut commands: SX ... slice parallel to YZ-plane SY ... slice parallel to ZX-plane SZ ... slice parallel to XY-plane Procedure: sx RightMouseButton select Object(s) RMB select point on plane RMB select point on side to keep RMB Can anybody post a LISP-Code? Your help will be very appreciated. Thank you! Randolph Quote Link to comment Share on other sites More sharing options...
Randolph Posted September 17, 2009 Author Share Posted September 17, 2009 I already got it: (DEFUN C:SX () (SETQ OBJEKTE (SSGET)) (SETQ PUNKT (GETPOINT "\nPoint on YZ plane:")) (SETQ SEITE (GETPOINT "\nSide to keep:")) (COMMAND "_OSNAP" "") (COMMAND "_SLICE" "_SI" OBJEKTE "_YZ" PUNKT SEITE) (COMMAND "_OSNAP" "_END,_INT,_MID,_CEN,_INS,_PER") (COMMAND "_REDRAW") (SETQ OBJEKTE NIL) ) Quote Link to comment Share on other sites More sharing options...
gile Posted September 17, 2009 Share Posted September 17, 2009 Hi Here's a "3 in 1" (mapcar '(lambda (fun opt) (eval (list 'defun fun nil (list 'vl-cmdf "_.slice" '(ssget) "" opt pause pause) '(princ) ) ) ) '(c:SX c:SY c:SZ) '("XY" "YZ" "ZX") ) Quote Link to comment Share on other sites More sharing options...
Randolph Posted September 17, 2009 Author Share Posted September 17, 2009 keeps both sides. Maybe somebody needs it, though I guess it's much too simple to interest many of you (DEFUN C:SXA () (SETQ OBJEKTE (SSGET)) (SETQ PUNKT (GETPOINT "\nPunkt :")) (COMMAND "_OSNAP" "") (COMMAND "_SLICE" "_SI" OBJEKTE "_YZ" PUNKT "_B") (COMMAND "_OSNAP" "_END,_INT,_MID,_CEN,_INS,_PER") (COMMAND "_REDRAW") (SETQ OBJEKTE NIL) ) Quote Link to comment Share on other sites More sharing options...
Randolph Posted September 17, 2009 Author Share Posted September 17, 2009 Hi Gile, wow, it seems my approach is somewhat awkward ... Randolph Quote Link to comment Share on other sites More sharing options...
Randolph Posted September 17, 2009 Author Share Posted September 17, 2009 But the planes are somehow mixed up ... but no problem. Must be: '(c:SX c:SY c:SZ) '("YZ" "ZX" "XY") I guess. Thanks! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 17, 2009 Share Posted September 17, 2009 Nice Gile Quote Link to comment Share on other sites More sharing options...
gile Posted September 17, 2009 Share Posted September 17, 2009 The mapcar statement is just a funny elegant way to avoid making similar functions which differ only for some options. You can write 3 (or 6) (defun ...) it will do the same but have a look at the vl-cmdf function instead of command, it allows to use (ssget) as argument. (defun c:SX () (vl-cmdf "_.slice" (ssget) "" "XY" pause pause) (princ) ) To go further, a "6 in 1" (mapcar '(lambda (fun opt1 opt2) (eval (list 'defun fun nil (list 'vl-cmdf "_.slice" '(ssget) "" opt1 pause opt2) '(princ) ) ) ) '(c:SX c:SY c:SZ c:SXA c:SYA c:SZA) '("XY" "YZ" "ZX" "XY" "YZ" "ZX") '(pause pause pause "_both" "_both" "_both") ) Quote Link to comment Share on other sites More sharing options...
alanjt Posted September 18, 2009 Share Posted September 18, 2009 Hey, that looks familiar. I must have seen you do this elsewhere. (mapcar '(lambda (f r) (eval (list 'defun f nil (list 'setvar "filletrad" r) (list 'princ (strcat "\nFillet radius set to: " (rtos r))) (list 'vl-cmdf "_.fillet") '(princ) ) ) ) '(c:FF c:F1 c:F15 c:F2 c:F3 c:F4 c:F5 c:F6 c:F7 c:F8 c:F9) '(0 1 1.5 2 3 4 5 6 7 8 9) ) Quote Link to comment Share on other sites More sharing options...
gile Posted September 18, 2009 Share Posted September 18, 2009 Hi alan, This is not mine (I don't use so much fillet) but I wrote one some times ago to change between predefined views with the numpad. (mapcar '(lambda (f v) (eval (list 'defun f nil (list 'command "_.view" v) '(princ) ) ) ) '(c:0 c:1 c:2 c:3 c:4 c:5 c:6 c:7 c:8 c:9) '("_bottom" "_swiso" "_front" "_seiso" "_left" "_top" "_right" "_nwiso" "_back" "_neiso") ) Quote Link to comment Share on other sites More sharing options...
alanjt Posted September 18, 2009 Share Posted September 18, 2009 Hi alan, This is not mine (I don't use so much fillet) but I wrote one some times ago to change between predefined views with the numpad. (mapcar '(lambda (f v) (eval (list 'defun f nil (list 'command "_.view" v) '(princ) ) ) ) '(c:0 c:1 c:2 c:3 c:4 c:5 c:6 c:7 c:8 c:9) '("_bottom" "_swiso" "_front" "_seiso" "_left" "_top" "_right" "_nwiso" "_back" "_neiso") ) Oh, I wasn't implying you wrote it. I was saying I must have modeled it after you. That looks familiar, so I probably saw that one posted once. 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.