|
材料明细表插入到系列零件设计表时。遇到的问题是,材料明细的配置与特征的配置不能一对一进行关联。
找了段API小代码,问题也没有得到解决。
- Private Sub ListBox1_Click()
- Dim SwFeat As Feature, SwBomFeat As BomFeature, Str
- Str = "材料明细表1"
- Set SwFeat = SwModel.FeatureByName(Str)
- Set SwBomFeat = SwFeat.GetSpecificFeature
- Dim S(0) As String, Visible
- Dim sConfig As Configuration
- With ListBox1
-
- Set sConfig = SwModel.GetConfigurationByName(.List(.ListIndex))
- SwBomFeat.Configuration = sConfig.Name
- S(0) = sConfig.Name ''.List(.ListIndex - 1)
- SwBomFeat.SetConfigurations True, Visible, S
- Label1.Caption = S(0)
- End With
- End Sub
- Private Sub ListBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
- ''
- Dim SwFeat As Feature, SwBomFeat As BomFeature, Str
- Str = "材料明细表1"
- Set SwFeat = SwModel.FeatureByName(Str)
- Set SwBomFeat = SwFeat.GetSpecificFeature
- Dim S(0) As String, Visible
- Dim sConfig As Configuration
- With ListBox1
- Set sConfig = SwModel.GetConfigurationByName(.List(.ListIndex))
- SwModel.ShowConfiguration sConfig.Name
- S(0) = .List(.ListIndex - 1)
- SwBomFeat.SetConfigurations True, Visible, S
- Label1.Caption = S(0)
- End With
- End Sub
- Private Sub UserForm_Initialize()
- Set SwApp = Application.SldWorks
- Set SwModel = SwApp.ActiveDoc
- Dim ConfArr
- ConfArr = SwModel.GetConfigurationNames
- ''
- With ListBox1
- .List = ConfArr
- End With
- End Sub
复制代码 没办法,只能安装不同版本的SW,问题还没有得到解决。
唯一的收获就是低配置的上网本,能安装多版本SW。
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|