endofeternity Posted June 15, 2011 Share Posted June 15, 2011 (edited) SOLVED Hey everyone, I have a large .DWG with approximately 400 circles representing wells on it. The end goal is to draw an additional circle around each of these with a larger radius (150). Basically what I'm looking for is a way to automate this such that: For (object 1 to last object) { [indent]if (object is a circle) draw new circle around it[/indent] } But I'm completely at a loss as to how I would accomplish that. Is there a command that returns x,y coordinates of things? How could I distinguish the circles from the other lines and things in the drawing? Am I doomed to drawing 400 circles by hand? Thanks for any help you can provide Edited June 16, 2011 by endofeternity Quote Link to comment Share on other sites More sharing options...
bennyboy86 Posted June 15, 2011 Share Posted June 15, 2011 dont suppose the orignal circle is a block? Quote Link to comment Share on other sites More sharing options...
paulmcz Posted June 15, 2011 Share Posted June 15, 2011 (cdr (assoc 10 (entget (car (entsel "\n Select circle: "))))) This will get you X, Y and Z values of center point of selected circle. To distinguish circles from other objects, use ssget filter >> (ssget '((0 . "circle"))) Quote Link to comment Share on other sites More sharing options...
endofeternity Posted June 16, 2011 Author Share Posted June 16, 2011 dont suppose the orignal circle is a block? Yes, yes it is. Quote Link to comment Share on other sites More sharing options...
nestly Posted June 16, 2011 Share Posted June 16, 2011 Yes, yes it is. Simplest fix ever.... add an additional circle to the block definition. Quote Link to comment Share on other sites More sharing options...
endofeternity Posted June 16, 2011 Author Share Posted June 16, 2011 Simplest fix ever.... add an additional circle to the block definition. Ah. Well then! Thanks lol. I found the problem - some of the wells are defined as blocks and others are circles. But yeah overall I think I've got it covered now. Thanks guys! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 16, 2011 Share Posted June 16, 2011 A bit more (setq x 0) (setq rad (getreal "\nEnter new radius")) (setq circlist (ssget '((0 . "CIRCLE")))) (setq num (sslength circlist)) (repeat num (setq cenptxy (assoc 10 (entget (ssname circlist x)))) (setq newcen (list (cadr cenptxy)(caddr cenptxy)(caddr cenptxy))) (command "circle" newcen rad) (setq x (+ x 1)) ) (princ) Quote Link to comment Share on other sites More sharing options...
fuccaro Posted June 16, 2011 Share Posted June 16, 2011 Bigal After a nice coding, you get the circles in a selection set, you found the centerpoints and... you used that COMMAND function that is the worse thing you can write in Lisp. In this way, you should take care about the OSNAP settings too -or at least instruct the user to turn it off manually. I would use an ENTMAKE to create the new circle. See, it is so easy to post criticism to others program. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 17, 2011 Share Posted June 17, 2011 (edited) A couple of things I started with version 1.4 hence command is quick and dirty for something simple and another forum user can understand it, as I wrote it I knew some one would say it should use entmake hey thats 4 lines more code I had to type. Did you find the mistake ? Nearly every lisp I have always has set osnaps current layer etc as first thing and last to reset but that comes with experience. Same as entmakes rather than command. It was done free Did it work yes Was it the best code probably not but by the time we finish discussing I am sure all the circles have been done. Replace (command "circle" newcen rad) with (entmake (list (cons 0 "CIRCLE") (cons '10 newcen) (cons 40 Rad))) Edited June 17, 2011 by BIGAL Quote Link to comment Share on other sites More sharing options...
fuccaro Posted June 17, 2011 Share Posted June 17, 2011 Ok, Bigal. If it works, then we get an other happy user -for sure he appreciates your effort. And about that replacement you mentioned: it is *almost* 5 code lines. 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.