如何利用PW中文件地址:pw:\jy-pwsrv2.cjxjy.com:jypwdb1\Documents\数字化\2020年Microstation开发\无标题,
获取该文件的ID或者GUID;
在SDK中找到以下函数是否可以解决该问题:
1. aaApi_SelectDocumentDataBufferByFilePath ;
2. aaApi_GetGuidsFromFileName;
例如:
public static AADOC_ITEM GetDocIdByPwPath(string docFullPath) { AADOC_ITEM ai = new AADOC_ITEM(); string projectpath = docFullPath.Substring(0, docFullPath.LastIndexOf("\\")); string docFileName = docFullPath.Substring(docFullPath.LastIndexOf("\\")+1); int projectno =ProjFun.aaApi_GetProjectIdByNamePath(projectpath);
if(projectno<0) return ai;
int docno = -1; int lret = aaApi_SelectDocumentsByProjectId(projectno); if (lret > 0) { for (int i = 0; i < lret; i++) { string docname = aaApi_GetDocumentStringProperty(20, i); if (docname == docFileName) { docno = aaApi_GetDocumentNumericProperty(1, i); break; } } }
ai.lProjectId = projectno; ai.lDocumentId = docno;
return ai;
}
Answer Verified By: 明昊 刘