'thanks for Autodesk rocky God giving me help! The code comes from the official forum of Autodesk in the United States,by Curtis_W

'获取当前的颜色方案名称 'oColorScheme = ThisApplication.ActiveColorScheme.Name

'获取当前配色方案背景类型 'oBackGroundType = ThisApplication.ColorSchemes.BackgroundType

'更改为演示文稿(白色背景) 'ThisApplication.ColorSchemes.Item('表达视图').Activate

'设置为使用一种颜色背景类型 'ThisApplication.ColorSchemes.BackgroundType =BackgroundTypeEnum.kOneColorBackgroundType Dim ooDoc=ThisDoc.Document If ooDoc.DocumentType= kPartDocumentObject Then GoTo AA Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Dim oDoc As Document Dim oRefFile As FileDescriptor

'获取第一个被引用的文档 oDoc = oAsmDoc.AllReferencedDocuments(1)

ThisApplication.Documents.Open(oDoc.FullFileName, True)
'隐藏所有草图 For Each oSketch In oDoc.ComponentDefinition​.Sketches oSketch.Visible = False Next

'隐藏所有工作平面 For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes oWorkPlane.Visible = False Next

'隐藏所有工作轴 For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes oWorkAxis.Visible = False Next

'隐藏所有工作点 For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints oWorkPoint.Visible = False Exit For Next

'设置iproperty在保存时使用ISO视图 'oDoc.SetThumbnailSaveOption _ '(ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)

'尝试保存 'Try 'oDoc.Save 'Catch '捕获错误而不做任何事情 'End Try

'关闭文件 oDoc.Close

AA:For Each oSketch In ooDoc.ComponentDefinition​.Sketches oSketch.Visible = False Next

'设置工作平面能见度 For Each oWorkPlane In ooDoc.ComponentDefinition.WorkPlanes oWorkPlane.Visible = False Next

'设定工作轴能见度 For Each oWorkAxis In ooDoc.ComponentDefinition.WorkAxes oWorkAxis.Visible = False Next

'设定工作点可见性 For Each oWorkPoint In ooDoc.ComponentDefinition.WorkPoints oWorkPoint.Visible = False Exit for Next

'设置iproperty在保存时使用ISO视图 'ooDoc.SetThumbnailSaveOption _ '(ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)

'尝试保存 'Try 'ooDoc.Save 'Catch '捕获错误而不做任何事情 'End Try

'关闭文件 'ooDoc.Close

'改回原来的方案 'ThisApplication.ColorSchemes.Item(oColorScheme).Activate

'改变回原来的背景地面类型 'ThisApplication.ColorSchemes.BackgroundType = oBackGroundType


原文地址: http://www.cveoy.top/t/topic/phdx 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录