'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 oDoc As Document Dim oRefFile As FileDescriptor

If ThisDoc.DocumentType = kPartDocumentObject Then Set oDoc = ThisDoc.Document Else Set oDoc = ThisApplication.ActiveDocument End If

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 Next

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

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

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

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


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

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