lastknownuser Posted June 11 Posted June 11 (edited) Wanted to ask what would be the best way to get all outer regions of selected lines. Image attached, want to select only the outer regions marked red. My idea was to loop through all created regions, determine the one with largest area, then check if that one intersects with other, if yes remove them from selection set. If any left do it again, if like in this example there are two separate, not connected areas. Is there any better, faster way to do that? Also question about intersection, if I select two regions that are touching in for example 3 points, I get a list of length 24 (8 points), so I have double points. I plan to use those points also later for something, is it possible to avoid these doubles? Or I'll have to filter those Here is the code I use to get intersection (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'IntersectWith (vlax-ename->vla-object (car (entsel))) acextendnone) Edited June 11 by lastknownuser Quote
BIGAL Posted June 11 Posted June 11 (edited) Easy manual way 1st draw a single random closed pline shape around your objects, then do Bpoly, pick a point just inside the dummy outer pline, then delete the 2, yes two dummy plines you have your result. Use (entlast) and get pline vertice points. Set desired layer 1st. Ok so will leave it to you to do a lisp version. Edited June 11 by BIGAL Quote
lastknownuser Posted June 11 Author Posted June 11 37 minutes ago, BIGAL said: Easy manual way 1st draw a single random closed pline shape around your objects, then do Bpoly, pick a point just inside the dummy outer pline, then delete the 2, yes two dummy plines you have your result. Use (entlast) and get pline vertice points. Set desired layer 1st. Ok so will leave it to you to do a lisp version. You described this right? https://www.lee-mac.com/outlineobjects.html Maybe I should have said it, I'm using regions for a reason and want to avoid using command boundary, because it does not give good result for large areas especially if there are short lines. Its precision depends on zoom. Also using regions is much faster. I'm just wondering if there is a better and faster way to determine outer regions than the one I described in first post. Quote
lastknownuser Posted June 11 Author Posted June 11 3 hours ago, lastknownuser said: Also question about intersection, if I select two regions that are touching in for example 3 points, I get a list of length 24 (8 points), so I have double points. I plan to use those points also later for something, is it possible to avoid these doubles? Or I'll have to filter those Here is the code I use to get intersection (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'IntersectWith (vlax-ename->vla-object (car (entsel))) acextendnone) Okay I think I figured this out, result are points for each line of region that intersects, in my example I had 8 lines that intersect Quote
BIGAL Posted June 11 Posted June 11 (edited) If you have CIV3D you have "shrinkwrap". If prepared to pay there is boundary software out there that does extreme complex shapes. Back to Bpoly what is slow about it, post a sample dwg. Yes at around 445 objects starts to slow down a bit. Took a few seconds. Edited June 11 by BIGAL Quote
lastknownuser Posted June 12 Author Posted June 12 No civil available unfortunately, even though I think AutoCAD map would be more suitable for my needs, not sure. I need something very specific, and something I can change/adjust by the needs, so I'd rather do it myself, I know I can make it, I have the idea, just trying to figure out the best, most efficient way to do it. I attached sample dwg of some made up area. Method you described makes more polylines than needed (photo attached), but what is the real problem for me are missing vertices (I drew red arrow where they are missing). At least they are missing for me on my AutoCAD. And like in first post, I can have many areas like this separated (smaller or bigger), which complicates things, and I'd like to outline them all at once OUTER BOUNDARY TEST.dwg Quote
BIGAL Posted June 13 Posted June 13 I think the answer is in that I made all internal linework on another layer and turned that layer off then did a JOIN a couple of trims and add a line and got a good Pline answer reflecting the red outer line work. Maybe 2-3 minutes work. Having internals on for automation would probably always give wrong answers. Quote
XDSoft Posted June 13 Posted June 13 https://www.theswamp.org/index.php?topic=59615.0 Search Outlines: (defun c:xdtb_searchoutlines (/ ss) (xdrx-begin) (xd::doc:getdouble (xdrx-string-multilanguage "\n输入容差" "\nInput tolerance") "#xd-var-global-equalpoint-tol" (xdrx-getvar "equalpoint") ) (xdrx-sysvar-push (list "equalpoint" #xd-var-global-equalpoint-tol)) (and (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选择生成regions的曲线<退出>:" "\nSelect to generate Curves for regions <Exit>:" ) '((0 . "*line,arc")) ) ) (setq ss (xdrx-geom-searchoutline ss)) (xdrx-prompt (xdrx-string-formatex (xdrx-string-multilanguage "\n生成了 %d 个regions." "\nGenerated %d regions." ) (sslength ss) ) ) ) (xdrx-sysvar-pop) (xdrx-end) (princ) ) ===================================== The above code uses XDrx API, download link: https://github.com/xdcad/XDrx-API-zip https://sourceforge.net/projects/xdrx-api-zip/ Dual version link: https://github.com/xdcad 1 Quote
XDSoft Posted June 13 Posted June 13 https://www.theswamp.org/index.php?topic=59614.0 2: Search Regions: (defun c:xdtb_searchregions (/ ss) (xdrx-begin) (xd::doc:getdouble (xdrx-string-multilanguage "\n输入容差" "\nInput tolerance") "#xd-var-global-equalpoint-tol" (xdrx-getvar "equalpoint") ) (xdrx-sysvar-push (list "equalpoint" #xd-var-global-equalpoint-tol)) (and (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选择生成regions的曲线<退出>:" "\nSelect to generate Curves for regions <Exit>:" ) '((0 . "*line,arc")) ) ) (setq ss (xdrx-geom-searchregions ss)) (xdrx-prompt (xdrx-string-formatex (xdrx-string-multilanguage "\n生成了 %d 个regions." "\nGenerated %d regions." ) (sslength ss) ) ) ) (xdrx-sysvar-pop) (xdrx-end) (princ) ) ===================================== The above code uses XDrx API, download link: https://github.com/xdcad/XDrx-API-zip https://sourceforge.net/projects/xdrx-api-zip/ Dual version link: https://github.com/xdcad Quote
lastknownuser Posted June 13 Author Posted June 13 2 hours ago, XDSoft said: https://www.theswamp.org/index.php?topic=59615.0 Search Outlines: (defun c:xdtb_searchoutlines (/ ss) (xdrx-begin) (xd::doc:getdouble (xdrx-string-multilanguage "\n输入容差" "\nInput tolerance") "#xd-var-global-equalpoint-tol" (xdrx-getvar "equalpoint") ) (xdrx-sysvar-push (list "equalpoint" #xd-var-global-equalpoint-tol)) (and (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选择生成regions的曲线<退出>:" "\nSelect to generate Curves for regions <Exit>:" ) '((0 . "*line,arc")) ) ) (setq ss (xdrx-geom-searchoutline ss)) (xdrx-prompt (xdrx-string-formatex (xdrx-string-multilanguage "\n生成了 %d 个regions." "\nGenerated %d regions." ) (sslength ss) ) ) ) (xdrx-sysvar-pop) (xdrx-end) (princ) ) ===================================== The above code uses XDrx API, download link: https://github.com/xdcad/XDrx-API-zip https://sourceforge.net/projects/xdrx-api-zip/ Dual version link: https://github.com/xdcad Yes exactly this, thank you, I will use it and hope it will be valuable to somebody else too 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.