gib65 Posted May 12, 2006 Share Posted May 12, 2006 I'm trying to create a region out of a closed polyline and it keeps telling me I have self intersection. What is a self intersection? I'm guessing it means the polylines criss-cross at some point, but I don't see any such thing anywhere. I would I find it? Quote Link to comment Share on other sites More sharing options...
umop-3p!sdn Posted May 12, 2006 Share Posted May 12, 2006 The only way I've ever gotten past that is to zoom in EXTREMELY on every intersecting line .... Anyone have a better way? Quote Link to comment Share on other sites More sharing options...
fuccaro Posted May 15, 2006 Share Posted May 15, 2006 Try to select the polyline and go to the PROPERTIES window (CTRL+1). Under the GEOMETRY you have the properties of the Vertex1. Click the field where says Vertex1 and you see two arrows pointing to left/right. Press one of them and you can see the other vertexes. Watch the screen and you will see a mark "walking" on your polyline. Sometimes you can see the place where "something is wrong" just watching the order and the position of the vertexes. Also you can use the PEDIT command for this. Quote Link to comment Share on other sites More sharing options...
iTijn Posted March 17, 2009 Share Posted March 17, 2009 I have the same errormessage with an spline. It's a logo converted from EPS to DWG. Unfortunately it seems that Spline doesn't allow you to 'walk' trought the vertices. Any Idea how to tackle this one? Quote Link to comment Share on other sites More sharing options...
skipsophrenic Posted March 17, 2009 Share Posted March 17, 2009 I have the same errormessage with an spline.It's a logo converted from EPS to DWG. Unfortunately it seems that Spline doesn't allow you to 'walk' trought the vertices. Any Idea how to tackle this one? Not sure about the problem mate sorry, But just to let you know, if the threads been inactive for a couple of years, it's best to start a new one. Hope someone more knowledgable than me can help you out. Quote Link to comment Share on other sites More sharing options...
iTijn Posted March 17, 2009 Share Posted March 17, 2009 It is indeed a very old thread, but I wouldn't see why we couldn't bundle the solutions for this problem. Thank you for any help. I am manually tracing all my clients product logo's at the moment. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 17, 2009 Share Posted March 17, 2009 Could you not use "FLATTEN" to convert your spline to a *POLYLINE? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 17, 2009 Share Posted March 17, 2009 In answer to the OP's inital question: ; Self-Intersection Test by Lee McDonnell ~ 17.03.09 (defun c:SelfInt (/ ent iArr vLst iLst ptLst) (vl-load-com) (if (and (setq ent (vlax-ename->vla-object (car (entsel "\nSelect LWPline...")))) (eq "AcDbPolyline" (vla-get-ObjectName ent)) (> (vlax-safearray-get-u-bound (setq iArr (vlax-variant-value (vla-IntersectWith ent ent acExtendNone))) 1) 0)) (progn (setq vLst (mapcar '(lambda (x) (append (cdr x) '(0.0))) (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget (vlax-vla-object->ename ent))))) (setq iLst (vlax-safearray->list iArr)) (while (not (zerop (length iLst))) (setq ptLst (cons (list (car iLst) (cadr iLst) (caddr iLst)) ptLst) iLst (cdddr iLst))) (setq ptLst (vl-remove-if '(lambda (x) (member x vLst)) ptLst)) (if ptLst (alert (strcat "Object Intersects Itself in " (rtos (length ptLst) 2 0) " place(s).\n\n" (vl-princ-to-string ptLst))) (princ "\n<!> Object Doesn't Intersect Itself <!>"))) (princ "\n<!> Object isn't a LWPline, or doesn't Intersect Itself <!>")) (princ)) The above will find all self-intersections for LWPOLYLINEs. Quote Link to comment Share on other sites More sharing options...
alanjt Posted March 18, 2009 Share Posted March 18, 2009 nice Lee Mac you can also (if whatever autocad you're using has it) shrinkwrap it, then just delete the old pline, or draw a rectangle around the pline, and bpoly in the rectangle; it will draw a new pline around the old pline. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 18, 2009 Share Posted March 18, 2009 Thanks Alan, Am only using ACAD '04 - don't think I've even heard of the methods of which you speak Let me know if you think its available with '04 Lee Quote Link to comment Share on other sites More sharing options...
alanjt Posted March 18, 2009 Share Posted March 18, 2009 Thanks Alan, Am only using ACAD '04 - don't think I've even heard of the methods of which you speak Let me know if you think its available with '04 Lee well, shrinkwrap is an AEC command, won't come with generic acad. however, bpoly has been around forever. bpoly, boundary, bp: i think these are the possible ways to execute it. I haven't had a chance to test your routine, but I'm really excited about it. Sometimes, when i extract the boundary from a surface (to then alter & set as my surface boundary), it will tell me give me my polyline intersects itself. Generally shrinkwrap will solve the problem, but there are the situations where that won't do it (the new pline shrinkwrap creates will intersect itself). Lee, are you taking coding classes? Just curious; seems like your coding has really improved in a short amount of time. Then again, i may be confusing your coding with someone else. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 18, 2009 Share Posted March 18, 2009 Lee, are you taking coding classes? Just curious; seems like your coding has really improved in a short amount of time. Then again, i may be confusing your coding with someone else. Thanks Alan, but no, I am not taking (and have never taken) coding classes... just learning from the people on here mostly. ASMI's code has been a great help with the VL which I am just starting to get to grips with. I was always against using it and usually just resorted to the DXF code approach in most cases. But now that I have dipped my toe into the world of VL, things are a lot easier to manipulate with a lot less coding. I learn most from just dissecting the code posted on here and see how people do things. That, and an AutoLISP reference manual helps. Cheers Lee EDIT: plus the fact that I now spend pretty much every spare minute I get on this forum and coding. - I think an addiction is emerging... Quote Link to comment Share on other sites More sharing options...
alanjt Posted March 18, 2009 Share Posted March 18, 2009 Thanks Alan, but no, I am not taking (and have never taken) coding classes... just learning from the people on here mostly. ASMI's code has been a great help with the VL which I am just starting to get to grips with. I was always against using it and usually just resorted to the DXF code approach in most cases. But now that I have dipped my toe into the world of VL, things are a lot easier to manipulate with a lot less coding. I learn most from just dissecting the code posted on here and see how people do things. That, and an AutoLISP reference manual helps. Cheers Lee EDIT: plus the fact that I now spend pretty much every spare minute I get on this forum and coding. - I think an addiction is emerging... it's most definitely addictive. yeah, until recently, i always just accessed the DXF library and did my coding from there. with our switch to 09 and beginning the usage of multileaders and annotative text, i realized a lot of my entmod routines didn't work. i looked into accessing the information through vla and soon realized that once you get the hang of how to retrieve the information, VLA is beyond powerful and so much better. i was able to completely rewrite (from scratch) several routines in one night; completely written in VLA. Quote Link to comment Share on other sites More sharing options...
orion Posted October 8, 2009 Share Posted October 8, 2009 Offset the line a little bit- say .1". Delete the original. Offset it back. viola. Quote Link to comment Share on other sites More sharing options...
M76 Posted December 19, 2009 Share Posted December 19, 2009 In answer to the OP's inital question: ; Self-Intersection Test by Lee McDonnell ~ 17.03.09 (defun c:SelfInt (/ ent iArr vLst iLst ptLst) (vl-load-com) (if (and (setq ent (vlax-ename->vla-object (car (entsel "\nSelect LWPline...")))) (eq "AcDbPolyline" (vla-get-ObjectName ent)) (> (vlax-safearray-get-u-bound (setq iArr (vlax-variant-value (vla-IntersectWith ent ent acExtendNone))) 1) 0)) (progn (setq vLst (mapcar '(lambda (x) (append (cdr x) '(0.0))) (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget (vlax-vla-object->ename ent))))) (setq iLst (vlax-safearray->list iArr)) (while (not (zerop (length iLst))) (setq ptLst (cons (list (car iLst) (cadr iLst) (caddr iLst)) ptLst) iLst (cdddr iLst))) (setq ptLst (vl-remove-if '(lambda (x) (member x vLst)) ptLst)) (if ptLst (alert (strcat "Object Intersects Itself in " (rtos (length ptLst) 2 0) " place(s).\n\n" (vl-princ-to-string ptLst))) (princ "\n<!> Object Doesn't Intersect Itself <!>"))) (princ "\n<!> Object isn't a LWPline, or doesn't Intersect Itself <!>")) (princ)) The above will find all self-intersections for LWPOLYLINEs. Hi I'm trying to break polylines at self intersections, your code looks great, but it does not detect the intersection if the line has a vertex at that point. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 19, 2009 Share Posted December 19, 2009 Hi I'm trying to break polylines at self intersections, your code looks great, but it does not detect the intersection if the line has a vertex at that point. All the vertices of the polyline will be registered as self-intersections - hence I removed them from the list. I shall look at the code for you Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 19, 2009 Share Posted December 19, 2009 Check this: [i][color=#990099]; Self-Intersection Test by Lee McDonnell ~ 19.12.09[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] SelfInt [b][color=RED]([/color][/b]obj [b][color=BLUE]/[/color][/b] vlax-list->3D-point obj[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]defun[/color][/b] vlax-list->3D-point [b][color=RED]([/color][/b]lst[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] lst [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] lst[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cadr[/color][/b] lst[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]caddr[/color][/b] lst[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]vlax-list->3D-point [b][color=RED]([/color][/b][b][color=BLUE]cdddr[/color][/b] lst[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]or[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=DARKRED]'[/color][/b]VLA-OBJECT [b][color=RED]([/color][/b][b][color=BLUE]type[/color][/b] obj[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] obj [b][color=RED]([/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] obj[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]vlax-list->3D-point [b][color=RED]([/color][/b][b][color=BLUE]vlax-invoke[/color][/b] obj [b][color=DARKRED]'[/color][/b]IntersectWith obj [b][color=Blue]acExtendNone[/color][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:test [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] ent obj[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ent [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entsel[/color][/b] [b][color=#ff00ff]"\nSelect Object: "[/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]cond[/color][/b] [b][color=RED]([/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=DARKRED]'[/color][/b]ENAME [b][color=RED]([/color][/b][b][color=BLUE]type[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-method-applicable-p[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] obj [b][color=RED]([/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=DARKRED]'[/color][/b]IntersectWith[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** Invalid Selection **"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]foreach[/color][/b] x [b][color=RED]([/color][/b]SelfInt obj[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]print[/color][/b] x[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=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...
Lee Mac Posted December 19, 2009 Share Posted December 19, 2009 Try this for breakages: ; Self-Intersection Test by Lee McDonnell ~ 19.12.09 (defun SelfInt (obj / vlax-list->3D-point obj) (vl-load-com) (defun vlax-list->3D-point (lst) (if lst (cons (list (car lst) (cadr lst) (caddr lst)) (vlax-list->3D-point (cdddr lst))))) (or (eq 'VLA-OBJECT (type obj)) (setq obj (vlax-ename->vla-object obj))) (vlax-list->3D-point (vlax-invoke obj 'IntersectWith obj acExtendNone))) (defun c:test (/ *error* vl ov ent obj uflag doc) (vl-load-com) (defun *error* (msg) (and ov (mapcar (function setvar) vl ov)) (and uflag (vla-EndUndomark doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq vl '("CMDECHO" "OSMODE") ov (mapcar (function getvar) vl)) (mapcar (function setvar) vl '(0 0)) (while (progn (setq ent (car (entsel "\nSelect Object: "))) (cond ( (eq 'ENAME (type ent)) (if (not (vlax-method-applicable-p (setq obj (vlax-ename->vla-object ent)) 'IntersectWith)) (princ "\n** Invalid Selection **") (progn (setq uflag (not (vla-StartUndomark (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))))) (defun BrkSelf (ent) (foreach x (SelfInt ent) (vl-cmdf "_.break" (list ent x) "_F" x x) (BrkSelf (entlast)))) (BrkSelf ent) (setq uflag (vla-EndUndoMark doc)))))))) (mapcar (function setvar) vl ov) (princ)) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 19, 2009 Share Posted December 19, 2009 Alternatively, see here: http://www.theswamp.org/index.php?topic=10370.0 Quote Link to comment Share on other sites More sharing options...
Koki Posted October 14, 2020 Share Posted October 14, 2020 On 10/8/2009 at 10:11 PM, orion said: Offset the line a little bit- say .1". Delete the original. Offset it back. viola. Thanks you so mush, This worked for me, I dropped the Daylights(boundary) from Civil3D corridor, and they had like thousands self intersecting points, The lisps that were posted identified them, but Offset in and out 0.1 did the trick.. It did not want to offset out but In was working .. Thanks 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.