在solidowork焊件的工程图的-焊接清单-自动链接出-单重和总重

在solidowork焊件的工程图的-焊接清单-自动链接出-单重和总重

solidworks中如果焊件的零件不是由“结构构件”生成的话,切割清单项目的属性默认情况下会生成“材料”和“数量”2个属性。文章源自 solidworks教程网 http://gocae.comsolidworks教程网-http://gocae.com/1507.html

  • 以下方法的测试版本solidworks2016

在solidowork焊件的工程图的-焊接清单-自动链接出-单重和总重文章源自 solidworks教程网 http://gocae.comsolidworks教程网-http://gocae.com/1507.html

今天我会用“宏”来自动的给切割清单中的零件添加“单重”和“总重”,并自动链接到工程图中,这在实际工作中是非常有用的,比如零件好几百的板料的焊件,下料的尺寸、数量和重量统计。如果人工智能来做的话,不仅容易出错,工作也很繁琐。文章源自 solidworks教程网 http://gocae.comsolidworks教程网-http://gocae.com/1507.html

对于先前说的如何出下料的尺寸图,亲们可以以参考这篇文章《工程图中相对视图在solidworks多实体焊件零件中的应用把把有的下料图链接到同一张图纸上。文章源自 solidworks教程网 http://gocae.comsolidworks教程网-http://gocae.com/1507.html

今天我就给亲讲一下如何把数量和重重链接到solidworks工程图的“焊接清单明细表”中。文章源自 solidworks教程网 http://gocae.comsolidworks教程网-http://gocae.com/1507.html

1.运行宏,生成单重和总重

1.1宏代码

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

 文章源自 solidworks教程网 http://gocae.comsolidworks教程网-http://gocae.com/1507.html

1.2新建宏

在solidowork焊件的工程图的-焊接清单-自动链接出-单重和总重文章源自 solidworks教程网 http://gocae.comsolidworks教程网-http://gocae.com/1507.html

1.3运行宏后添加单重和总重属性

在solidowork焊件的工程图的-焊接清单-自动链接出-单重和总重文章源自 solidworks教程网 http://gocae.comsolidworks教程网-http://gocae.com/1507.html

在solidowork焊件的工程图的-焊接清单-自动链接出-单重和总重文章源自 solidworks教程网 http://gocae.comsolidworks教程网-http://gocae.com/1507.html

2.在工程图的焊接清单中添加单重和总重

2.1添加单重

在solidowork焊件的工程图的-焊接清单-自动链接出-单重和总重文章源自 solidworks教程网 http://gocae.comsolidworks教程网-http://gocae.com/1507.html

2.2添加总重

在solidowork焊件的工程图的-焊接清单-自动链接出-单重和总重

3D图下载此资源下载价格为4元(终身VIP免费),请先
支持微信,支付宝付款,有问题直接网站给我发邮件。最晚24小时内回复。 有失效链接的,我直接发邮件就行。
 
  • 本文由 smellycat Published on 2015年11月26日
Comments  2  Visitors  2
    • ~神话~
      ~神话~ 0

      这个功能介绍怎么不全?

        • knigh
          knigh

          在哪方面不全呢?我看了一下还好啊

      Comments are closed.