Johntosh Posted April 25, 2009 Share Posted April 25, 2009 Considering that it couldn't be done - without knowing what all that coding is after using (entget(car(entsel))) - I needed a work-around... ...I collected my regions into a selection set and exploded them leaving the resultant lines. I then acquired the lines into another selection set and then return all the coordinates. Now this was achievable (to my knowledge) if there were no other lines in the drawing as I used the "_X" method. Yet if there had been, was there a way for me to collect all the component parts of the exploded region? All the regions have varying line counts. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 25, 2009 Share Posted April 25, 2009 Why not just explode each region in turn, and collect the result of each? This could be done either through VL methods or otherwise. Quote Link to comment Share on other sites More sharing options...
Johntosh Posted April 25, 2009 Author Share Posted April 25, 2009 ...but how do you collect them? Is there a setting used for 'remembering' the exploded parts? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 25, 2009 Share Posted April 25, 2009 These are two ways I would approach it: in VL: [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:test [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] Reg RetObj RetEnt[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] Reg [b][color=RED]([/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entsel[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] RetObj [b][color=RED]([/color][/b][b][color=BLUE]vlax-safearray->list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-variant-value[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-explode[/color][/b] Reg[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]alert[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-princ-to-string[/color][/b] RetObj[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [i][color=#990099]; Convert to Ename?[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] RetEnt [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]vlax-vla-object->ename[/color][/b] RetObj[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]alert[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-princ-to-string[/color][/b] RetEnt[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] In Common: [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:test [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] Reg RetEnts[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] Reg [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entsel[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]command[/color][/b] [b][color=#ff00ff]"_explode"[/color][/b] Reg[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] RetEnts [b][color=RED]([/color][/b]Ent_List_to_End Reg[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]alert[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-princ-to-string[/color][/b] RetEnts[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] Ent_List_to_End [b][color=RED]([/color][/b]ent [b][color=BLUE]/[/color][/b] a[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]reverse[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] a [b][color=RED]([/color][/b][b][color=BLUE]entnext[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] ent [b][color=RED]([/color][/b]Ent_List_to_End a[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] I personally prefer the VL method, it seems more reliable. Quote Link to comment Share on other sites More sharing options...
Johntosh Posted April 25, 2009 Author Share Posted April 25, 2009 Thanks Lee, I see it now. An exploded Region is replaced by it's component parts in the database order. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 25, 2009 Share Posted April 25, 2009 Yes. I would still be inclined to use Visual LISP for this task though. The explode method in VL automatically returns the components in an array, so you needn't use a sub-function to scour the database. Quote Link to comment Share on other sites More sharing options...
SEANT Posted April 25, 2009 Share Posted April 25, 2009 May need to check if the "explode" returned more regions. If the original was a composite, or had islands, a second explode may be in order. Quote Link to comment Share on other sites More sharing options...
wizman Posted April 25, 2009 Share Posted April 25, 2009 after exploding, you can also use select>Previous to get the new entities. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 25, 2009 Share Posted April 25, 2009 May need to check if the "explode" returned more regions. If the original was a composite, or had islands, a second explode may be in order. I thought a region only exploded into Lines, Arcs and Splines? What instances do you speak of? Quote Link to comment Share on other sites More sharing options...
SEANT Posted April 25, 2009 Share Posted April 25, 2009 Something like this. It is unusual. but certainly a possibility. IslandRegion.dwg Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 25, 2009 Share Posted April 25, 2009 Good point, OK, perhaps this then: [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:test [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] Reg RetObj[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] Reg [b][color=RED]([/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entsel[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] RetObj [b][color=RED]([/color][/b][b][color=BLUE]vlax-safearray->list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-variant-value[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-explode[/color][/b] Reg[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]repeat[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]length[/color][/b] RetObj[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#ff00ff]"AcDbRegion"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-ObjectName[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] RetObj[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] RetObj [b][color=RED]([/color][/b][b][color=BLUE]append[/color][/b] RetObj [b][color=RED]([/color][/b][b][color=BLUE]vlax-safearray->list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-variant-value[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-explode[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] RetObj[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] RetObj [b][color=RED]([/color][/b][b][color=BLUE]append[/color][/b] RetObj [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] RetObj[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] RetObj [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] RetObj[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]alert[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-princ-to-string[/color][/b] RetObj[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] Quote Link to comment Share on other sites More sharing options...
magan Posted November 18, 2014 Share Posted November 18, 2014 Respected sir, I want to ask you that whether we can get the center and radius of a circle by just one click on rectangle of the block of drawing shown by SEANT. Please help me, sir. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted November 18, 2014 Share Posted November 18, 2014 magan, use (setq parentbl (tblobjname "BLOCK" "Your block name")) to get parent block ename... Then use (setq nent (entnext parentbl)) to get 1st nested ename of parent, and iterate through all of them with (while (setq nent (entnext nent)) ... ). For each nent, you should check DXF 0 - if it's "CIRCLE" then you can get center with DXF 10, and its radius with DXF 40... Quote Link to comment Share on other sites More sharing options...
magan Posted November 19, 2014 Share Posted November 19, 2014 sir, its not working. please help me little bit more in this regard so that i can reach to my final destination of work. Error msg: bad argument. Please help me sir...... 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.