I logic rule in sub assembly wont trigger with I properties because true false?

I logic rule in sub assembly wont trigger with I properties because true false?

t_fransman
Advocate Advocate
3,138 Views
40 Replies
Message 1 of 41

I logic rule in sub assembly wont trigger with I properties because true false?

t_fransman
Advocate
Advocate

I need an identical rule forced to run in a sub assembly when true or false is changed in the form. I have to go to the sub-assembly and run the rule it's annoying. Node is Named "BottomWeldment". Rule runs in the top level assembly but not "BottomWeldment". The rule has same name and basically does same thing, turns stuff on vis and ref or default. Just can't seem to trigger it from top level. Rule name is "Door Hand".

0 Likes
Accepted solutions (1)
3,139 Views
40 Replies
Replies (40)
Message 21 of 41

WCrihfield
Mentor
Mentor

Have you tried putting MsgBox or MessageBox messages in that rule, so that you can be absolutely sure it is/isn't running, even though it may/may not be doing what you want?  Again, looking at that last code, I'm thinking about when it is ran from the main assembly, and thinking...how does that code know which document's model browser to access (the 'active' main assembly's model browser, or that sub-assembly's model browser)?  You can only access the model browser of the visibly opened, active document by code.  I don't think you can effectively access the model browser pane of another document that isn't the currently visibly opened document.  Maybe inject a few messages in there to be sure.  I'm not even sure enclosing the sections within Try...Catch blocks, with messages in the Catch area, would show if they weren't successful.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 22 of 41

Curtis_Waguespack
Consultant
Consultant
Accepted solution

if you must run it from the subassembly, then this would work

 

oPane1 = ThisDoc.Document.BrowserPanes("Model")
oFolder = oPane1.TopNode.BrowserFolders.Item("RH-Door")
oFolderNodes = oFolder.BrowserNode.BrowserNodes

If LHDoorTrueRHDoorFalse = False

	For Each oNode As BrowserNode In oFolderNodes
		oComp = oNode.NativeObject
		oComp.Visible = True
		oComp.BOMStructure = BOMStructureEnum.kDefaultBOMStructure
		Logger.Info("Rule fired, param is false")
	Next
Else

	For Each oNode As BrowserNode In oFolderNodes
		oComp = oNode.NativeObject
		oComp.Visible = False
		oComp.BOMStructure = BOMStructureEnum.kReferenceBOMStructure
		Logger.Info("Rule fired, param is True")
	Next
End If

EESignature

0 Likes
Message 23 of 41

t_fransman
Advocate
Advocate

Yes the message box worked but the rest of rule doesn't unless i go to that assy and run it manually.

 

0 Likes
Message 24 of 41

t_fransman
Advocate
Advocate

this did not fire it either

How do I post the assembly somewhat hidden to others. Or can i email it . 

0 Likes
Message 25 of 41

WCrihfield
Mentor
Mentor

OK. So it is definitely running that rule, because it is showing the messages in side that rule, but it just isn't doing what you want when it runs.  Now I'm thinking, if you need to make this stuff happen remotely from the top level assembly, you may have to avoid using the model browser pane to access the target components within, and access them another way.

 

It is working just as I said in my last post.  When you manually open that document, so that it is the active visible document, then run the rule, it works OK, because it's model browser is currently visible.  But when ran from the main assembly, the main assembly's model browser is currently visible, so it isn't able to do what you want.  That aligns with my earlier post that you can only access the model browser pane of the visibly opened document.

 

If you get the target components another way, instead of getting it through the model browser pane, that may fix the problem.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 26 of 41

Curtis_Waguespack
Consultant
Consultant

@WCrihfield wrote:

OK. So it is definitely running that rule, because it is showing the messages in side that rule, but it just isn't doing what you want when it runs.  Now I'm thinking, if you need to make this stuff happen remotely from the top level assembly, you may have to avoid using the model browser pane to access the target components within, and access them another way.

 

