caravanio Posted January 15, 2017 Share Posted January 15, 2017 Hello, all. Looking at the VectorScript function reference I see no functions that could tell whether a given polygon/polyline is self-intersecting. The only function that is told that it Quote "... Should remove self-intersecting segments from the result. ..." is the VS:OffsetPoly. But I don't want to see if a polygon/polyline is self intersecting as a side effect of an operation that actively acts on the selected object but just a read-only operation whether it is self-intersecting or not. Any suggestions are welcome. Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted January 18, 2017 Vectorworks, Inc Employee Share Posted January 18, 2017 Hi caravan, Try the attached script. It has not been thoroughly tested but it seems to do the trick. DoesPolySelfIntersectFunc.vs Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted January 20, 2017 Vectorworks, Inc Employee Share Posted January 20, 2017 I just played around with the script some more and realized that it only catches certain cases. The script basically creates two identical copies of the source poly and does an "intersect surface" on them. It will detect polys that intersect themselves like the poly to the right (in the attached image) because the "intersect surface" function will result in separate polys on each side of the intersection. So it does intersect surface, then counts to resultant polys. If there are more than one, the poly intersects. However, the poly on the left (in the image) will not be detected. I have some ideas of how this might be done but I need to spend a little more time. Quote Link to comment
Miguel Barrera Posted January 20, 2017 Share Posted January 20, 2017 The long way would be to test each segment with the LineLineIntersection procedure Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted January 20, 2017 Vectorworks, Inc Employee Share Posted January 20, 2017 Yes, the long way is not as fun. ;-) Try the revised script (attached). I think this may do it for you. I also added comments to explain what it's doing. Let me know how it works for you if you use it. DoesPolySelfIntersectFunc.vs Quote Link to comment
trashcan Posted April 29, 2022 Share Posted April 29, 2022 Doesn't seem to work 😞 Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted April 29, 2022 Vectorworks, Inc Employee Share Posted April 29, 2022 Seems to work for me. Can you attach a VWX file with the shape that it's not working on? Also, what Version of Vectorworks did you try it on? Quote Link to comment
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.