ManiacalDigits Posted January 5, 2024 Posted January 5, 2024 First time asking for help here, please be patient. Forgive the simple crudeness of my code I'm new to LISP. I have this code I've been working on and it almost works right. (defun C:FLATCALC () (SETQ COVERSTYLE (GETINT "\CoverStyle * 1-RECT 2-ROUNDED 3-CORNER (1-3) :")) (SETQ MWIDTH (GETREAL "\Measured Width :")) (SETQ MPROJ (GETREAL "\Measured Projection :")) (if (= 1 COVERSTYLE) (SETQ RWIDTH MWIDTH)) (if (= 1 COVERSTYLE) (SETQ RPROJ MPROJ)) (if (= 1 COVERSTYLE) (SETQ RCHORD MWIDTH)) (if (= 1 COVERSTYLE) (SETQ MRAD 2)) (if (= 1 COVERSTYLE) (SETQ INSET 0)) (if (= 2 COVERSTYLE) (SETQ MCHORD (GETREAL "\Measured Chord :"))) (if (= 2 COVERSTYLE) (SETQ MRAD (GETREAL "\Measured Radius :"))) (if (= 2 COVERSTYLE) (SETQ RWIDTH (+ MWIDTH 1.5))) (if (= 2 COVERSTYLE) (SETQ RPROJ (+ MPROJ 0.75))) (if (= 2 COVERSTYLE) (SETQ RCHORD (+ MCHORD 1.5))) (if (= 2 COVERSTYLE) (SETQ OFFSET (- MWIDTH MCHORD))) (if (= 2 COVERSTYLE) (SETQ INSET (/ OFFSET 2))) (if (= 3 COVERSTYLE) (SETQ CSIDE (GETINT "\Corner Side 1-LEFT 2 RIGHT (1-2) :"))) (if (= 3 COVERSTYLE) (SETQ RWIDTH MWIDTH)) (if (= 3 COVERSTYLE) (SETQ RPROJ MPROJ)) (if (= 3 COVERSTYLE) (SETQ RCHORD MWIDTH)) (if (= 3 COVERSTYLE) (SETQ INSET 0)) (SETQ p0 (list 0 0)) (SETQ p1 (list 0 RWIDTH)) (SETQ p2 (list (- RPROJ MRAD) (- RWIDTH INSET))) (SETQ p3 (list RPROJ (- RWIDTH (+ MRAD INSET)))) (SETQ p4 (list RPROJ (+ MRAD INSET))) (SETQ p5 (list (- RPROJ MRAD) INSET)) (setq c1 (list 48.125 RWIDTH)) (command "_pline" p0 p1 p2 p3 p4 p5 "C") (setq RRAD MRAD) (if (= 3 COVERSTYLE) (if (= CSIDE 1) (SETQ RRAD 1))) (setvar "filletrad" RRAD) (command "_fillet" p2 p4) (setq LRAD MRAD) (if (= 3 COVERSTYLE) (if (= CSIDE 2) (SETQ LRAD 1))) (setvar "filletrad" LRAD) (command "_fillet" p4 p0) (if (< RPROJ 48) (command "_line" p1 c1 "")) (princ) ) One issue is the failure to run the first time after loading... it draws the first segment of the poly and chokes. I delete that segment and re-run and it goes. I am using (load "flatcalc") then typing flatcalc to make the program run. to make sure its running right I use these test numbers... coverstyle - 2 measured width - 62 measured projection - 40 measured chord - 56 and radius - 15. This draws correctly. I am making a polyline based on some conditional user input and adding 2 fillets and possibly a line. When I select coverstyle 1 or 3 (a rectangular poly) the p5 variable sets correctly but does not draw correctly. This blows me away. Before adding the conditionals for coverstyle 3 this was not the case. I can see all the variables are setting as they should, no nils. Any help would be very appreciated. TIA! 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.