楼上说的这个方法更好,我找到了示例代码:
...
' Retrieve the active document
Dim oDocument As Document
Set oDocument = CATIA.ActiveDocument
' Test the document's type, if it is not a drawing document the macro stops
If TypeName(oDocument) = "DrawingDocument" Then
Dim oDrawingDocument As DrawingDocument
Set oDrawingDocument = oDocument
Else
MsgBox "This macro can be run with a drawing document only."
Exit Sub
End If
另外,英文资料就是ds自带的,装好开发环境后就有。
Document类型有的属性叫Document 。
Property FullName( ) As CATBSTR (Read Only)
Returns the document's full file name, including its path.
Example:
This example retrieves in DocFullName the Doc document's full file name.
DocFullName = Doc.FullName
The returned value is like this:
e:\users\psr\Parts\MyNicePart.CATPart