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

Can't cast IXSketchArc to ISwSketchArc #83

Closed flycast closed 2 years ago

flycast commented 2 years ago

This Works:

case IXSketchLine xSketchLine:
    var swSketchLine = xSketchLine as ISwSketchLine;

Does not work. I get null for swSketchArc:

case IXSketchArc xSketchArc:
    var swSketchArc = xSketchArc as ISwSketchArc;

This works though:

case IXSketchCircle xSketchCircle:
    var swSketchCircle = xSketchCircle as ISwSketchCircle;

Even weirder...It works as a workaround to cast IXSketchArc to ISwSketchCircle.

case IXSketchArc xSketchArc:
    var swSketchArc = xSketchArc as ISwSketchCircle;
artem1t commented 2 years ago

This is a bug. It has been fixed in the 0.7.7 (currently in dev branch) and it is now available in the preview nuget feed.

Unit test is also updated to handle this case.

flycast commented 2 years ago

As always, thanks!