Rain0923 Posted August 19, 2016 Share Posted August 19, 2016 Help needed a lisp!! 1.There are many circle center and base on circle center layout rectangle(rectangle can keyin size). 2.Then base on circle center rotate all rectangle for any angle. Pls Help!! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 19, 2016 Share Posted August 19, 2016 Huh ? No idea just a responce for the now 48 people who has looked at this post. If you don't explain clearly no one will answer. Quote Link to comment Share on other sites More sharing options...
Rain0923 Posted August 19, 2016 Author Share Posted August 19, 2016 sample.pdf Huh ? No idea just a responce for the now 48 people who has looked at this post. If you don't explain clearly no one will answer. Sorry!I attach a file for my explain . Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 19, 2016 Share Posted August 19, 2016 (edited) Ok a very simple lisp task so maybe its time to have a go A suggestion use VL-lisp as it more descriptive to what your retrieving for this project ; copy this next line to your command line and pick circle you will see the entity detail names use a vla-get-"entityname" (vlax-Dump-Object (vlax-Ename->Vla-Object (car (entsel "pick circle")))) : need this line at start (vl-load-com) 1 select circle get radius and center point see dump detail above 2 draw a 4 sided pline (setq pt2 (polar pt1 0 rad)) join pt1 pt2 pt3 c 3 rotate the square (command "rotate" "L" note the drag switch 4 all done ! congrats you have done a lisp Edited August 24, 2016 by BIGAL Quote Link to comment Share on other sites More sharing options...
Rain0923 Posted August 24, 2016 Author Share Posted August 24, 2016 Ok a very simple lisp task so maybe its time to have a go A suggestion use VL-lisp as it more descriptive to what your retrieving for this project ; copy this next line to your command line and pick circle you will see the entity detail names use a vla-get-"entityname" (vlax-Dump-Object (vlax-Ename->Vla-Object (car (entsel "pick circle")))) : need this line at start (vl-load-com) 1 select circle get radius and center point see dump detail above 2 draw a 4 sided pline (setq pt2 (polar pt1 0 rad)) join pt1 pt2 pt3 c 3 rotate the square (command "rotate" "L" note the /drag switch 4 all done ! congrats you have done a lisp Thanks for your reply,but I do not know how to write lisp. can you help ? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 24, 2016 Share Posted August 24, 2016 Ok ; box inside a circle by Alan H Aug 2016 using vl (defun c:circbox ( / obj rad cen) (setq obj (vlax-Ename->Vla-Object (car (entsel "pick circle")))) (setq rad (vla-get-radius obj)) (setq cen (vlax-get obj 'center)) (setq pt2 (polar cen 0.0 rad)) (setq pt3 (polar pt2 (/ pi 2.0) rad)) (setq Pt4 (polar cen (/ pi 2.0) rad)) (command "pline" cen pt2 pt3 pt4 "C") (command "rotate" "L" "" cen "drag") ) (c:circbox) ; remove this later just for testing ; box inside a circle by Alan H Aug 2016 using assoc (defun c:circbox ( / obj rad cen) (setq obj (entget (car (entsel "pick circle")))) (setq rad (cdr (assoc 40 obj))) (setq cen (cdr (assoc 10 obj))) (setq pt2 (polar cen 0.0 rad)) (setq pt3 (polar pt2 (/ pi 2.0) rad)) (setq Pt4 (polar cen (/ pi 2.0) rad)) (command "pline" cen pt2 pt3 pt4 "C") (command "rotate" "L" "" cen "drag") ) (c:circbox) ; remove this later just for testing Quote Link to comment Share on other sites More sharing options...
Rain0923 Posted October 6, 2016 Author Share Posted October 6, 2016 Thanks BIGAL. This lisp is for one circle, are there any way for many circles? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 6, 2016 Share Posted October 6, 2016 Do a bit of home work about using (setq ss (ssget '((0 . "Circle")))) then ssname, need to replace the entsel in code above with a repeat and loop through the selection set ss drawing the box around each circle. This is a real common thing in lisp even just look at some of the posts in the LISP section. If it gets to hard post again. Quote Link to comment Share on other sites More sharing options...
Rain0923 Posted October 7, 2016 Author Share Posted October 7, 2016 Sorry!!I really do not know how to write lisp,but I will try to do. Thank you very much Do a bit of home work about using (setq ss (ssget '((0 . "Circle")))) then ssname, need to replace the entsel in code above with a repeat and loop through the selection set ss drawing the box around each circle. This is a real common thing in lisp even just look at some of the posts in the LISP section. If it gets to hard post again. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 7, 2016 Share Posted October 7, 2016 Found a few minutes ; box inside a circle by Alan H Aug 2016 using vl (defun AH:circbox (obj / rad cen pt2 pt3 pt4) (setq rad (vla-get-radius obj)) (setq cen (vlax-get obj 'center)) (setq pt2 (polar cen 0.0 rad)) (setq pt3 (polar pt2 (/ pi 2.0) rad)) (setq Pt4 (polar cen (/ pi 2.0) rad)) (command "pline" cen pt2 pt3 pt4 "C") (command "rotate" "L" "" cen (getpoint cen)) ) (defun c:circbox ( / x ss obj) (setq oldsnap (getvar "osmode")) (setvar "osmode" 0) (setq ss (ssget '((0 . "Circle")))) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (AH:circbox obj) ) ; repeat (setvar "osmode" oldsnap) (princ) ) ; defun (c:circbox) Quote Link to comment Share on other sites More sharing options...
Rain0923 Posted October 11, 2016 Author Share Posted October 11, 2016 Thank you a lot!!! I found this lisp before, too. I would like to change angle for all I select, so........... Found a few minutes ; box inside a circle by Alan H Aug 2016 using vl (defun AH:circbox (obj / rad cen pt2 pt3 pt4) (setq rad (vla-get-radius obj)) (setq cen (vlax-get obj 'center)) (setq pt2 (polar cen 0.0 rad)) (setq pt3 (polar pt2 (/ pi 2.0) rad)) (setq Pt4 (polar cen (/ pi 2.0) rad)) (command "pline" cen pt2 pt3 pt4 "C") (command "rotate" "L" "" cen (getpoint cen)) ) (defun c:circbox ( / x ss obj) (setq oldsnap (getvar "osmode")) (setvar "osmode" 0) (setq ss (ssget '((0 . "Circle")))) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (AH:circbox obj) ) ; repeat (setvar "osmode" oldsnap) (princ) ) ; defun (c:circbox) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 11, 2016 Share Posted October 11, 2016 Try this ;The dtr function converts degrees to radians ;The rtd function converts radians to degrees (defun dtr (a) (* pi (/ a 180.0)) ) ; (defun rtd (a) (/ (* a 180.0) pi) ) ; box inside a circle by Alan H Aug 2016 using vl (defun AH:circbox (obj / rad cen pt2 pt3 pt4) (setq rad (vlax-get obj 'radius)) (setq cen (vlax-get obj 'center)) (setq pt2 (polar cen (+ ang 0.0) rad)) (setq pt3 (polar pt2 (+ ang (/ pi 2.0)) rad)) (setq Pt4 (polar cen (+ ang (/ pi 2.0)) rad)) (command "pline" cen pt2 pt3 pt4 "C") ) (defun c:circbox ( / x ss obj ang) (setq oldsnap (getvar "osmode")) (setvar "osmode" 0) (setq ang (dtr (getreal "\nEnter Angle"))) (setq ss (ssget '((0 . "Circle")))) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (AH:circbox obj) ) ; repeat (setvar "osmode" oldsnap) (princ) ) ; defun (c:circbox) Quote Link to comment Share on other sites More sharing options...
Rain0923 Posted October 12, 2016 Author Share Posted October 12, 2016 Thank you I tried this lisp,but circle and rectangle were not at the same location.circboxtry.pdf 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.