nod684 Posted September 13, 2012 Author Share Posted September 13, 2012 Lee and MR, thanks a lot for all your help! This will surely make my job easier. I know both of you spent hours coming up with this code. Appreciate it a lot! @M.R. coming up with a code that shows all the views in one shot is superb! my only comment is that after issuing the command, it zooms out of the screen and i need to zoom in again to where i am working on. (don't know if it is supposed to be that way or just on my side only. am using AutoCAD 2010) BUt really, thanks for the code @Lee; Superb code Lee. just what i wanted it to be! Is it possible to shift to Isometric Plane after entering the IsoPoly command in the command line? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 13, 2012 Share Posted September 13, 2012 @Lee; Superb code Lee. just what i wanted it to be! You're welcome nod, it was interesting to write. Is it possible to shift to Isometric Plane after entering the IsoPoly command in the command line? Yes, just press F5 Quote Link to comment Share on other sites More sharing options...
pBe Posted September 13, 2012 Share Posted September 13, 2012 (edited) FWIW (defun c:isoc (/ *error* createPolygon kw pt1 vars x d sides ptlst ) (vl-load-com) ;;; isoc by Nod684 ;;; ;;; Error Handler by ronjonp ;;; ;; IsoPolygon by pBe ;;; (defun *error* (msg) ;; Resets the variables... (mapcar '(lambda (x) (setvar (car x) (cdr x))) vars) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\nError: " msg)) ) (princ) ) (defun el (p dia) (command "._ellipse" "I" "_non" p "d" dia) (createPolygon (entlast) sides )) (defun createPolygon (objell sides / seg seg2 pts) (setq seg (/ (vlax-curve-getdistatparam objell (vlax-curve-getendparam objell) ) sides ) seg2 0.0 ) (repeat sides (setq pts (cons (vlax-curve-getpointatdist objell (+ seg seg2)) pts) seg2 (+ seg seg2)) ) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length pts)) (cons 70 1)) (mapcar (function (lambda (p) (cons 10 p))) pts))) (entdel objell) (princ) ) (if (not d) (setq d 1.00)) (if (not sides) (setq sides 4)) (initget "TOP RIGHT LEFT ALL") ;; This will always return a value unless esc is pressed (if (and (setq kw (cond ((getkword " Draw Isometric Circle \nSelect option [ TOP / RIGHT / LEFT / ALL ] <TOP>:")) ("TOP") ) ) (setq sides (cond ((getint (strcat "\nNumber of sides <" (itoa sides) ">: "))) (sides))) (setq d (cond ((getreal (strcat "\nEnter Diameter <" (rtos d 2 2) ">: "))) (d))) ) (progn ;; Contructs a list '(("cmdecho" . value)("snapstyl" . value) ... ) (setq vars (mapcar '(lambda (x) (cons x (getvar x))) '("cmdecho" "snapstyl" "snapisopair"))) (setvar 'cmdecho 0) (setvar 'snapstyl 1) (setq mode (cond ((= kw "LEFT") 0) ((= kw "TOP") 1) ((= kw "RIGHT") 2) ((= kw "ALL") '(0 2 1)) ) ) (if (listp mode) (progn (princ "\nMidpoint of Top/Rigth/Left") (While (< (length ptlst) 3) (setq pt (getpoint "Isometric Circle \nPick Center Point of Isometric Circle:")) (if pt (setq ptlst (cons pt ptlst))) ) (mapcar '(lambda (m k) (setvar 'snapisopair m) (el k d)) mode ptlst) ) (progn (setvar 'snapisopair mode) (setq pt1 (getpoint "Isometric Circle \nPick Center Point of Isometric Circle:")) (el pt1 d) ) ) ;; Resets the variables '(("cmdecho" . value)("snapstyl" . value) ... ) (mapcar '(lambda (x) (setvar (car x) (cdr x))) vars) ) ) (princ) ) Toggle Snap/Isometric/Standard (defun c:sa nil (setvar 'snapstyl (boole 6 1 (getvar 'Snapstyl)))) HTH Edited September 13, 2012 by pBe add vl-load-com Quote Link to comment Share on other sites More sharing options...
nod684 Posted September 13, 2012 Author Share Posted September 13, 2012 FWIW (defun c:isoc (/ *error* createPolygon kw pt1 vars x d sides ptlst ) ;;; isoc by Nod684 ;;; ;;; Error Handler by ronjonp ;;; ;; IsoPolygon by pBe ;;; (defun *error* (msg) ;; Resets the variables... (mapcar '(lambda (x) (setvar (car x) (cdr x))) vars) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\nError: " msg)) ) (princ) ) (defun el (p dia) (command "._ellipse" "I" p "d" dia) (createPolygon (entlast) sides )) (defun createPolygon (objell sides / seg seg2 pts) (setq seg (/ (vlax-curve-getdistatparam objell (vlax-curve-getendparam objell) ) sides ) seg2 0.0 ) (repeat sides (setq pts (cons (vlax-curve-getpointatdist objell (+ seg seg2)) pts) seg2 (+ seg seg2)) ) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length pts)) (cons 70 1)) (mapcar (function (lambda (p) (cons 10 p))) pts))) (entdel objell) (princ) ) (if (not d) (setq d 1.00)) (if (not sides) (setq sides 4)) (initget "TOP RIGHT LEFT ALL") ;; This will always return a value unless esc is pressed (if (and (setq kw (cond ((getkword " Draw Isometric Circle \nSelect option [ TOP / RIGHT / LEFT / ALL ] <TOP>:")) ("TOP") ) ) (setq sides (cond ((getint (strcat "\nNumber of sides <" (itoa sides) ">: "))) (sides))) (setq d (cond ((getreal (strcat "\nEnter Diameter <" (rtos d 2 2) ">: "))) (d))) ) (progn ;; Contructs a list '(("cmdecho" . value)("snapstyl" . value) ... ) (setq vars (mapcar '(lambda (x) (cons x (getvar x))) '("cmdecho" "snapstyl" "snapisopair"))) (setvar 'cmdecho 0) (setvar 'snapstyl 1) (setq mode (cond ((= kw "LEFT") 0) ((= kw "TOP") 1) ((= kw "RIGHT") 2) ((= kw "ALL") '(0 2 1)) ) ) (if (listp mode) (progn (princ "\nMidpoint of Top/Rigth/Left") (While (< (length ptlst) 3) (setq pt (getpoint "Isometric Circle \nPick Center Point of Isometric Circle:")) (if pt (setq ptlst (cons pt ptlst))) ) (mapcar '(lambda (m k) (setvar 'snapisopair m) (el k d)) mode ptlst) ) (progn (setvar 'snapisopair mode) (setq pt1 (getpoint "Isometric Circle \nPick Center Point of Isometric Circle:")) (el pt1 d) ) ) ;; Resets the variables '(("cmdecho" . value)("snapstyl" . value) ... ) (mapcar '(lambda (x) (setvar (car x) (cdr x))) vars) ) ) (princ) ) Toggle Snap/Isometric/Standard (defun c:sa nil (setvar 'snapstyl (boole 6 1 (getvar 'Snapstyl)))) HTH Good Evening pBe! just tried your code. Unfortunately am using 2008 version here at home. i encountered an error Error: no function definition: VLAX-CURVE-GETENDPARAM maybe in higher version it will work. (or on my side only) Quote Link to comment Share on other sites More sharing options...
pBe Posted September 13, 2012 Share Posted September 13, 2012 Post updated to include this line (vl-load-com) Its a corroboration of rons and your code and mine. What the code does is prompt you for center point of polygon. preferably the midpoint of the lines you created as guide. but you can also use the snap mid of two points. You can create the polygon one a time or all three in order of Top/Right/Left. Try it and tell me what you think HTH Quote Link to comment Share on other sites More sharing options...
nod684 Posted September 13, 2012 Author Share Posted September 13, 2012 (edited) Post updated to include this line (vl-load-com) Its a corroboration of rons and your code and mine. What the code does is prompt you for center point of polygon. preferably the midpoint of the lines you created as guide. but you can also use the snap mid of two points. You can create the polygon one a time or all three in order of Top/Right/Left. Try it and tell me what you think HTH Yes! it worked like a charm pBe! very nice! thanks a lot for this code! thank you all truly! Edited September 13, 2012 by nod684 Quote Link to comment Share on other sites More sharing options...
pBe Posted September 13, 2012 Share Posted September 13, 2012 You are welcome Glad i could help Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted September 13, 2012 Share Posted September 13, 2012 You're welcome, nod684, but my and Lee's isopolygons are identical and pBe's is different... Simply, my and Lee's uses real polygon to isometric transformation... I can't analyze pBe's code too much, just saying that you have to be careful - first look on polygon may trick even trained eyes... pBe's c:sa function is fine, so thanks to pBe too... M.R. (arch.) Quote Link to comment Share on other sites More sharing options...
pBe Posted September 14, 2012 Share Posted September 14, 2012 but my and Lee's isopolygons are identical and pBe's is different... M.R. (arch.) Indeed it is Marko. I pick up from where the OP left off, following the original approach "conventional" that is . That way the code makes more sense to Nod684 (me thinks) pBe's c:sa function is fine, so thanks to pBe too... Cool beans Cheers Quote Link to comment Share on other sites More sharing options...
nod684 Posted September 14, 2012 Author Share Posted September 14, 2012 Indeed it is Marko. I pick up from where the OP left off, following the original approach "conventional" that is . That way the code makes more sense to Nod684 (me thinks) Cool beans Cheers yes pBe, did not even expect that you would adopt portions of mine coz i am really new to this and have much much more to learn! thank you all for the support and guidance. same goes to MR and LEE! i always look for commented routines so as to know what each and every line of the code is all about and hopefully gain something from it Quote Link to comment Share on other sites More sharing options...
pBe Posted September 14, 2012 Share Posted September 14, 2012 Anything for a "kabayan" Cheers Quote Link to comment Share on other sites More sharing options...
nod684 Posted September 14, 2012 Author Share Posted September 14, 2012 Anything for a "kabayan" Cheers Maraming Salamat! 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.