zyad Posted August 13, 2017 Posted August 13, 2017 Here's a quick way to make the radius tray ( no error checking on input ) (defun _makeradtray (w h r p) (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(8 . "E-PWER-CABL-TRAY") '(100 . "AcDbPolyline") '(90 . '(70 . 1) '(43 . 0) '(38 . 0) '(39 . 0) (cons 10 p) (cons 10 (setq p (list (+ w (car p)) (cadr p)))) '(42 . 0.414213562373095) (cons 10 (setq p (list (+ r (car p)) (- (cadr p) r)))) (cons 10 (setq p (list (car p) (- (cadr p) h)))) (cons 10 (setq p (list (- (car p) (+ w (* 2. r))) (cadr p)))) (cons 10 (setq p (list (car p) (+ (cadr p) h)))) '(42 . 0.414213562373095) (cons 10 (setq p (list (+ r (car p)) (+ (cadr p) r)))) ) ) ) (_makeradtray (getdist "\nEnter Width: ") (getdist "\nEnter Height: ") (getdist "\nEnter Radius: ") (getpoint "\nPick a point to place the tray: ") ) Hi,I am already modify your code to be hatched but I am stuck in rotate hatch and polyline can you modify it thanks for help. (command "_.hatch" "ANSI31" "0.0" "0.0" "_l" "" "_.change" "_l" "" "_p" "_la" "E-PWER-CABL-HATCH" "") Quote
zyad Posted August 14, 2017 Posted August 14, 2017 Here's a quick way to make the radius tray ( no error checking on input ) (defun _makeradtray (w h r p) (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(8 . "E-PWER-CABL-TRAY") '(100 . "AcDbPolyline") '(90 . '(70 . 1) '(43 . 0) '(38 . 0) '(39 . 0) (cons 10 p) (cons 10 (setq p (list (+ w (car p)) (cadr p)))) '(42 . 0.414213562373095) (cons 10 (setq p (list (+ r (car p)) (- (cadr p) r)))) (cons 10 (setq p (list (car p) (- (cadr p) h)))) (cons 10 (setq p (list (- (car p) (+ w (* 2. r))) (cadr p)))) (cons 10 (setq p (list (car p) (+ (cadr p) h)))) '(42 . 0.414213562373095) (cons 10 (setq p (list (+ r (car p)) (+ (cadr p) r)))) ) ) ) (_makeradtray (getdist "\nEnter Width: ") (getdist "\nEnter Height: ") (getdist "\nEnter Radius: ") (getpoint "\nPick a point to place the tray: ") ) I'm all really modified your code to be hatched but I am stuck in rotate polyline and hatch can you modify please Thanks for help Quote
ronjonp Posted August 14, 2017 Posted August 14, 2017 (edited) Try this: (defun c:radtray (/ p) (defun _makeradtray (w h r p rot / doc e h) (if (setq e (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(8 . "E-PWER-CABL-TRAY") '(100 . "AcDbPolyline") '(90 . '(70 . 1) '(43 . 0) '(38 . 0) '(39 . 0) (cons 10 p) (cons 10 (setq p (list (+ w (car p)) (cadr p)))) '(42 . 0.414213562373095) (cons 10 (setq p (list (+ r (car p)) (- (cadr p) r)))) (cons 10 (setq p (list (car p) (- (cadr p) h)))) (cons 10 (setq p (list (- (car p) (+ w (* 2. r))) (cadr p)))) (cons 10 (setq p (list (car p) (+ (cadr p) h)))) '(42 . 0.414213562373095) (cons 10 (setq p (list (+ r (car p)) (+ (cadr p) r) 0.0))) ) ) ) (progn (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq h (vlax-invoke (if (= (getvar 'cvport) 1) (vla-get-paperspace doc) (vla-get-modelspace doc) ) 'addhatch achatchobject "ANSI31" :vlax-true ) ) (vlax-invoke h 'appendouterloop (list (vlax-ename->vla-object e))) (vla-add (vla-get-layers doc) "E-PWER-CABL-HATCH") (vla-put-layer h "E-PWER-CABL-HATCH") (vlax-put h 'patternangle (getvar 'hpang)) (vlax-put h 'patternscale (getvar 'hpscale)) (vla-evaluate h) ) ) (if rot (mapcar '(lambda (x) (vlax-invoke x 'rotate p rot)) (list (vlax-ename->vla-object e) h)) ) ) (_makeradtray (getdist "\nEnter Width: ") (getdist "\nEnter Height: ") (getdist "\nEnter Radius: ") (setq p (getpoint "\nPick a point to place the tray: ")) (getangle "\nRotation angle: " p) ) (princ) ) (vl-load-com) Edited August 15, 2017 by ronjonp Quote
zyad Posted August 15, 2017 Posted August 15, 2017 Try this: (defun _makeradtray (w h r p / doc e h) (if (setq e (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(8 . "E-PWER-CABL-TRAY") '(100 . "AcDbPolyline") '(90 . '(70 . 1) '(43 . 0) '(38 . 0) '(39 . 0) (cons 10 p) (cons 10 (setq p (list (+ w (car p)) (cadr p)))) '(42 . 0.414213562373095) (cons 10 (setq p (list (+ r (car p)) (- (cadr p) r)))) (cons 10 (setq p (list (car p) (- (cadr p) h)))) (cons 10 (setq p (list (- (car p) (+ w (* 2. r))) (cadr p)))) (cons 10 (setq p (list (car p) (+ (cadr p) h)))) '(42 . 0.414213562373095) (cons 10 (setq p (list (+ r (car p)) (+ (cadr p) r)))) ) ) ) (progn (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq h (vlax-invoke (if (= (getvar 'cvport) 1) (vla-get-paperspace doc) (vla-get-modelspace doc) ) 'addhatch achatchobject "ANSI31" :vlax-true ) ) (vlax-invoke h 'appendouterloop (list (vlax-ename->vla-object e))) (vla-add (vla-get-layers doc) "E-PWER-CABL-HATCH") (vla-put-layer h "E-PWER-CABL-HATCH") (vlax-put hatch 'patternangle (getvar 'hpang)) (vlax-put hatch 'patternscale (getvar 'hpscale)) (vla-evaluate hatch) ) ) ) (vl-load-com) (_makeradtray (getdist "\nEnter Width: ") (getdist "\nEnter Height: ") (getdist "\nEnter Radius: ") (getpoint "\nPick a point to place the tray: ") ) Hi,ronjonp thanks for help,but I need to rotate hatch,polyline after create as specific angle. Quote
ronjonp Posted August 15, 2017 Posted August 15, 2017 Hi,ronjonp thanks for help,but I need to rotate hatch,polyline after create as specific angle. Code modified above. 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.