贰大爷 发表于 2020-6-2 13:40:11

求sw的零件属性以及工程图等模板制作教程

有哪位大哥有制作sw模板的教程?本人网上找了很多现在资料做起来好乱,就是实现不了。请各位前辈多多指教。可以的话能帮忙发我邮箱么?感谢。邮箱是:eryewjr@qq.com    在此多谢了。

叶落満空山 发表于 2020-6-2 15:02:54

http://www.cmiw.cn/forum.php?mod=viewthread&tid=773294&highlight=%CE%D2%D7%D4%BC%BA%B5%C4

贰大爷 发表于 2020-6-2 15:25:26

多谢了   我去看下。

点点人生123 发表于 2020-6-2 15:27:38

这个很简单的,自己用点心爱奇艺上完全可以找到视频,我就是上面找的视频

贰大爷 发表于 2020-6-2 15:52:09

点点人生123 发表于 2020-6-2 15:27
这个很简单的,自己用点心爱奇艺上完全可以找到视频,我就是上面找的视频

我就是找了很多了现在好乱啊有几个问题比如名称和图号怎么分开,网上说用宏   我按照网上设置了也还是不行,找了很多都是这一块那一块的    没有连续性的。所以现在还是不行。

贰大爷 发表于 2020-6-2 15:52:52

叶落満空山 发表于 2020-6-2 15:02
http://www.cmiw.cn/forum.php?mod=viewthread&tid=773294&highlight=%CE%D2%D7%D4%BC%BA%B5%C4

谢谢了   我还是像楼下说的去找下视频看下。

未来第一站 发表于 2020-6-2 22:04:49

找本教材看看。

贰大爷 发表于 2020-6-3 08:33:27

未来第一站 发表于 2020-6-2 22:04
找本教材看看。

好的   :handshake

叶落満空山 发表于 2020-6-3 11:04:38

图号分离宏(到自定义属性),原则就是前面是数字中间是空格后面是名字例如:szkm20018-01-101 底板

'????solidwork
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
Dim a As Integer
Dim b As String
Dim m As String
Dim e As String
Dim k As String
Dim t As String
Dim c As String
Dim j As Integer
Dim strmat As String
Dim tempvalue As String
Sub main()
'link solidworks
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
'?趨????
c = swApp.ActiveDoc.GetTitle() '?????
strmat = Chr(34) + Trim("SW-Material" + "@") + c + Chr(34)
blnretval = Part.DeleteCustomInfo2("", "????")
blnretval = Part.DeleteCustomInfo2("", "????")
blnretval = Part.DeleteCustomInfo2("", "????")
a = InStr(c, " ") - 1      '????????????????????????
If a > 0 Then
    k = Left(c, a)
    t = Left(LTrim(e), 3)
    If t = "GBT" Then
      e = "GB/T" + Mid(k, 4)
    Else
      e = k
    End If
    b = Mid(c, a + 2)
    t = Right(c, 7)
    If t = ".SLDPRT" Or t = ".SLDASM" Then
      j = Len(b) - 7
    Else
      j = Len(b)
    End If
    m = Left(b, j)
End If
End Sub


叶落満空山 发表于 2020-6-3 11:06:17

图号分离(分离到配置特定里),原则同上。

'????sw

Dim a As Integer
Dim b As String
Dim m As String
Dim e As String
Dim k As String
Dim t As String
Dim c As String
Dim j As Integer
Dim strmat As String
Dim tempvalue As String
Dim Part As Object
Dim swApp As SldWorks.SldWorks
Dim swModelDoc As SldWorks.ModelDoc2
Dim swConfig As SldWorks.Configuration
Dim CustPropMgr As SldWorks.CustomPropertyManager
Dim swModel As SldWorks.ModelDoc2

Sub main()
Set swApp = Application.SldWorks
Set swModelDoc = swApp.ActiveDoc
Set swConfig = swModelDoc.ConfigurationManager.ActiveConfiguration
Set swModel = swApp.ActiveDoc
Set CustPropMgr = swModel.Extension.CustomPropertyManager(swModel.ConfigurationManager.ActiveConfiguration.Name) '???????????

'?趨????
c = swApp.ActiveDoc.GetTitle() '?????
strmat = Chr(34) + Trim("SW-Material" + "@") + c + Chr(34)
a = InStr(c, " ") - 1 '??????????????????????????????????????
If a > 0 Then
k = Left(c, a)
t = Left(LTrim(e), 3)
If t = "GBT" Then
e = "GB/T" + Mid(k, 4)
Else
e = k
End If
b = Mid(c, a + 2)
t = Right(c, 7)
If t = ".SLDPRT" Or t = ".SLDASM" Or t = ".sldprt" Or t = ".sldasm" Then
j = Len(b) - 7'??????????????Сд??????4???
Else
j = Len(b)
End If
m = Left(b, j)
End If
'?????
CustPropMgr.Delete ("Number")
CustPropMgr.Delete ("????")
CustPropMgr.Delete ("????")
CustPropMgr.Delete ("???????")
CustPropMgr.Delete ("?????")
CustPropMgr.Delete ("???")
CustPropMgr.Delete ("???????")
CustPropMgr.Delete ("???????-")
CustPropMgr.Delete ("Material-")

'????
CustPropMgr.Add2 "Number", swCustomInfoText, e
CustPropMgr.Add2 "????", swCustomInfoText, "????qq420221716"
CustPropMgr.Add2 "???????", swCustomInfoText, m
End Sub

页: [1] 2
查看完整版本: 求sw的零件属性以及工程图等模板制作教程