DuanJinHui Posted May 13, 2016 Share Posted May 13, 2016 (command "_.rectang" "f" 10 (getpoint)(getpoint)) How use "entmake" function do this ? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 13, 2016 Share Posted May 13, 2016 You will need to calculate the positions of each of the 8 vertices, calculate the appropriate bulge values for the rounded corners [noparse][tan(pi/8)][/noparse] and then entmake(x) an LWPOLYLINE entity with such vertex & bulge data. Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted May 13, 2016 Author Share Posted May 13, 2016 Thank you,Lee,if "f"=0,so only 4 vertices ? It looks very difficult, my mathematics and geometry is very poor . Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 13, 2016 Share Posted May 13, 2016 Here is an example for you to study: ;; Rounded Rectangle Example - Lee Mac 2016 (defun c:myrect ( / blg lst ocs pt1 pt2 rad tmp ) (setq rad 10.0) ;; Fillet Radius (if (and (setq pt1 (getpoint "\nSpecify 1st point: ")) (setq pt2 ((if (zerop (getvar 'worlducs)) getpoint getcorner) pt1 "\nSpecify 2nd point: ")) ) (progn (setq ocs (trans '(0 0 1) 1 0 t) tmp (mapcar 'max pt1 pt2) pt1 (mapcar 'min pt1 pt2) pt2 tmp lst (list pt1 (list (car pt2) (cadr pt1)) pt2 (list (car pt1) (cadr pt2))) blg (1- (sqrt 2)) ) (if (equal rad 0.0 1e- (entmake (append '( (000 . "LWPOLYLINE") (100 . "AcDbEntity") (100 . "AcDbPolyline") (090 . 4) (070 . 1) ) (list (cons 038 (caddr (trans pt1 1 ocs)))) (mapcar '(lambda ( x ) (cons 10 (trans x 1 ocs))) lst) (list (cons 210 ocs)) ) ) (entmake (append '( (000 . "LWPOLYLINE") (100 . "AcDbEntity") (100 . "AcDbPolyline") (090 . (070 . 1) ) (list (cons 038 (caddr (trans pt1 1 ocs)))) (apply 'append (mapcar (function (lambda ( a b ) (apply 'append (mapcar (function (lambda ( c d ) (list (cons 10 (trans (mapcar '+ a c) 1 ocs)) (cons 42 d) ) ) ) b (list blg 0.0) ) ) ) ) lst (list (list (list 0 rad) (list rad 0)) (list (list (- rad) 0) (list 0 rad)) (list (list 0 (- rad)) (list (- rad) 0)) (list (list rad 0) (list 0 (- rad))) ) ) ) (list (cons 210 ocs)) ) ) ) ) ) (princ) ) The above should also be compatible in all UCS & Views. Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted May 13, 2016 Author Share Posted May 13, 2016 Here is an example for you to study: The above should also be compatible in all UCS & Views. Thank you very much! Lee. I will study it ! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 13, 2016 Share Posted May 13, 2016 Thank you very much! Lee. I will study it ! You're welcome - feel free to ask any questions about the code. Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted May 14, 2016 Author Share Posted May 14, 2016 You're welcome - feel free to ask any questions about the code. Thank you ,I did a little change. 1.use parameter (defun myrect (rad pt1 pt2 lay col / blg lst ocs tmp ) (if (and pt1 pt2 rad lay col) (progn ... ... 2. (list (cons 038 (caddr (trans pt1 1 ocs)))) Change to--> (list (cons 8 lay)(cons 62 col)(cons 038 (caddr (trans pt1 1 ocs)))) 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.