SOLIDWORKS焊件切割清單怎么生成
相信很多SOLIDWORKS設(shè)計師都會遇到這樣一個問題,就是SolidWorks工程圖出圖的時候,我們的SolidWorks焊件切割清單的總重,是沒法設(shè)置調(diào)用的,不能通過單重x數(shù)量實現(xiàn),但是我們的SOLIDWORKS裝配體的材料明細(xì)表可以。那么如何實現(xiàn)SolidWorks焊件切割清單的總重呢?今天給大家整理分享一份網(wǎng)絡(luò)比較認(rèn)可的方法,大家可以親自實踐。
SolidWorks焊件切割清單總重設(shè)置方法
SolidWorks焊件切割清單生成單重和總重的原理呢就是利用“宏”命令來實現(xiàn),下面就給大家分享這個宏以及使用方法。
宏代碼:
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim thisFeat As SldWorks.Feature
Dim thisSubFeat As SldWorks.Feature
Dim cutFolder As Object
Dim BodyCount As Integer
Dim fn As String
Dim pn As String
Dim custPropMgr As SldWorks.CustomPropertyManager
Dim propNames As Variant
Dim vName As Variant
Dim propName As String
Dim Value As String
Dim resolvedValue As String
Dim TotalW As Double
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set thisFeat = Part.FirstFeature
Do While Not thisFeat Is Nothing
If thisFeat.GetTypeName = "SolidBodyFolder" Then
thisFeat.GetSpecificFeature2.UpdateCutList
End If
Set thisSubFeat = thisFeat.GetFirstSubFeature
Do While Not thisSubFeat Is Nothing
If thisSubFeat.GetTypeName = "CutListFolder" Then
Set cutFolder = thisSubFeat.GetSpecificFeature2
End If
If Not cutFolder Is Nothing Then
BodyCount = cutFolder.GetBodyCount
If BodyCount > 0 Then
Set custPropMgr = thisSubFeat.CustomPropertyManager
If Not custPropMgr Is Nothing Then
custPropMgr.Delete "Total Weight"
custPropMgr.Delete "Weight"
fn = thisSubFeat.Name
pn = Part.GetTitle
custPropMgr.Add "Weight", "文字", Chr(34) & "SW-Mass@@@" & fn & "@" & pn & Chr(34)
propNames = custPropMgr.GetNames
If Not IsEmpty(propNames) Then
For Each vName In propNames
propName = vName
custPropMgr.Get2 propName, Value, resolvedValue
If propName = "Weight" Then TotalW = resolvedValue
Next vName
End If
custPropMgr.Add "Total Weight", "文字", Format(BodyCount * TotalW, "0.00")
End If
End If
End If
Set thisSubFeat = thisSubFeat.GetNextSubFeature
Loop
Set thisFeat = thisFeat.GetNextFeature
Loop
End Sub
1、打開SolidWorks焊件三維圖,編輯切割清單,默認(rèn)是這種情況,會生成“材料”和“數(shù)量”2個屬性
2、點擊工具-宏-新建
3、將上面的宏代碼復(fù)制進(jìn)來,運(yùn)行宏后添加單重和總重屬性
4、然后我們會發(fā)現(xiàn),之前的切割清單多了兩項單重和總重
5、下面在SolidWorks工程圖切割清單里面調(diào)用單重和總重
注:英文標(biāo)題,在切割清單上雙擊可以修改為單重和總重漢字。
以上就是SolidWorks切割清單總重利用宏命令的方法實現(xiàn)總重的調(diào)用,趕緊試一下吧!
免責(zé)聲明:
本文系網(wǎng)絡(luò)轉(zhuǎn)載,版權(quán)歸原作者所有。如涉及版權(quán)問題,請與微辰三維聯(lián)系,我們將及時協(xié)商版權(quán)問題或刪除內(nèi)容。
相關(guān)資訊