应社友要求,共享SW钣金零件输出展开DWG的代码
保留折弯线:Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim FileName As String
Dim NewName As String
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
FileName = swModel.GetPathName()
NewName = Left(FileName, Len(FileName) - 7) & ".dwg"
boolstatus = swModel.ExportFlatPatternView(NewName, swExportFlatPatternOption_None)
swModelDocExt.SaveAs NewName, 0, 0, Nothing, longstatus, longwarnings
End Sub
移除折弯线:
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim FileName As String
Dim NewName As String
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
FileName = swModel.GetPathName()
NewName = Left(FileName, Len(FileName) - 7) & ".dwg"
boolstatus = swModel.ExportFlatPatternView(NewName, swExportFlatPatternOption_RemoveBends)
swModelDocExt.SaveAs NewName, 0, 0, Nothing, longstatus, longwarnings
End Sub
必须顶上去!超实用!! 没觉得sw钣金需要改动啊
sw工程图里面的平板形式不就是展开图吗?这都要写代码呀? 楼主,这是? 代码要放到哪里? 怎么用啊 新手 楼主好人做到底,说明一下怎么使用啊 本帖最后由 DaveChan 于 2016-10-24 08:54 编辑
newmorn 发表于 2016-10-23 16:56
sw工程图里面的平板形式不就是展开图吗?这都要写代码呀?
代码替代了繁琐的点击另存为过程,利用代码做成宏按钮,一键保存平板形式为dwg/dxf下面动画为另存为输出过程和宏代码输出过程
hc2003 发表于 2016-10-23 19:49
楼主好人做到底,说明一下怎么使用啊
1.新建一个宏,删除里面所有代码
2.复制我贴的代码到这个宏里面
3.保存此宏
4.打开一个钣金零件(可以展开的零件)
5.运行此宏
6.自动输出展开图(DWG)
页:
[1]