ready2goriding Posted May 6, 2010 Posted May 6, 2010 This is my latest rookie code recipe. It's purpose is to split a simulated cabinet into 3 pieces and extend it. With the exception of the "extend" command, which is very inconsistant, it works pretty much as I intended. Someday it will be much more complex- this is the sample version. Code: (defun c:rlel (/ b c d p1 p2 p3 p4 p5 p6 p7 p8 ts tb m1 m2 m3 ex ex1 er ed ed1) ;define function ;get user inputs (setq b (getpoint "\nTop Center Point? :")) (setq c (getpoint "\nBottom Center Point? :")) (terpri) (setq d "120") ;old cabinet length ;establish inside trim lines (setq p1 (polar b (dtr 180.0) ) (setq p2 (polar c (dtr 180.0) ) (setq p3 (polar b (dtr 0.0) ) (setq p4 (polar c (dtr 0.0) ) (command "._line" "_non" p1 "_non" p2 "") (command "._line" "_non" p3 "_non" p4 "") ;establish outside trim lines (setq p5 (polar p1 (dtr 180.0) 6)) (setq p6 (polar p2 (dtr 180.0) 6)) (setq p7 (polar p3 (dtr 0.0) 6)) (setq p8 (polar p4 (dtr 0.0) 6)) (command "._line" "_non" p5 "_non" p6 "") (command "._line" "_non" p7 "_non" p8 "") ;trim (repeat 2 (prompt "Select Vertical Lines for Trimming :") (setq ts (ssget)) (prompt "Select Horizontal Lines for Trimming :") (setq tb (ssget)) (command "._trim" ts "" tb "") ) ;end of repeat ;stretch cabinet to new length (repeat 2 (prompt "Select objects to move") (setq m1 (ssget)) (setq m2 (getpoint "Base Point :")) (setq m3 (getpoint "Next Point? :" m2)) (command "._move" m1 "" m2 m3) ) ;end of repeat ;extend lines to new dimensions (repeat 2 (setq ex (entsel "\nPick ext line :")) (prompt "\nChoose lines to extend :") (setq ex1 (ssget)) (command "._extend" ex "" ex1 "") ) ;end of repeat ; erase construction lines (prompt "Select items to be erased :") (setq er (ssget)) (command "._erase" er "") ; extend bottom center dimension (prompt "Select Object for Extension :") (setq ed (entsel)) (prompt "Select Dimension Line to Extend :") (setq ed1 (entsel)) (command "._extend" ed "" ed1 "") (alert "Are we finished here?") (princ) ) ; end of function (defun dtr (x) (* pi (/ x 180)) ) ;end (princ) My biggest 3 concerns are: 1- variable D needs a dimension assigned to it, but I can't make it work... 2-When I figure out how to assign numeric values to variables without user input, the program will be much more automated. That's what I like! 3- The extend function needs huge ammounts of zoom, or else some lines will not extend properly. Not sure how to fix this... yet. As always, I welcome comments, criticism, or outright laughter! Mucho thanks to the fine folks here and also the AfraLisp site! Quote
JohnM Posted May 11, 2010 Posted May 11, 2010 i'm not sure what it does could you post a before and after screen shot or drawings Quote
ready2goriding Posted May 11, 2010 Author Posted May 11, 2010 Sure thing! It basically is supposed to divide a rectangle into 3 pieces while leaving the end compartments the same size. This is part of a much more complicated program (someday). As you, have probably guessed, I'm a rookie at lisping! TesT.dwg 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.