似乎还没有一篇介绍Client Feature的文章,包括我们全球博客。我来写两句。简单讲,Client Feature不是Inventor本身的功能。只有开发者能进行操作。通常两个方面的情况:
1. 自行组织Inventor的特征。
2. 附着Client Graphics。也是通过它,让Client Graphics保存到文档中。
例如,以下代码将某零件文档中的特征1和特征2添加到一个Client Feature之中。
Sub AddCF()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition
'get first feature
Dim oPartFea1 As PartFeature
Set oPartFea1 = oDef.Features(1)
'get second feature
Dim oPartFea2 As PartFeature
Set oPartFea2 = oDef.Features(2)
'create client feature definition
Dim oClientFeatureDef As ClientFeatureDefinition
Set oClientFeatureDef = oDef.Features.ClientFeatures.CreateDefinition("ClientFeatureTest")
oClientFeatureDef.ClientFeatureElements.Add oPartFea1
oClientFeatureDef.ClientFeatureElements.Add oPartFea2
'create client feature
Dim oClientFeature As ClientFeature
Set oClientFeature = oDef.Features.ClientFeatures.Add(oClientFeatureDef, "ClientIDString")
ThisApplication.ActiveView.Update
End Sub
因此基本步骤是:首先利用ClientFeatures集合里的CreateDefinition创建一个定义,定义里添加对应的特征。最后使用ClientFeatures.Add这个定义,从而形成一个ClientFeature。