SolidWorks机械工程师网——最大的SolidWorks学习平台
标题:
依據配置特定屬性之"件號"及"名稱"存檔
[打印本页]
作者:
zhito
时间:
2018-11-15 12:32
标题:
依據配置特定屬性之"件號"及"名稱"存檔
分享在他網的回覆
保存到相册
' ************************************************************************************
' 依據配置特定屬性之"件號"及"名稱"存檔 - macro recorded on 10/30/18 by scliang
' ************************************************************************************
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swConfigMgr As SldWorks.ConfigurationManager
Dim swConfig As SldWorks.Configuration
Dim swCustPropMgr As SldWorks.CustomPropertyManager
Dim nNbrProps As Long
Dim Part As Object
Dim Code_Name(2) As String
Dim valOut As String
Dim resolvedValOut As String
Dim longstatus As Long
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swConfigMgr = swModel.ConfigurationManager
Set swConfig = swConfigMgr.ActiveConfiguration
Set swCustPropMgr = swConfig.CustomPropertyManager
' Get the number of custom properties for this configuration
nNbrProps = swCustPropMgr.Count
vPropNames = swCustPropMgr.GetNames
For j = 0 To nNbrProps - 1
swCustPropMgr.Get2 vPropNames(j), valOut, resolvedValOut
If vPropNames(j) = "代號" Then Code_Name(0) = valOut
If vPropNames(j) = "名稱" Then Code_Name(1) = valOut
Next j
'Debug.Print " Name, type, and resolved value of custom property: " & "代號: " & Code_Name(0) & " ----- " & "名稱:" & Code_Name(1)
Path_Name = swApp.ActiveDoc.GetPathName '取得"路徑名稱及擴展名",不管擴展名是否隱藏
Path_ = Left(Path_Name, InStrRev(Path_Name, "")) '提出路徑
Set Part = swApp.ActiveDoc
longstatus = Part.SaveAs3(Path_ & Code_Name(0) & " " & Code_Name(1) & ".SLDPRT", 0, 2) '依據配置屬性"件號"及"名稱"存檔
End Sub
复制代码
作者:
xy4671235
时间:
2018-11-15 13:35
图号分离?
作者:
rvuxk
时间:
2018-11-15 13:36
非也!如主題名稱.
作者:
Hardware
时间:
2018-11-15 13:49
这个动态图楼主用什么软件截取的,求教一下!!
作者:
c13609425996
时间:
2018-11-15 13:55
Camtasia Studio 8.0
软件截取的
作者:
louyi9
时间:
2019-1-31 18:36
这个挺实用的,谢谢分享
作者:
淡淡的雲
时间:
2020-8-3 13:43
下载下来看看,应该会有用!
作者:
shihua010
时间:
2021-4-19 13:32
顶一下,坐等高手!
作者:
twolfs
时间:
2021-4-25 14:07
谢谢分享~正要这个宏
作者:
wscgb123
时间:
2022-7-2 16:33
楼主辛苦了!
欢迎光临 SolidWorks机械工程师网——最大的SolidWorks学习平台 (https://www.swbbsc.com/)
Powered by Discuz! X3.2