ktbjx Posted July 21, 2016 Share Posted July 21, 2016 Senario is this, i make a line, and it will automatically generate a circle with the length of the line as diameter, im sure you guys can make this very easy... but im really new to this lisp thingy, so im asking for help pretty please?? circle line.dwg Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 21, 2016 Share Posted July 21, 2016 Here you go. (defun c:Test (/ a b) ;; Tharwat. ;; (and (setq a (getpoint "\nSpecify 1st point :")) (setq b (getpoint "\nSpecify 2nd point :" a)) (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b))) (entmake (list '(0 . "CIRCLE") (cons 10 (mapcar '(lambda (q p) (/ (+ q p) 2.)) a b)) (cons 40 (/ (distance a b) 2.)) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
ktbjx Posted July 21, 2016 Author Share Posted July 21, 2016 Here you go. (defun c:Test (/ a b) ;; Tharwat. ;; (and (setq a (getpoint "\nSpecify 1st point :")) (setq b (getpoint "\nSpecify 2nd point :" a)) (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b))) (entmake (list '(0 . "CIRCLE") (cons 10 (mapcar '(lambda (q p) (/ (+ q p) 2.)) a b)) (cons 40 (/ (distance a b) 2.)) ) ) ) (princ) ) DARN you GOOD!!!!! exactly what i need!!!! thank you so much! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 21, 2016 Share Posted July 21, 2016 You are welcome. Quote Link to comment Share on other sites More sharing options...
ktbjx Posted July 21, 2016 Author Share Posted July 21, 2016 sir just s quick thought, is it possible to draw the circle first so i can hatch it and then the line, i wanted to add (C:hhatch) its the code i got thanks to this forum Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 21, 2016 Share Posted July 21, 2016 post the codes to modify them to suit the first routine if possible. Quote Link to comment Share on other sites More sharing options...
ktbjx Posted July 21, 2016 Author Share Posted July 21, 2016 (defun c:HHatch (/ hcol pt1 clr) (initget 1 "Gray Blue greeN Yellow Red Magenta") (if (and (setq hcol (getkword "\nEnter COLOR [Gray/Blue/greeN/Yellow/Red/Magenta]: ")) (setq clr (nth (vl-position hcol '("Gray" "Blue" "greeN" "Yellow" "Red" "Magenta")) '(252 5 3 2 1 200))) (setq pt1 (getpoint "\nSelect INTERNAL point: ")) ) (command "_-hatch" "Properties" "_Solid" "_COLOR" clr "" pt1 "") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 21, 2016 Share Posted July 21, 2016 (defun c:Test (/ a b h p c) ;; Tharwat. ;; (initget 1 "Gray Blue greeN Yellow Red Magenta") (if (and (setq h (getkword "\nEnter COLOR [Gray/Blue/greeN/Yellow/Red/Magenta]: ")) (setq c (nth (vl-position h '("Gray" "Blue" "greeN" "Yellow" "Red" "Magenta")) '(252 5 3 2 1 200))) ) (while (and (setq a (getpoint "\nSpecify 1st point :")) (setq b (getpoint "\nSpecify 2nd point :" a)) (entmake (list '(0 . "CIRCLE") (cons 10 (setq p (mapcar '(lambda (q p) (/ (+ q p) 2.)) a b))) (cons 40 (/ (distance a b) 2.)) ) ) ) (command "_-hatch" "Properties" "_Solid" "_COLOR" c "" p "") (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b))) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
ktbjx Posted July 21, 2016 Author Share Posted July 21, 2016 (defun c:Test (/ a b h p c) ;; Tharwat. ;; (initget 1 "Gray Blue greeN Yellow Red Magenta") (if (and (setq h (getkword "\nEnter COLOR [Gray/Blue/greeN/Yellow/Red/Magenta]: ")) (setq c (nth (vl-position h '("Gray" "Blue" "greeN" "Yellow" "Red" "Magenta")) '(252 5 3 2 1 200))) ) (while (and (setq a (getpoint "\nSpecify 1st point :")) (setq b (getpoint "\nSpecify 2nd point :" a)) (entmake (list '(0 . "CIRCLE") (cons 10 (setq p (mapcar '(lambda (q p) (/ (+ q p) 2.)) a b))) (cons 40 (/ (distance a b) 2.)) ) ) ) (command "_-hatch" "Properties" "_Solid" "_COLOR" c "" p "") (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b))) ) ) (princ) ) this is what i needed! darn you good! hands down! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 21, 2016 Share Posted July 21, 2016 this is what i needed! darn you good! hands down! Good for you. Enjoy it. 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.