社区
Inventor 产品技术应用讨论区
欢迎访问欧特克Inventor论坛!分享知识,发帖提问,浏览Inventor热帖
取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

一键切换背景颜色ilogic

8 条回复8
已解决
回复
1 条消息(共 9 条)
xingyu_wangZVD5A
254 次查看, 8 条回复

一键切换背景颜色ilogic

有没有规则可以在模型中一键切换背景颜色,比如纯白色(便于截图给客户展示),纯黑色、和默认颜色。

8 条回复8
2 条消息(共 9 条)

doc = ThisDoc.Document
Dim odocCompDef As ComponentDefinition = doc.ComponentDefinition
Dim oUParams As UserParameters =odocCompDef.Parameters.UserParameters
Dim oUParam As UserParameter
Try
 oUParam = oUParams.Item("flag")
 flag =Not flag
Catch
	oUParam = oUParams.AddByValue("flag", False, "BOOLEAN")
End Try
If flag = False Then
	ThisApplication.ActiveColorScheme.ImageFullFileName = "Light Gray Theme.png"
Else If flag = True  Then
	ThisApplication.ActiveColorScheme.ImageFullFileName = "Dark Blue Theme.png"
End If


If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!


王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili


AGN L    EESignature

3 条消息(共 9 条)

王老师,你好,感谢您的代码,我把light Gray改成了系统的Light Blue,下面那个Dark Blue 改成我自己另一张纯白的底图,测试后可以运行,规则运行一次可以改为白色,再运行可以改为蓝色,但是再次运行就无法更改了。

4 条消息(共 9 条)

doc = ThisDoc.Document
Dim odocCompDef As ComponentDefinition = doc.ComponentDefinition
Dim oUParams As UserParameters =odocCompDef.Parameters.UserParameters
Dim oUParam As UserParameter
Try
 oUParam = oUParams.Item("flag")
Catch
	oUParam = oUParams.AddByValue("flag", False, "BOOLEAN")
End Try
If flag = False Then
	ThisApplication.ActiveColorScheme.ImageFullFileName = "Light Gray Theme.png"
	flag = True 
Else If flag = True  Then
	ThisApplication.ActiveColorScheme.ImageFullFileName = "Dark Blue Theme.png"
	flag = False 
End If


If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!


王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili


AGN L    EESignature

5 条消息(共 9 条)

貌似不行额,王老师

6 条消息(共 9 条)

软件什么版本?


If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!


王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili


AGN L    EESignature

7 条消息(共 9 条)

我的是2023,或者可以直接用2个外部规则来切换,一个为默认颜色,一个为其他的颜色。

8 条消息(共 9 条)

或者你试试这个

If ThisApplication.ActiveColorScheme.ImageFullFileName = "Light Gray Theme.png" Then
	ThisApplication.ActiveColorScheme.ImageFullFileName = "Dark Blue Theme.png"
ElseIf ThisApplication.ActiveColorScheme.ImageFullFileName = "Dark Blue Theme.png" Then
	ThisApplication.ActiveColorScheme.ImageFullFileName = "Light Gray Theme.png"
End If


If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!


王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili


AGN L    EESignature

9 条消息(共 9 条)

 


If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!


王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili


AGN L    EESignature

找不到想要的内容?向社区提问或分享您的知识。

到论坛发帖  

”