rengised Posted June 11, 2010 Posted June 11, 2010 Hi eveybody i need help about the autolisp, how to add autolisp to an icon? i have downloaded some autolisp from this site, by the way thanks a lot for those share their knowledge and autlisp. Could please share to me what are the steps to create an icon from autlisp, instead of typing the command i just want to click it. Quote
lpseifert Posted June 11, 2010 Posted June 11, 2010 if you're asking how to make a toolbar command button... In CUI create a new Command using something similar as this for the macro ^c^c(if (not c:[i][color=Red]lispcommand[/color][/i])(load "[i][color=Red]lispfile[/color][/i]" nil));[i][color=Red]lispcommand[/color][/i]; then drag the command up to a toolbar a search probably would have led you to this http://www.cadtutor.net/forum/showthread.php?t=48387 Quote
rengised Posted June 15, 2010 Author Posted June 15, 2010 Hi lpseifert thanks for the help. I have already the toolbar button, but the proble is i dont know what would be tha macro for the lisp. i will attached the sample lisp and please teach the technique and what should put on the macro. Thanks:) getareas.lsp boxed.lsp Quote
Lee Mac Posted June 15, 2010 Posted June 15, 2010 Hi Rengised, I feel honoured that you are using my programs As for the macro, as lpseifert has posted above or, ^C^Cgetareas; if you know that the lisp files are already loaded. Quote
rengised Posted June 15, 2010 Author Posted June 15, 2010 Hi LeeMac, thanks fro the quick reply. Its my hounored that you replied on my question. Yes, i have downloaded and used your programs and those are very useful, i am very thank to you and to the others here always sharing their knowledge. I know that my qustion is very simple for you, coz i dont have any background on creating programs or lisp. Tomorrow i will try the code, and i am sure it will works. Thanks all to you guys.. and thanks to this site :):) Quote
rengised Posted June 15, 2010 Author Posted June 15, 2010 Hi LeeMac its me again, i need a favor again if you dont mind. I attached the sample drawing for trimming the intersection. Thanks. Quote
rengised Posted June 15, 2010 Author Posted June 15, 2010 Hey LeeMac, trimmer its not working.. What to do? Quote
rengised Posted June 15, 2010 Author Posted June 15, 2010 that is what i want LeeMac its perfect, could you please send me the lisp? Thanks again Quote
rengised Posted June 15, 2010 Author Posted June 15, 2010 LeeMac, could you please give me the complete code? if you dont mind.. Than\ ks Quote
Lee Mac Posted June 15, 2010 Posted June 15, 2010 The way I approached the problem is to: Prompt user for a selection of Lines (assuming all are lines at the moment - simplifies things a little). Convert the SelectionSet into a list of VLA-objects (easier to work with). For each object in turn, find the intersections between that object and every other object in the SelectionSet. For each set of intersections, break the object at the first two intersections in the list (reasonable assumption using the diagrams of usage and the fact we are only dealing with lines.) Library functions I used: Convert a SelectionSet into a list of VLA-Objects: ;; ss ~ SelectionSet (defun LM:ss->vla ( ss ) ;; © Lee Mac ~ 15.06.10 (if ss ( (lambda ( i / e l ) (while (setq e (ssname ss (setq i (1+ i)))) (setq l (cons (vlax-ename->vla-object e) l)) ) l ) -1 ) ) ) Return a list of intersections between an object and a list of objects: ;; Obj ~ VLA-Object for use in all intersection tests ;; ObjLst ~ List of VLA-Objects to be tested against Obj (defun LM:IntersectWith ( obj ObjLst ) ;; © Lee Mac ~ 15.06.10 (apply 'append (mapcar '(lambda ( o ) (LM:GroupByNum (vlax-invoke obj 'IntersectWith o acExtendNone) 3 ) ) ObjLst ) ) ) ;; Group List by Number ;; l ~ list to be grouped ;; n ~ number of elements to group by (defun LM:GroupByNum ( l n / a b ) ;; © Lee Mac ~ 15.06.10 (while l ( (lambda ( i ) (while (< 0 i) (setq a (cons (car l) a) l (cdr l) i (1- i)) ) (setq b (cons (reverse a) b) a nil) ) n ) ) (reverse b) ) Good luck! Quote
rengised Posted June 23, 2010 Author Posted June 23, 2010 Hi LeeMac, thanks for your patience and help, but i dont get it and i dont know what is vla... Anyway Thanks very much...... Quote
rengised Posted June 23, 2010 Author Posted June 23, 2010 Hi LeeMac, i dont know if what i have done is correct.. What i did is i copy and paste the code and save it as .lsp (example LM.lsp) in the note pad... Thanks again LeeMac i really appreciate your help and patience.. Quote
Lee Mac Posted June 23, 2010 Posted June 23, 2010 Those are only Library functions to be used to perhaps create a program, they aren't programs in themselves. Have you written LISP before? Quote
rengised Posted June 23, 2010 Author Posted June 23, 2010 Thanks LeeMac again, unfortunately I havent write an LISP before. That is my big problem and want to learn as well. Quote
rengised Posted June 23, 2010 Author Posted June 23, 2010 By the way LeeMac i have found this lisp in this forum awhile ago, but the X wasnt work. Please find attached file. Thanks walls.lsp Quote
Lee Mac Posted June 23, 2010 Posted June 23, 2010 Thanks LeeMac again, unfortunately I havent write an LISP before. That is my big problem and want to learn as well. Have you check these out? http://www.afralisp.net/ http://www.jefferypsanders.com/autolisptut.html http://ronleigh.info/autolisp/index.htm 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.