Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

OK. That's fine. Generally, unless the assembly is in 'Express Mode' all components within the assembly are at least 'initiated', if not fully open (in the background, not visibly). So you usually don't have to open or close any of those documents that are being represented by the components. But I can understand not wanting the other document visibly activated, especially when the code leaves them that way when its done. It can be annoying and might possibly interfere with other operations.

 

Sure, we can look into changing that other rule as needed for this situation.  I created something for you to try.  I left several lines of comments in this code for you, just as additional information that may be useful to you.  When dealing with parameters, there is a tricky & extremely annoying situation to be aware of, involving the 'units' of any numerical values (other than unit-less).  There are several ways of accessing and dealing with parameters, and some return different results than others.  When using either the unquoted name of a 'local' parameter in a 'local' rule, and when using the iLogic snippet 'Parameters("parameter_name")', these will both return the true 'document units' value of the parameter directly.  But when using either the iLogic snippet 'Parameter.Param("parameter_name").Value', or the normal API way 'Document.ComponentDefinition.Parameters.Item("parameter_name").Value' to get the parameter's value, it will return the 'database units' version of its Value, instead of the 'document units' version of it.  I generally prefer to use the API route, then convert the units back as needed, instead of using the iLogic snippets for this task, because it's more reliable, clearer, & better documented.  But I would need to know what type of units were being used ahead of time, to convert the units properly within the code.

 

Here is the new version of that local rule that you can try:

 

'just using a dummy variable here,
'to preserve automation/triggering behavior of unquoted local parameter
oDV = ManwayType

'get the 'local' part document object (the document this rule is saved within)
Dim oPDoc As PartDocument = ThisDoc.Document
oPDef = oPDoc.ComponentDefinition

'if the parameter is numerical, and not unit-less,
'this will return 'database units' version of the parameter's Value,
'not the 'document units' version of it
'oManwayType = oPDef.Parameters.Item("ManwayType").Value

oDocName = ThisDoc.FileName(True)

'these two will get the 'document units' version of the parameter's Value
'oManwayType = ManwayType 'unquoted parameter name
oManwayType = Parameter(oDocName, "ManwayType")

oFeats = oPDef.Features

If oManwayType = 600 Then
	oFeats.Item("MWAY600 Centre").Suppressed = False
	oFeats.Item("MWAY600 Holes").Suppressed = False
	oFeats.Item("MWAY600 PCD").Suppressed = False
	oFeats.Item("MWAY800 Centre").Suppressed = True
	oFeats.Item("MWAY800 Holes").Suppressed = True
	oFeats.Item("MWAY800 PCD").Suppressed = True
	oFeats.Item("MWAY900 Centre").Suppressed = True
	oFeats.Item("MWAY900 Holes").Suppressed = True
	oFeats.Item("MWAY800 PCD").Suppressed = True
ElseIf oManwayType = 800 Then
	oFeats.Item("MWAY800 Centre").Suppressed = False
	oFeats.Item("MWAY800 Holes").Suppressed = False
	oFeats.Item("MWAY800 PCD").Suppressed = False
	oFeats.Item("MWAY600 Centre").Suppressed = True
	oFeats.Item("MWAY600 Holes").Suppressed = True
	oFeats.Item("MWAY600 PCD").Suppressed = True
	oFeats.Item("MWAY900 Centre").Suppressed = True
	oFeats.Item("MWAY900 Holes").Suppressed = True
	oFeats.Item("MWAY900 PCD").Suppressed = True
ElseIf oManwayType = 900 Then
	oFeats.Item("MWAY900 Centre").Suppressed = False
	oFeats.Item("MWAY900 Holes").Suppressed = False
	oFeats.Item("MWAY900 PCD").Suppressed = False
	oFeats.Item("MWAY800 Centre").Suppressed = True
	oFeats.Item("MWAY800 Holes").Suppressed = True
	oFeats.Item("MWAY800 PCD").Suppressed = True
	oFeats.Item("MWAY600 Centre").Suppressed = True
	oFeats.Item("MWAY600 Holes").Suppressed = True
	oFeats.Item("MWAY600 PCD").Suppressed = True
End If

oPDoc.Update

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)