Here is something along those lines. First it gets the drawing document, then searches for a layer named "yes". If not found, it lets you know then exits the rule. If found, it moves on to the next step. It then looks for the custom iProperty. I named it "Layer Yes Is On", because I didn't know what you called it or wanted to call it. If it finds it, it updates its value (which is a Boolean in this case) with the value of whether or not that layer is turned on or not. If the property is not found, it creates it with the value mentioned above. If a boolean type value isn't what you had in mind, you can use the started line of code above to check the value of oYesLayer.Visible above that point, then create your own different type of value to give the custom iProperty.
oDDoc = ThisDrawing.Document
Dim oYesLayer As Layer
Try
oYesLayer = oDDoc.StylesManager.Layers.Item("yes") 'is it capital or not?
Catch
MsgBox("Couldn't find the Layer named 'yes'. Exiting rule.", vbCritical, "iLogic")
Exit Sub
End Try
'If oYesLayer.Visible Then 'Visible will be True when 'On'
'create or update the custom iProperty here
Dim oProp As Inventor.Property
Try
oProp = oDDoc.PropertySets.Item(4).Item("Layer Yes Is On")
oProp.Value = oYesLayer.Visible
Catch
oProp = oDDoc.PropertySets.Item(4).Add(oYesLayer.Visible, "Layer Yes Is On")
End Try
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡 or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)