Begde Posted January 24, 2013 Share Posted January 24, 2013 (edited) Dear all, I'm glad to be here because you are great supporters. however, I seek your advice in this program I wrote to draw an underfloor heating loop. The problem is it works only for the basic coordinates and when to change the location of points a messy figure popup! I tried to have the drawing in relative coordinates but I failed, so.. any advice. a dwg file is attached to illustrate the program and the program is: (defun getinfo () (defun os_off () (setvar "osmode" (logior 16384 (getvar "osmode")))) (defun os_on () (setvar "osmode" (logand (~ 16384) (getvar "osmode")))) (defun undo_group () (command "undo" "group")) (defun undo_end () (command "undo" "end")) (undo_group) (os_on) (setq p01 (getpoint "/ n Pick upper right corner:")) (setq p03 (getpoint "/ n Pick opposit corner:")) (setq s (getreal "/n Enter traverse<100> mm:")) (setq siz (mapcar '- p01 p03)) (setq p04 (list (car p03) (cadr p01))) (setq p02 (list (car p01) (cadr p03))) ) (defun procinfo() (setq xm (car siz) ym (cadr siz)) (setq p1 (list (- xm s) (- ym s))) (setq px (fix (/ xm s))) (setq py (fix (/ ym s))) (setq p2 (list (- (car p02) s) (- s (cadr p03)))) (setq p3 (list (- s (car p04)) (- s (cadr p03)))) (setq p4 (list (- s (car p04)) (- (cadr p04) S))) (setq p5 (list (- (car p01) (* 3 s)) (- (cadr p04) S))) (setq p6 (list (- (car p02) (* 3 s)) (- (* 3 s) (cadr p03)))) (setq p7 (list (- (* s 3) (car p04)) (- (* 3 s) (cadr p03)))) (setq p8 (list (- (* 3 s) (car p04)) (- (cadr p04) (* 3 S)))) (setq p9 (list (- xm (* 5 s)) (- ym (* 3 s)))) (setq p10 (list (- (car p02) (* 5 s)) (- (* 5 s) (cadr p03)))) (setq p11 (list (- (* 5 s) (car p03)) (- (* 5 s) (cadr p03)))) (setq p12 (list (- (* 5 s) (car p04)) (- (cadr p04) (* 5 S)))) (setq p13 (list (- xm (* 7 s)) (- ym (* 5 s)))) (setq p14 (list (- (car p01) (* s 7)) (- (* 7 s) (cadr p02)))) (setq p15 (list (- (* 7 s) (car p04)) (- (* 7 s) (cadr p03)))) (setq p16 (list (- (* s 7) (car p04)) (- (cadr p04) (* 7 S)))) (setq p17 (list (- xm (* 9 s)) (- ym (* 7 s)))) (setq p18 (list (- (car p02) (* 9 s)) (- (* 9 s) (cadr p03)))) (setq p19 (list (- (* 9 s) (car p04)) (- (* 9 s) (cadr p03)))) (setq p20 (list (- (* 9 s) (car p04)) (- (cadr p04) (* 9 S)))) (setq P21 (list (- xm (* 11 s)) (- ym (* 9 s)))) (setq p22 (list (- (car p02) (* 11 s)) (- (* 11 s) (cadr p03)))) (setq P23 (list (- (* 12 s) (car p04)) (- (* 11 s) (cadr p03)))) (setq P24 (list (- (* s 12) (car p04)) (- (cadr p04) (* 10 S)))) (setq P25 (list (- (* s 10) (car p04)) (- (cadr p04) (* 10 S)))) (setq p26 (list (- (* s 10) (car p04)) (- (cadr p04) (* 20 S)))) (setq p27 (list (- (car p02) (* s 10)) (- (cadr p04) (* 20 S)))) (setq p28 (list (- (car p02) (* s 10)) (- (cadr p04) (* 8 S)))) (setq p29 (list (- (* s (car p03)) (- (cadr p04) (* 8 S)))) (setq p30 (list (- (* s 8 ) (car p03)) (- (* 8 S) (cadr p03)))) (setq p31 (list (- (car p02) (* 8 s ) (- (* 8 S) (cadr p03)))) (setq p32 (list (- (car p02) (*8 s ) (- (cadr p01) (* 6 S)))) (setq p33 (list (- (* s 6) (car p04)) (- (cadr p01) (* 6 S)))) (setq p34 (list (- (* s 6) (car p04)) (- (* 6 S) (cadr p03)))) (setq p35 (list (- (car p02) (* s 6)) (- (* 6 S) (cadr p03)))) (setq p36 (list (- (car p02) (* s 6)) (- (cadr p01) (* 4 S)))) (setq p37 (list (- (* s 4) (car p04)) (- (cadr p01) (* 4 S)))) (setq p38 (list (- (* s 4) (car p03)) (- (* 4 S) (cadr p03)))) (setq p39 (list (- (car p02) (* s 4)) (- (* 4 S) (cadr p03)))) (setq p40 (list (- (car p02) (* s 4)) (- (cadr p01) (* 2 S)))) (setq p41 (list (- (* s 2) (car p04)) (- (cadr p01) (* 2 S)))) (setq p42 (list (- (* s 2) (car p04)) (- (* 2 S) (cadr p03)))) (setq p43 (list (- (car p02) (* s 2)) (- (* 2 S) (cadr p03)))) (setq p44 (list (- (car p02) (* s 2)) (- (cadr p01) (* 1 S)))) ) (defun output() (command "pline" @ p1 p2 p3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 P17 P18 P19 P20 P21 P22 P23 P24 p25 p26 p27 p28 p29 p30 p31 p32 p33 p34 p35 p36 p37 p38 p39 p40 p41 p42 p43 p44"") (command "fillet" "radius" 100) (command "fillet" "p" "last") ) (defun c:cre() (getinfo) (procinfo) (output) ) loop.dwg Edited January 25, 2013 by SLW210 Added Code Tags! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted January 24, 2013 Share Posted January 24, 2013 This could be of interests . THIS THREAD Quote Link to comment Share on other sites More sharing options...
SLW210 Posted January 24, 2013 Share Posted January 24, 2013 Please read the CODE POSTING GUIDELINES and edit your post to include Code Tags. It will get rid of the emoticons as well. Quote Link to comment Share on other sites More sharing options...
Begde Posted January 25, 2013 Author Share Posted January 25, 2013 Dear all, I tried to practice the code here. Please put 8 instead of the smilei face. Quote Link to comment Share on other sites More sharing options...
SLW210 Posted January 25, 2013 Share Posted January 25, 2013 Dear all, I tried to practice the code here. Please put 8 instead of the smilei face. If you would have followed the directions in the link and used Code Tags, as instructed, the emoticons will not show up. I fixed it for you this time. Quote Link to comment Share on other sites More sharing options...
Begde Posted January 26, 2013 Author Share Posted January 26, 2013 thanks a lot. 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.