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
129 stars 25 forks source link

Docmanager GetDocumentType for .sldprt .sldasm and .slddrw gives notsupported #76

Closed EddyAlleman closed 3 years ago

EddyAlleman commented 3 years ago

should be:

internal abstract class SwDmDocument : SwDmObject, ISwDmDocument { internal static SwDmDocumentType GetDocumentType(string path) { SwDmDocumentType docType;

        if (!string.IsNullOrEmpty(path))
        {
            switch (System.IO.Path.GetExtension(path).ToLower())
            {
                case ".sldprt":
                    docType = SwDmDocumentType.swDmDocumentPart;
                    break;
                case ".sldblk":
                case ".prtdot":
                case ".sldlfp":   
                case ".sldasm":
                    docType = SwDmDocumentType.swDmDocumentAssembly;
                    break;
                case ".asmdot":   
                case ".slddrw":
                    docType = SwDmDocumentType.swDmDocumentDrawing;
                    break;
                case ".drwdot":

                default:
                    throw new NotSupportedException("Only native SOLIDWORKS files can be opened");
            }
        }
EddyAlleman commented 3 years ago

code on github: image

artem1t commented 3 years ago

@EddyAlleman, this was fixed in the current version (before this issue is opened). The code above should pick .sldprt as part. Please make sure that you targeting the latest version from the nuget (this was the issue in the older version).

EddyAlleman commented 3 years ago

Hi Artem,

I must be missing something. The following file still has those errors: https://github.com/xarial/xcad/blob/master/src/SwDocumentManager/Documents/SwDmDocument.cs

Are you sure you did update your local code to github?

In my fork, there are no Xarial nuget pacakges that need updating.

Cheers,

Eddy