CATIA中導(dǎo)出參數(shù)值到excel或者txt文本的兩種方法
01
方法一
第一種方法:利用設(shè)計(jì)表導(dǎo)出CATIA文件參數(shù)。
我們想要導(dǎo)出如下結(jié)構(gòu)樹中的參數(shù):length,width,height,radius,density。
采用設(shè)計(jì)表方法,基于現(xiàn)有參數(shù)創(chuàng)建設(shè)計(jì)表。
選定想要導(dǎo)出的所有參數(shù),必要的時(shí)候使用過濾器進(jìn)行過濾,此處我們只導(dǎo)出用戶參數(shù),所以進(jìn)行了用戶參數(shù)過濾。
選擇導(dǎo)出txt文本到本地,打開txt文本便可以看見我們導(dǎo)出的參數(shù)。
關(guān)于設(shè)計(jì)表的具體操作方法可以參考我們以前的講解,如下鏈接,點(diǎn)擊跳轉(zhuǎn):
如何在CATIA中建立一個(gè)標(biāo)準(zhǔn)零件庫?----- 200個(gè)CATIA小技巧持續(xù)更新中~~
01
方法二
第二種方法就是:采用CATIA 宏代碼批量導(dǎo)出參數(shù)值到excel文件當(dāng)中,下面直接給出相關(guān)代碼,大家可以自行研究,并進(jìn)行改編。
Sub ExportParametersToCSV() Dim sPath As String sPath = CATIA.FileSelectionBox("Export Parameters to .csv", "*.csv", CatFileSelectionModeSave) Dim oSelection Set oSelection = CATIA.ActiveDocument.Selection CATIA.Interactive = False oSelection.Clear oSelection.Search "Knowledgeware.Parameter,all" Open sPath For Output As #1 Dim i As Integer For i = 1 To oSelection.Count Dim oSelectedElement As SelectedElement Set oSelectedElement = oSelection.Item(i) Dim sElementName As String sElementName = oSelectedElement.Value.Name Dim sElementPath As String sElementPath = oSelectedElement.Value.Value sLine = sElementName + "," + sElementPath Print #1, sLine Next oSelection.Clear CATIA.Interactive = True Close #1 MsgBox "Done" End Sub |
vba代碼操作視頻演示效果
文章來源:CATIA小螞蟻
工程師必備
- 項(xiàng)目客服
- 培訓(xùn)客服
- 平臺(tái)客服
TOP




















