我是VBA的新手,但我一直在尝试自动化导出过程。基本上它将网格Catia结构导出到TEXT文件(.dat)。但每次我尝试运行代码时,它都会显示编译错误,预期函数或变量消息。
代码如下:
Sub CATMain()
Set doc = CATIA.ActiveDocument
' Open the CATAnalysis Document
Set oAnalysisDocument = CATIA.ActiveDocument
Set oAnalysisManager = oAnalysisDocument.Analysis
Set oAnalysisModels = oAnalysisManager.analysisModels
Set oAnalysisModel = oAnalysisModels.Item(1)
Set oAnalysisSets = oAnalysisModel.AnalysisSets
Set oAnalysisSet = oAnalysisSets.ItemByType("PropertySet")
Set oAnalysisImages = oAnalysisSet.AnalysisImages
Set oAnalysisImage = oAnalysisImages.Add("Material_Fringe", False, False, True)
'export data in exportfile1.txt (format txt)
Set fileSystem1 = CATIA.FileSystem
Set folder1 = fileSystem1.GetFolder(sOut)
oAnalysisImage.ExportData folder1, "exportfile1", "txt"
End Sub
弹出错误时,.ExportDataInGlobalAxis
始终会突出显示。
感谢您的回复,我检查了脚本,结果证明是不正确的。但是,我从CAA V5 Visual Basic帮助中获得了一个名为CAAAniPostProExportData
的新脚本,但是当我尝试执行它时,它会发回一个scriptingERR 1002错误,并在我尝试编辑脚本时突出显示文本oAnalysisImage.ExportData folder1, "exportfile1", "txt"
。 “ExportDataInGlobalAxis和其他导出”也是Vba中的函数。旧代码已被上面给出的新代码替换。