3dwannab Posted February 5, 2022 Posted February 5, 2022 (edited) I've posted a question on the non AutoLISP section about this problem but I was wondering if there was a way to fix this with a LISP routine. I don't really know if this would be possible to fix the existing boundary command to fix this and think it would entail starting one from scratch. What I would like is to only create the boundary for the 2 outer objects (i.e to only create a boundary of anything where the picked point is picked) Here's the problem. See the gif of what's happening. I'm using 2020. If I use the boundary command or the hatch command and retain boundaries it gets the inner square as one too. Both exhibit the same problem. I'll post the drawing file for people to test also. Boundary Problem.dwg Edited February 7, 2022 by 3dwannab Quote
3dwannab Posted February 5, 2022 Author Posted February 5, 2022 34 minutes ago, mhupp said: Uncheck island detection. Tried that but that only gets a boundary of the outer square. I was looking to get the 2 outer ones (where the pick was inside them two and not the inner square) Quote
steven-g Posted February 5, 2022 Posted February 5, 2022 You are calling it a problem, but that is how the command works. Take a look at the first prompt it asks you to pick an 'internal' point from there the boundary finds the external boundary from that single point and also it finds ALL internal islands not just the first one it comes across. What you want to achieve is find the outer and only the closest inner boundary for that you would indeed need to uncheck island detection then use the boundary command twice, once internal to the outer perimeter and the second pick INTERNAL to that first island. Quote
3dwannab Posted February 5, 2022 Author Posted February 5, 2022 Thanks for explanation. I was hoping there was a way around it via a LISP routine to only get the boundaries it hits on the inside of where it was and not any subsequent inner ones. Quote
mhupp Posted February 6, 2022 Posted February 6, 2022 (edited) Their is always a way around things. It just depends on what you want. Do you always want to get the largest two shapes? You could then run thought the selection set sort by area. then just delete anything after the 2nd area. Prob just simpler to pick what you want. Edited February 6, 2022 by mhupp Quote
3dwannab Posted February 7, 2022 Author Posted February 7, 2022 I might try create boundaries with islands enabled and then ask the user for the boundaries to keep, then hatch them. I can't see no other way to get around it. It's got to do with my hatch pick routine below. I run the command pick an existing hatch and pick inside a boundary. Trouble with it is if I'm hatching a front elevation façade that has window frames inside the outer jamb, those window frames get a boundary around them. Here's the lisp. Currently it uses addselected but I was planning on modifying it to use the boundary command and hatch those to try get around my issue. (defun c:Hatch_In ( / *error* acDoc ent1 ent1_data ent1_vla sel_me ss1 ssHide tmp var_cmdecho var_hpannotative var_hpassoc var_hpbackgroundcolor var_hpbound var_hpboundretain var_hpseparate var_osmode var_selectioncycling var_snapmode ) (defun *error* (errmsg) (and acDoc (vla-EndUndoMark acDoc)) (and errmsg (not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*")) (princ (strcat "\n<< Error: " errmsg " >>\n")) ) ;;; Unhides the selection set (if ssHide (acet-ss-visible ssHide 0)) (setvar 'cmdecho var_cmdecho) (setvar 'hpannotative var_hpannotative) (setvar 'hpassoc var_hpassoc) (setvar 'hpbackgroundcolor var_hpbackgroundcolor) (setvar 'hpbound var_hpbound) (setvar 'hpboundretain var_hpboundretain) (setvar 'hpseparate var_hpseparate) (setvar 'osmode var_osmode) (setvar 'selectioncycling var_selectioncycling) (setvar 'snapmode var_snapmode) ) (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc)) (setq var_cmdecho (getvar "cmdecho")) (setq var_hpannotative (getvar "hpannotative")) (setq var_hpassoc (getvar "hpassoc")) (setq var_hpbackgroundcolor (getvar "hpbackgroundcolor")) (setq var_hpbound (getvar "hpbound")) (setq var_hpboundretain (getvar "hpboundretain")) (setq var_hpseparate (getvar "hpseparate")) (setq var_osmode (getvar "osmode")) (setq var_selectioncycling (getvar "selectioncycling")) (setq var_snapmode (getvar "snapmode")) (setvar 'cmdecho 0) (setvar 'hpbackgroundcolor ".") (setvar 'hpseparate 1) ; Separates the hatches to each boundary. (setvar 'osmode 0) (setvar 'selectioncycling 1) ;; 0 = The display options are turned off, 1 = A badge displays when you hover over objects that overlap, 2 = Both a badge and the Selection dialog box displays. (setvar 'snapmode 0) ; gridsnap: 0 off, 1 = 0n ;; Put any text, leaders, multileaders or dimensions into a selection set and ;; hides them. The error handler will undo this. (setq ssHide (ssget "_X" '((0 . "*TEXT,LEADER,MULTILEADER,DIMENSION")))) (acet-ss-visible ssHide 1) ; Hides ssHide ;; TO DO: ;; Set the boundary to a layer ;; Try to fix the island issue when picking a facade where there is jambs. The window frames get a boundary line around them. (while (not (and (setq ent1 (car (entsel "\nPlease select a HATCH to copy.\n: ------------------------------\n\nThen pick your point/s to Hatch_In'd.")) ent1_data (if ent1 (entget ent1)) ) (= (cdr (assoc 0 ent1_data)) "HATCH") (sssetfirst nil) (setq ent1_vla (vlax-ename->vla-object ent1)) (progn (setq ent_last (entlast) sel_me (ssadd) ) (while (setq tmp (entnext ent_last)) (setq ent_last tmp)) (prompt "\nNow pick your hatch point !") (if (IsAnno-p (vlax-ename->vla-object ent1)) (setvar 'hpannotative 1) ) (setvar 'hpassoc 1) (setvar 'hpboundretain 1) ; Retain boundaries (setvar 'hpbound 1) ; Create polyline boundary (setvar 'osmode 0) (if ent1 (progn (command "_.addselected" ent1 pause "") (while (< (getvar 'cmdactive) 0) (command "")) (command "_.draworder" (entlast) "" "_B") ) ) )(princ) ) ) ) (*error* nil) (princ) ) ;; end Hatch_In ;; ----------------------------------------------------------------------- ;; ----------------------=={ Functions START }==-------------------------- (defun IsAnno-p ( ent / exd ano ) (vl-load-com) (and (eq (vla-get-HasExtensionDictionary ent) :vlax-true) (setq exd (vla-GetExtensionDictionary ent) exd (vla-item exd "AcDbContextDataManager") ano (vla-item exd "ACDB_ANNOTATIONSCALES") ) (not (zerop (vla-get-Count ano))) ) ) Quote
BIGAL Posted February 7, 2022 Posted February 7, 2022 Just a random thought have you looked at closestpointto comparing your pick point and the plines made erase all other than 2 closest. The other without your sample dwg may be compare area of plines outermost should be biggest next maybe the other to keep. Sort ((area entity) Quote
3dwannab Posted February 7, 2022 Author Posted February 7, 2022 (edited) I was thinking doing something similar by perhaps pick once for the boundary and ask the user how many islands they want which could be 3 for example if I had 3 windows. Then delete every poly line after the 4th longest one (this would include the external boundary, of course) and hatch the four remaining. Seems a sort of fool proof way (I think) I get the sample portion of the drawing tomorrow as it's at work. Edited February 7, 2022 by 3dwannab Quote
lrm Posted February 11, 2022 Posted February 11, 2022 I think the following could be easily made into a VLISP program. Change to layer 1 Region command on all geometry Freeze layer 0. Union command on all but outer region. Subtract results from step 4 from outer shape. Hatch resulting region. Quote
dexus Posted August 28, 2023 Posted August 28, 2023 I came across the same challenge as discussed in this topic. Converting them to regions and preforming a union like lrm suggested was the solution for me. I used "Union Polylines.LSP" from Stefan found in the link below, this does exactly that. https://www.theswamp.org/index.php?topic=10371.msg514979#msg514979 Thought I would share in case anyone else finds this topic. 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.