Tharwat Posted March 6, 2012 Posted March 6, 2012 Hope this would help you with it . (defun c:TesT (/ p1 p2 p3 p4 cntr) ;;; Tharwat 06. March 2012 ;;; ;;; Draw Slab Symbol ;;; (defun CrossLine (a b) (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 (polar a (angle a b) (- (/ (distance a b) 2.) 0.225)) ) (cons 8 "_layer S-SPEC-SLAB") ) ) ) (defun _Text (p str) (entmake (list '(0 . "TEXT") '(40 . 0.2) (cons 1 str) (cons 10 p) (cons 11 p) (cons 7 (getvar 'textstyle)) '(51 . 0.) (cons 8 "_layer S-SPEC-TEXT") '(71 . 0) '(72 . 1) '(73 . 2) '(210 0.0 0.0 1.0) ) ) ) (if (and (setq p1 (getpoint "\n First corner :")) (setq p2 (getcorner p1 "\n Second corner :")) ) (progn (setq p3 (list (car p1) (cadr p2) 0.) p4 (list (car p2) (cadr p1) 0.) ) (if (> (distance p1 p3) 1.5) (progn (setq cntr (mapcar (function (lambda (first second) (/ (+ first second) 2.)) ) p1 p2 ) ) (CrossLine p1 p2) (CrossLine p2 p1) (CrossLine p3 p4) (CrossLine p4 p3) (entmake (list '(0 . "CIRCLE") (cons 10 cntr) '(40 . 0.225) (cons 8 "_layer S-SPEC-SLAB") ) ) (_Text cntr "GS") (_Text (polar cntr 4.71239 0.4) "+0.20") ) (princ "\n *** Diameter of Rectangle is too small must be minimum 1.50 *** " ) ) ) (princ) ) (princ) ) Quote
git_thailand Posted March 7, 2012 Author Posted March 7, 2012 Hope this would help you with it . (defun c:TesT (/ p1 p2 p3 p4 cntr) ;;; Tharwat 06. March 2012 ;;; ;;; Draw Slab Symbol ;;; (defun CrossLine (a b) (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 (polar a (angle a b) (- (/ (distance a b) 2.) 0.225)) ) (cons 8 "_layer S-SPEC-SLAB") ) ) ) (defun _Text (p str) (entmake (list '(0 . "TEXT") '(40 . 0.2) (cons 1 str) (cons 10 p) (cons 11 p) (cons 7 (getvar 'textstyle)) '(51 . 0.) (cons 8 "_layer S-SPEC-TEXT") '(71 . 0) '(72 . 1) '(73 . 2) '(210 0.0 0.0 1.0) ) ) ) (if (and (setq p1 (getpoint "\n First corner :")) (setq p2 (getcorner p1 "\n Second corner :")) ) (progn (setq p3 (list (car p1) (cadr p2) 0.) p4 (list (car p2) (cadr p1) 0.) ) (if (> (distance p1 p3) 1.5) (progn (setq cntr (mapcar (function (lambda (first second) (/ (+ first second) 2.)) ) p1 p2 ) ) (CrossLine p1 p2) (CrossLine p2 p1) (CrossLine p3 p4) (CrossLine p4 p3) (entmake (list '(0 . "CIRCLE") (cons 10 cntr) '(40 . 0.225) (cons 8 "_layer S-SPEC-SLAB") ) ) (_Text cntr "GS") (_Text (polar cntr 4.71239 0.4) "+0.20") ) (princ "\n *** Diameter of Rectangle is too small must be minimum 1.50 *** " ) ) ) (princ) ) (princ) ) thank you. How to add function change text and loop Quote
Tharwat Posted March 7, 2012 Posted March 7, 2012 thank you. How to add function change text and loop Things like this ..... ? (defun c:TesT (/ p1 p2 str p3 p4 cntr) ;;; Tharwat 07. March 2012 ;;; ;;; Draw Slab Symbol ;;; (defun CrossLine (a b) (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 (polar a (angle a b) (- (/ (distance a b) 2.) 0.225)) ) (cons 8 "_layer S-SPEC-SLAB") ) ) ) (defun _Text (p str) (entmake (list '(0 . "TEXT") '(40 . 0.2) (cons 1 str) (cons 10 p) (cons 11 p) (cons 7 (getvar 'textstyle)) '(51 . 0.) (cons 8 "_layer S-SPEC-TEXT") '(71 . 0) '(72 . 1) '(73 . 2) '(210 0.0 0.0 1.0) ) ) ) (while (and (setq p1 (getpoint "\n First corner :")) (setq p2 (getcorner p1 "\n Second corner :")) (not (eq (setq str (getstring t "\n Enter text :")) "")) ) (progn (setq p3 (list (car p1) (cadr p2) 0.) p4 (list (car p2) (cadr p1) 0.) ) (if (> (distance p1 p3) 1.5) (progn (setq cntr (mapcar (function (lambda (first second) (/ (+ first second) 2.)) ) p1 p2 ) ) (CrossLine p1 p2) (CrossLine p2 p1) (CrossLine p3 p4) (CrossLine p4 p3) (entmake (list '(0 . "CIRCLE") (cons 10 cntr) '(40 . 0.225) (cons 8 "_layer S-SPEC-SLAB") ) ) (_Text cntr str) (_Text (polar cntr 4.71239 0.4) "+0.20") ) (princ "\n *** Diameter of Rectangle is too small must be minimum 1.50 *** " ) ) ) ) (princ) ) 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.