It is working just as I said in my last post.  When you manually open that document, so that it is the active visible document, then run the rule, it works OK, because it's model browser is currently visible.  But when ran from the main assembly, the main assembly's model browser is currently visible, so it isn't able to do what you want.  That aligns with my earlier post that you can only access the model browser pane of the visibly opened document.

 

If you get the target components another way, instead of getting it through the model browser pane, that may fix the problem.


 

Here is an example file set of this working using the browser node with the rule in the subassembly 

 

 

EESignature

Message 27 of 41

Curtis_Waguespack
Consultant
Consultant

@t_fransman wrote:

this did not fire it either

How do I post the assembly somewhat hidden to others. Or can i email it . 


You might look at using Dropbox or something similar with a password

EESignature

0 Likes
Message 28 of 41

WCrihfield
Mentor
Mentor

Yep. Your example files with the virtual components in the sub-assembly worked as you said.  I stand corrected.  Thanks for taking the time to create these working example files.  👍  I was pretty sure I had worked though some similar scenarios in years past, but apparently there were some important differences involved in those cases, that aren't present here.  Myth busted.  Wisdom learned through personal trial and error generally stick better than knowledge learned through reading. 😉

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 29 of 41

t_fransman
Advocate
Advocate

Sorry im lost now still cant seem to get the desired result/

 

0 Likes
Message 30 of 41

t_fransman
Advocate
Advocate

when i open these examples i got blank documents need the ipt files i think. Component 1 and 2

 

0 Likes
Message 31 of 41

t_fransman
Advocate
Advocate

this is my version of the rule that i need to run when i true false change the top level assy. This is in the sub assembly Just wont run. 

 

oPane1 = ThisApplication.ActiveDocument.BrowserPanes("Model")

If LHDoorTrueRHDoorFalse = True

'True
	oFolder = oPane1.TopNode.BrowserFolders.Item("LH-Door") 
	oFolderNodes = oFolder.BrowserNode.BrowserNodes 
	For Each oNode As BrowserNode In oFolderNodes 
	oComp = oNode.NativeObject
	oComp.Visible = True
	oComp.BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	Next
Else	
'False	
	oFolder = oPane1.TopNode.BrowserFolders.Item("LH-Door")		  
	oFolderNodes = oFolder.BrowserNode.BrowserNodes 
	For Each oNode As BrowserNode In oFolderNodes 
	oComp = oNode.NativeObject
	oComp.Visible = False
	oComp.BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Next
End If

	

If LHDoorTrueRHDoorFalse = False

'True
	oFolder = oPane1.TopNode.BrowserFolders.Item("RH-Door") 
	oFolderNodes = oFolder.BrowserNode.BrowserNodes 
	For Each oNode As BrowserNode In oFolderNodes 
	oComp = oNode.NativeObject
	oComp.Visible = True
	oComp.BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	Next
Else	
'False	
	oFolder = oPane1.TopNode.BrowserFolders.Item("RH-Door")		  
	oFolderNodes = oFolder.BrowserNode.BrowserNodes 
	For Each oNode As BrowserNode In oFolderNodes 
	oComp = oNode.NativeObject
	oComp.Visible = False
	oComp.BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Next
End If

iLogicVb.UpdateWhenDone = True
0 Likes
Message 32 of 41

t_fransman
Advocate
Advocate

And i have this in the upper main assy 

 

If LHDoorTrueRHDoorFalse = True Then
	iLogicVb.RunRule("BottomWeldment","Door Hand")
End If
If LHDoorTrueRHDoorFalse = False Then
        iLogicVb.RunRule("BottomWeldment","Door Hand")
End If
iLogicVb.UpdateWhenDone = True

But it doesn't work even if i run it manually. However if I put the message box thing in there that does run. 

If i go to the sub and run the sub rule manually it works perfectly though sadly. 

0 Likes
Message 33 of 41

Curtis_Waguespack
Consultant
Consultant

@t_fransman wrote:

when i open these examples i got blank documents need the ipt files i think. Component 1 and 2

 


the assemblies have no physical geometry, but if you run the rule you will see that it sets the visibility and bom structure on the virtual components .... just watch the model browser

