Trying to detect if the All Workfeatures button is checked or not.

Trying to detect if the All Workfeatures button is checked or not.

jsemansDCRCS
Explorer Explorer
127 Views
2 Replies
Message 1 of 3

Trying to detect if the All Workfeatures button is checked or not.

jsemansDCRCS
Explorer
Explorer

I am working on an iLogic rule that will automatically click the View > Object Visibility > All  Workfeatures button. It will run whenever a document is opened (using event triggers) as long as the document is a part or assembly. I have it to where it will activate the button, but it just currently keeps tuning workfeatures on or off depending on the current state of the button when a file is opened. What I would like it to do is detect if the check mark is not to the button or not and if so run the rule. If the check mark is not there then all workfeatures are already off and there is no need to run the rule. Below is what I already have. Thanks for any and all help!

Sub Main()
	
	Dim invApp As Inventor.Application = ThisApplication
	Dim oControlDefs As ControlDefinitions
	Dim oControlDef As ControlDefinition
	oControlDefs = invApp.CommandManager.ControlDefinitions
	
	For Each oControlDef In oControlDefs
		
		If oControlDef.DisplayName = "All Workfeatures" Then
			'MessageBox.Show("Found it")
			oControlDef.Execute
		end if
		
	Next
	
End Sub

 

0 Likes
Accepted solutions (1)
128 Views
2 Replies
Replies (2)
Message 2 of 3

ryan.rittenhouse
Advocate
Advocate
Accepted solution

The Object Visibility settings are accessed through the Document object, so it will be per document you open. Here's how you check it:

Dim doc As Document = ThisDoc.Document
If doc.ObjectVisibility.AllWorkFeatures Then
	MessageBox.Show("Work Features Are Visible")
End If
If this solved your problem, or answered your question, please click Accept Solution.
Message 3 of 3

jsemansDCRCS
Explorer
Explorer

That did it! Thank you!

0 Likes