|
|
马上注册,结识高手,享用更多资源,轻松玩转三维网社区。
您需要 登录 才可以下载或查看,没有帐号?注册
x
我是一个很菜的菜鸟,不知道怎么处理代码,忘大神们出来帮忙改好,谢谢!' U2 g/ v6 g0 N* G, s5 y) T1 Z
代码如下:
. a; ^) \4 m! f& v; BDim swApp As SldWorks.SldWorks$ ]8 |: k. V3 W1 S
Dim swModel As SldWorks.ModelDoc
1 d6 H* K9 t: h; t! r# LDim Part As Object" l8 d" Z+ a! `0 f {# f0 A
Dim swCustPropMgr As SldWorks.CustomPropertyManager/ j1 _0 S4 P. L5 o3 W5 L
0 z( k4 J4 k( h. z9 l
Sub main()
" ]) c' `6 t8 u9 _3 KSet swApp = Application.SldWorks
. F n: E- y3 O9 I; o/ A; _Set swModel = swApp.ActiveDoc: h, _4 a! W" B! i3 |
Set Part = swApp.ActiveDoc
! j; A' L- W# ]1 JSet SelMgr = Part.SelectionManager
3 T/ ^9 t& R7 x! _, V( TswApp.ActiveDoc.ActiveView.FrameState = 1
. G! C% O* X7 H% P/ s* TValue = Part.GetActiveConfigurationValue("", "Material") '这无法获取成功
9 w: O, H x, G' ]: C' O'Value = Part.GetCustomInfoValue("", "Material")2 h, j$ }6 h* M
If Value = "304" Then
" \# y* G L) V0 Y Set swCustPropMgr = swModel.Extension.CustomPropertyManager(swModel.ConfigurationManager.ActiveConfiguration.Name)
4 _4 B3 y* q8 a$ W swCustPropMgr.Delete ("表面处理") ) m7 n5 n S% U0 C
swCustPropMgr.Add2 "表面处理", swCustomInfoText, "抛光"
0 y1 K! o2 y) O. m3 s7 } End If. J% D( W2 w$ J( V# N" v) j; ]; v
End Sub
& ?% }! R3 g1 d2 S8 Q. y* [8 P2 ~$ Y; N
0 n }$ p& N/ |9 M9 i5 J: ^
1 I# Z2 S% r4 U. H1 c: S |
|