EESignature

Message 34 of 41

Curtis_Waguespack
Consultant
Consultant

 

 


@t_fransman wrote:

this is my version of the rule that i need to run when i true false change the top level assy. This is in the sub assembly Just wont run. 


@WCrihfield  pointed you to the problem several posts, back

 

This is the problem with your rule:

 

Curtis_W_0-1625596316096.png

 

That line is calling the top level assembly, even if the rule it is in the subassembly... see the examples I posted earlier and the replacement line I used there.

 

EESignature

Message 35 of 41

Curtis_Waguespack
Consultant
Consultant

@WCrihfield wrote:

Yep. Your example files with the virtual components in the sub-assembly worked as you said.  I stand corrected.  Thanks for taking the time to create these working example files.  👍  I was pretty sure I had worked though some similar scenarios in years past, but apparently there were some important differences involved in those cases, that aren't present here.  Myth busted.  Wisdom learned through personal trial and error generally stick better than knowledge learned through reading. 😉


no, I think you were on to the issue originally... you pointed out the issue in your earlier post about the method of calling the document... I wasn't even thinking that might be at play until you did, and then when t.fransman posted the rule code, it jumped out at me because you mentioned it...

 

so  👍  back at ya! 

EESignature

0 Likes
Message 36 of 41

t_fransman
Advocate
Advocate

ok i get that it's wrong but how do i fix it?

0 Likes
Message 37 of 41

Curtis_Waguespack
Consultant
Consultant

@t_fransman wrote:

ok i get that it's wrong but how do i fix it?


see message 22 and/or 26 of this discussion and compare that line to what you have

EESignature

0 Likes
Message 38 of 41

t_fransman
Advocate
Advocate

This does the exact same thing as my original rule did when modified as I did below . It still does NOT RUN when the form on the main is changed true to false , so i m not sure what this is for. I had to add to change what it does to the opposite folder since there are two unique floders to turn on and off. The problem is still getting it to fire when the form is changed on the main. So i'm lost

oPane1 = ThisApplication.ActiveDocument.BrowserPanes("Model")
oFolder = oPane1.TopNode.BrowserFolders.Item("LH-Door")
oFolderNodes = oFolder.BrowserNode.BrowserNodes

If LHDoorTrueRHDoorFalse = True

	For Each oNode As BrowserNode In oFolderNodes
		oComp = oNode.NativeObject
		oComp.Visible = True
		oComp.BOMStructure = BOMStructureEnum.kDefaultBOMStructure
		Logger.Info("Rule fired, param is false")
	Next
Else

	For Each oNode As BrowserNode In oFolderNodes
		oComp = oNode.NativeObject
		oComp.Visible = False
		oComp.BOMStructure = BOMStructureEnum.kReferenceBOMStructure
		Logger.Info("Rule fired, param is True")
	Next
End If

oPane1 = ThisApplication.ActiveDocument.BrowserPanes("Model")
oFolder = oPane1.TopNode.BrowserFolders.Item("RH-Door")
oFolderNodes = oFolder.BrowserNode.BrowserNodes

	

If LHDoorTrueRHDoorFalse = False

	For Each oNode As BrowserNode In oFolderNodes
		oComp = oNode.NativeObject
		oComp.Visible = True
		oComp.BOMStructure = BOMStructureEnum.kReferenceBOMStructure
		Logger.Info("Rule fired, param is false")
	Next
Else

	For Each oNode As BrowserNode In oFolderNodes
		oComp = oNode.NativeObject
		oComp.Visible = False
		oComp.BOMStructure = BOMStructureEnum.kDefaultBOMStructure
		Logger.Info("Rule fired, param is True")
	Next
End If

iLogicVb.UpdateWhenDone = True






 

0 Likes
Message 39 of 41

t_fransman
Advocate
Advocate

Never mind i missed this 

oPane1 = ThisDoc.Document.BrowserPanes("Model")

Thank you so much .  

Message 40 of 41

Curtis_Waguespack
Consultant
Consultant

 

 

 

 

EESignature