机械的sdk下有vba示例代码(ZWCAD_Mechanical_SDK_chs_2024\机械Sdk_2024\Vba\Proway.zvb),可以去看看。
Sub testGetTitle()
Dim objZwmApp As Object
Dim objZwmDb As Object
Dim objZwmTitle As Object
Dim objZwmBom As Object
Set objZwmApp = ThisDrawing.Application.GetInterfaceObject("ZwmToolKit.ZwmApp")
Dim strCadPath As String
objZwmApp.GetCadPath strCadPath
objZwmApp.GetDb objZwmDb
objZwmDb.OpenFile ""
Dim nFrameCount As Long
objZwmDb.GetFrameCount nFrameCount
'如果图中有多个图框,这里取其中图框数据
If nFrameCount > 0 Then
Dim strFrameName As String
objZwmDb.GetFrameName 0, strFrameName
objZwmDb.SwitchFrame strFrameName
End If
objZwmDb.GetTitle objZwmTitle
objZwmDb.GetBom objZwmBom
'得到标题栏数据
Dim nTitlePropCount As Long
Dim n As Long
nTitlePropCount = -1
objZwmTitle.GetItemCount nTitlePropCount
For n = 0 To nTitlePropCount - 1
Dim name As String
Dim label As String
Dim value As String
objZwmTitle.GetItem n, label, name, value
'组合title数据
'这里用label或者name,要和plm对文件类型字段名称的配置一致,还取决于plm服务端处理能否支持字段的多对一机制
'name
ThisDrawing.Utility.Prompt "label:" & label & " name:" & name & " value:" & value & vbCr
Next n
End Sub
太感谢啦!😁简直开启了新世界的大门,我之前只知道通过ZWcad的块属性工具可以一次导出一个文件需要的属性。摸索了一下ZwmToolKit真的提取到了明细表和标题,太赞啦!(大神太牛了)实在感谢!!👍👍 👍 PS:大神,我想再请教一下,就是ToolKit好像无法提取参数栏,只有判断有无参数栏的API接口,没有提取参数栏中属性的接口,获取通过VBA获取参数栏属性是否可行呢?
参数栏没有提供接口,可以直接当作一个普通属性块来读取,参数栏的块名是固定格式的,图框名+参数栏样式名
ok,感谢感谢!