Revision breaks ilogic rules

Revision breaks ilogic rules

Anonymous
Not applicable
589 Views
6 Replies
Message 1 of 7

Revision breaks ilogic rules

Anonymous
Not applicable

Hi all,

 

I wrote a ilogic rule to make some parts invisible depending on a parameter:

Component.Visible("B0113562/- - cover sheet :3") = (Length_Section_1 = 750 And Width_Section_1 = 750)

When i do a revision on this part, i have to do also a "revision" on the rule. The rule should be then:

Component.Visible("B0113562/1 - cover sheet :3") = (Length_Section_1 = 750 And Width_Section_1 = 750)

 I don't want to overhaul the code by hand after a revision.

 

Does anyone have a good solution for this?

 

Thanks in advance!

 

AV

 

0 Likes
590 Views
6 Replies
Replies (6)
Message 2 of 7

dutt.thakar
Collaborator
Collaborator

@Anonymous 

 

In your model browser change the component name 

"B0113562/- - cover sheet :3"

 to something else (meaning that remove ":1", ":2" or ":3" etc.)  like "B0113562/- - cover sheet". You need to do this operation manually.

 

Once you do this you can make your rule like this.

Component.Visible("B0113562/- - cover sheet") = (Length_Section_1 = 750 And Width_Section_1 = 750)

 

This way, even after doing the revision/ or changing the name of your file, the rule will not break.

 

Hope this will help.

 

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes
Message 3 of 7

Anonymous
Not applicable

@dutt.thakar 

 

I can change the name in de modelbrowser manually. I know that's a solution for ilogic.

But i don't want that because the current name gives us many important infomation.

I can't remove only the :1, :2 etc. because i have many of this parts in assembly and don't want to make them all invisible.

 

Another problem is that when i save the assembly, inventor automatically update the model browser names to original.

The override will lost.

 

regards,

AV

0 Likes
Message 4 of 7

WCrihfield
Mentor
Mentor

You may need to get the right component another way (besides by its name) first, in earlier code, then use its variable (for example "oComp") to specify its name (oComp.Name) in that line of code.  Is there something else unique about that specific component that can be checked, to find/identify it?  I know components can have attributes attached to them, if nothing else comes to mind.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 7

dutt.thakar
Collaborator
Collaborator

@Anonymous 

 

If you do not go with changing browser node names, then, you need to find something that is unique in the name of all the components you see in the browser, as an example for "B0113562" is something that will always stay the same in the name, then you can try to find the components that have this text and then us the Occurrence.Name method in iLogic rule, like below.

 

Here we are assuming that you will never change "B0113562" even if you revise the file names

 

Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oOcc As ComponentOccurrence

For Each oOcc In oDef.Occurrences 
	If oOcc.Name.Contains("B0113562") Then
		Component.Visible(oOcc.Name) = (Length_Section_1 = 750 And Width_Section_1 = 750)
	End If
Next

 

See if this is helpful.

 

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes
Message 6 of 7

Anonymous
Not applicable

@dutt.thakar 

 

Thanks for your suggestion!

 

"B0113562" is something in the name that never will change.

But the problem is that i have multiple identical components. For example named B0113561:1, B0113561:2, etc

 

I don't want to make them al invisible when: 

Length_Section_1 = 750 And Width_Section_1 = 750  

 

I hope someone has a suggestion for this problem.

 

Regards,

a.verdoes

0 Likes
Message 7 of 7

dutt.thakar
Collaborator
Collaborator

@Anonymous 

 

If you always want to hide/unhide the first one or the one that has ":1" then just add an extra check in for loop, like below.

 

Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oOcc As ComponentOccurrence

For Each oOcc In oDef.Occurrences 
	If oOcc.Name.Contains("B0113562") And oOcc.Name.Contains(":1") Then
		Component.Visible(oOcc.Name) = (Length_Section_1 = 750 And Width_Section_1 = 750)
	End If
Next
If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes