人妻暴雨中被强制侵犯在线,亚洲国产欧美日韩精品一区二区三区,四虎影免看黄,国产无人区二卡三卡四卡不见星空

 找回密碼
 注冊(cè)會(huì)員

QQ登錄

只需一步,快速開始

搜索

SW宏命令的運(yùn)用,你們都是怎么進(jìn)行重命名的?

[復(fù)制鏈接]
21#
發(fā)表于 2022-6-4 11:57:32 | 只看該作者
我用的是自己寫的宏,一個(gè)在sw里用,可以單個(gè)文件改名。另一個(gè)宏是配合excel用,可以批量改名。
22#
發(fā)表于 2022-6-4 22:01:57 | 只看該作者
笑對(duì)人生123 發(fā)表于 2021-9-13 23:33
以前用這個(gè)宏超級(jí)快,可以節(jié)約很多時(shí)間

大神,能分享一下這個(gè)宏嗎。。。感謝!~!
23#
發(fā)表于 2022-9-12 14:42:17 | 只看該作者
咋用宏命令改名后工程圖還能鏈接上?
24#
發(fā)表于 2022-9-12 17:14:42 | 只看該作者
凱元可以
25#
發(fā)表于 2023-1-19 15:02:49 | 只看該作者
醉生夢(mèng) 發(fā)表于 2021-9-13 15:18
這個(gè)是在“常跓宏”的基礎(chǔ)上改的,有改名動(dòng)作時(shí),檢測(cè)文件同文件夾下是否有同名的工種圖文件,如果有,更改 ...

您好,請(qǐng)問(wèn)能分享一下您這個(gè)宏嗎?謝謝
26#
發(fā)表于 2023-6-12 16:31:38 | 只看該作者
醉生夢(mèng) 發(fā)表于 2021-9-13 15:18
這個(gè)是在“常跓宏”的基礎(chǔ)上改的,有改名動(dòng)作時(shí),檢測(cè)文件同文件夾下是否有同名的工種圖文件,如果有,更改 ...

能分享一下嗎?
27#
發(fā)表于 2023-7-27 08:02:52 | 只看該作者
醉生夢(mèng) 發(fā)表于 2021-9-13 15:18
這個(gè)是在“常跓宏”的基礎(chǔ)上改的,有改名動(dòng)作時(shí),檢測(cè)文件同文件夾下是否有同名的工種圖文件,如果有,更改 ...

求分享?。?!
28#
發(fā)表于 2023-7-27 11:45:56 | 只看該作者
我想分享一下,但是上傳不了怎么辦.....
29#
發(fā)表于 2023-8-10 16:09:31 | 只看該作者
宏文件
30#
發(fā)表于 2023-8-10 16:20:47 | 只看該作者
Dim swApp As Object
Dim swAssy As SldWorks.AssemblyDoc
Dim swAssyEvents As Class1
Dim swprt As SldWorks.PartDoc
Dim swprtEvents As Class2

Sub main()
    Set swApp = Application.SldWorks
    Set prt = swApp.GetFirstDocument
   If Not prt Is Nothing Then
   Set prt = swApp.ActiveDoc
    If prt.GetType = 2 Then
   Set swAssy = prt
    Set swAssyEvents = New Class1
    Set swAssyEvents.swAssy = swApp.ActiveDoc
    ElseIf prt.GetType = 1 Then
     Set swprt = prt
     Set swprtEvents = New Class2
     Set swprtEvents.swprt = swApp.ActiveDoc
         End If
   End If
End Sub


//////////////////////////////////
Class1
//////////////////////////////////
Public WithEvents swAssy As SldWorks.AssemblyDoc

Public Function swAssy_RenameItemNotify(ByVal entType As Long, ByVal oldName As String, ByVal NewName As String) As Long
   Set swApp = Application.SldWorks
   Set Part = swApp.ActiveDoc
  If InStrRev(oldName, "\") <> 0 Then
  Path = Left(oldName, InStrRev(oldName, "\"))
  nfi = Left(NewName, InStrRev(NewName, ".") - 1)
   tmpfi = Dir(Path & "*.SLDDRW")
   Do Until tmpfi = ""
    vDepend = swApp.GetDocumentDependencies(Path & tmpfi, False, False)
    If Mid(vDepend(1), InStrRev(vDepend(1), "\") + 1) = Right(oldName, Len(oldName) - InStrRev(oldName, "\")) Then
     Name Path & tmpfi As nfi & ".SLDDRW"
    bl = swApp.ReplaceReferencedDocument(nfi & ".SLDDRW", vDepend(1), NewName)
     Exit Do
    End If
   tmpfi = Dir
   Loop
    Part.Save
Else
  Set swSelMgr = Part.SelectionManager
   Set swComp = swSelMgr.GetSelectedObject(1)
   mip = swComp.GetPathName
   oldn = Left(oldName, InStrRev(oldName, "-") - 1)
Path = Left(mip, InStrRev(mip, "\"))
ntype = Mid(mip, InStrRev(mip, "."))
    If mip <> "" Then
  tmpfi = Dir(Path & "*.SLDDRW")
  Do Until tmpfi = ""
    vDepend = swApp.GetDocumentDependencies(Path & tmpfi, False, False)
    If Mid(vDepend(1), InStrRev(vDepend(1), "\") + 1) = (oldn & ntype) Then
     Name Path & tmpfi As Left(mip, InStrRev(mip, ".") - 1) & ".SLDDRW"
    bln = swApp.ReplaceReferencedDocument(Left(mip, InStrRev(mip, ".") - 1) & ".SLDDRW", vDepend(1), mip)
     Exit Do
    End If
    tmpfi = Dir
   Loop
   End If
End If
Set Part = Nothing
End Function

//////////////////////////////////
Class2
//////////////////////////////////
Public WithEvents swprt As SldWorks.PartDoc

Public Function swprt_RenameItemNotify(ByVal entType As Long, ByVal oldName As String, ByVal NewName As String) As Long

   Set swApp = Application.SldWorks
   Set Part = swApp.ActiveDoc
  Path = Left(oldName, InStrRev(oldName, "\"))
  nfi = Left(NewName, InStrRev(NewName, ".") - 1)
   tmpfi = Dir(Path & "*.SLDDRW")
   Do Until tmpfi = ""
    vDepend = swApp.GetDocumentDependencies(Path & tmpfi, False, False)
    If Mid(vDepend(1), InStrRev(vDepend(1), "\") + 1) = Right(oldName, Len(oldName) - InStrRev(oldName, "\")) Then
     Name Path & tmpfi As nfi & ".SLDDRW"
    bl = swApp.ReplaceReferencedDocument(nfi & ".SLDDRW", vDepend(1), NewName)
     Exit Do
    End If
   tmpfi = Dir
   Loop
    Part.Save
End Function


本版積分規(guī)則

Archiver|手機(jī)版|小黑屋|機(jī)械社區(qū) ( 京ICP備10217105號(hào)-1,京ICP證050210號(hào),浙公網(wǎng)安備33038202004372號(hào) )

GMT+8, 2025-7-22 00:01 , Processed in 0.079916 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

快速回復(fù) 返回頂部 返回列表