xarial / xcad

Framework for developing CAD applications for SOLIDWORKS, including add-ins, stand-alone applications, macro features, property manager pages, etc.
https://xcad.net
MIT License
126 stars 25 forks source link

IEnumerable<IXEdge> had been removed from IXFace #109

Closed Brent-bai closed 9 months ago

Brent-bai commented 9 months ago

In source code (old version from github), I find the interface of IXFace has the IEnumerable property, but there is not in Version 0.8.0 beta.4687. So, it had been removed from the new version?

artem1t commented 9 months ago

It has been replaced with IXFace::AdjacentEntities which iterates all connected entities: https://github.com/xarial/xcad/blob/dev/docs/changelog/index.md?plain=1#L23

The best way to use it is with the Filter option, e.g.

var edges = face.AdjacentEntities.Filter<IXEdge>()

In this case, it will only iterate edges and not other connected entities so it is equivalent of IXFace::Edges

You can also do it this way:

var edges = face.AdjacentEntities.OfType<IXEdge>()

which will also give you the same correct result, but it will iterate through vertices as well and skip it because of OfType filter so it will be extra iteratiom.

Brent-bai commented 9 months ago

Thank you!