I've made this post for two reason: Firstly I spent a fair bit of time looking through google on this subject with practically no pointers on how to achieve the above - so I thought "I'm sure the forum will find this interesting". Secondly: If this is wrong I'm sure someone will spot the error before I do. If this is old news then let the thread die - hate the code not the coder lol
So I've been scraping the internet looking for a efficient (not create-a-region) based approach to determining if a lwPolyline intersects with it's self. Anyway after a bit of lethargy-fuelled critical thinking I discovered the following.
From what I can tell every point along a polyline is considered to be an intersection when self referencing an object with the vla-intersectWith method.
Since each point is considered an intersect a non self-intersecting lwPolyline will have the same safeArray upper bound as that of the results from vla-intersectWith - if they differ then the lwPolyline intersects itself.
EDIT:
In hindsight I probably shouldn't have called this a "how to" given that the information may be redundant || not validated by a group of peers.
I never realised until I read your code that vlax-get and vlax-invoke provide a standard list in the return. Would it be fair to say that that when using vlax-* methods (pertaining to safeArrays) the return will be in standard list format as opposed to vla-* methods which true to nature will return a safeArray of sorts?
The vlax-get/invoke are undocumented and will return the data in native AutoLISP formats - however, IIRC there are a few methods/properties for which they fail.