我的台式电脑上的设置全是……黑暗。并不是说我是哥特人什么的,但它很赏心悦目。但是,每当我在 Inventor 中保存图片时,我都必须将背景设置更改为白色。然后在完成图像导出后将其更改回暗模式。
我曾经有一个 VBA 代码可以在背景设置为白色时轻松保存图片。全部只需一个按钮。有人能帮我吗?我知道代码并不难。
代码应按如下方式工作:
谢谢!
在线搜索 VBA 代码。在我自己的文件夹中搜索我曾经使用过的代码。
您可以轻松导出具有透明或明确白色背景的活动视图,而无需修改应用程序设置
Sub ExportActiveView()
Dim v As View
Set v = ThisApplication.ActiveView
Dim width, height As Integer
width = 300
height = 300
'Export with transparent background
Dim options As NameValueMap
Set options = ThisApplication.TransientObjects.CreateNameValueMap
options.value("TransparentBackground") = True
Call v.SaveAsBitmapWithOptions("C:\Temp\img.png", width, height, options)
'Export with white bacground
Dim white As Color
Set white = ThisApplication.TransientObjects.CreateColor(255, 255, 255)
Call v.Camera.SaveAsBitmap("C:\Temp\img.jpg", width, height, white)
End Sub