AnsweredAssumed Answered

Remove all Custom Properties from SLDDRW without Document Manager C#

Question asked by Aaron Heathcote on Jan 11, 2019
Latest reply on Jan 11, 2019 by Aaron Heathcote

Does anyone have a solution to open up an SLDDRW and remove all custom properties without the Document Manager?

I have requested a key a couple of times but they haven't come through yet.

 

My current code which needs DocumentManager:

                         const string sLicenseKey = "<your_license_code>";

                        SwDocumentMgr.SwDMDocument15 swDoc = default(SwDocumentMgr.SwDMDocument15);

                        SwDocumentMgr.SwDmDocumentOpenError nRetVal = 0;

                        SwDocumentMgr.SwDMClassFactory swClassFact = default(SwDocumentMgr.SwDMClassFactory);

                        SwDocumentMgr.SwDMApplication3 swDocMgr = default(SwDocumentMgr.SwDMApplication3);

                        swClassFact = new SwDocumentMgr.SwDMClassFactory();

                        swDocMgr = (SwDocumentMgr.SwDMApplication3)swClassFact.GetApplication(sLicenseKey);

                        swDoc = (SwDocumentMgr.SwDMDocument15)swDocMgr.GetDocument(NewFiles + row[2] + ".SLDDRW",                                                  SwDocumentMgr.SwDmDocumentType.swDmDocumentDrawing, false, out nRetVal);

                        string[] vCustPropNameArr = null;

                        string sCustPropStr = null;

                        SwDocumentMgr.SwDmCustomInfoType nPropType = 0;

                       

                        vCustPropNameArr = (string[])swDoc.GetCustomPropertyNames();

                        if ((vCustPropNameArr == null)) return;

 

 

                        Debug.Print(" Custom Properties:");

 

 

                        foreach (string vCustPropName in vCustPropNameArr)

                        {

                            sCustPropStr = swDoc.GetCustomProperty(vCustPropName, out nPropType);

                            Debug.Print(" " + vCustPropName + " <" + nPropType + "> = " + sCustPropStr);

                        }

 

Is there a better way which my program can open up the SLDDRW and run a loop for each custom property and deleting them?

Outcomes