Component.Isavtive vs Feature.Isactive

Component.Isavtive vs Feature.Isactive

Anonymous
Not applicable
1,427 Views
10 Replies
Message 1 of 11

Component.Isavtive vs Feature.Isactive

Anonymous
Not applicable

Hello, 

 

I am struggling with the terms "Component.Isactive" and "Feature.Isactive". If I have an assembly (* .iam) with a Pattern in it, is this a "Component" or a "Feature"? And how is this if this is in a part (* .ipt)? Hopefully someone has an explanation for this so that I understand where I make mistakes.

 

Thank you, Joop

0 Likes
Accepted solutions (2)
1,428 Views
10 Replies
Replies (10)
Message 2 of 11

bhavik4244
Collaborator
Collaborator

@Anonymous 

 

If you're trying to control features in the part file (.ipt) or in assembly (.iam) then you should go for, (whether it's a pattern or features, it'll work for both)

 

'To unsuppress the feature
Feature
.IsActive("NameOfthefeature") = True
'To suppress the feature
Feature.IsActive("NameOfthefeature") = False

 If you're trying to control components state in the assembly file (.iam) then you should go for, (whether it's a pattern or parts, it'll work for both)

 

'to suppress the component
component
.IsActive("nameOftheOccurance") = False
'to unsuppress the component
component.IsActive("nameOftheOccurance") = True

 


Bhavik Suthar
0 Likes
Message 3 of 11

dutt.thakar
Collaborator
Collaborator

@Anonymous 

 

Whenever you are inside and part file(.ipt), the only thing you can use is Feature.IsActive. The reason is that inside an ipt file, whatever you are creating is using features (e.g Extrude, Revolve, Hole, Fillet, etc.) No Component.IsActive is applicable when you are inside an ipt file.

 

For Assembly files (iam), You can also create features (Extrude, Revolve, Hole, etc.) inside it and then use part files(ipt) to place and constraint it. Now when you are targetting features, you need to use Feature.IsActive in assembly, but when you are targetting components (ipt or iam files), you need to use Component.IsActive.

 

Now In the case of patterns inside the assembly, please note that if you are creating a pattern of Features (e.g. Extrude, Revolve, Hole, etc.) you need to use Features.IsActive to either suppress or unsuppress. On the other hand, if you are creating a pattern of Components (ipt or iam files), you need to use Component.IsActive.

 

I hope this has cleared the confusion.

 

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 4 of 11

Anonymous
Not applicable

Thank you for the explanation.
But how can I turn on and off a retagular pattern in an assembly (* .iam)? I have created a user parameter for number and a user parameter for distance. But now I have problems with controlling this, because I thought I had written a good code anyway

0 Likes
Message 5 of 11

bhavik4244
Collaborator
Collaborator

@Anonymous 

 

Can you post your code here? it would give more insight where could be the issue


Bhavik Suthar
0 Likes
Message 6 of 11

Anonymous
Not applicable

i


Select Case DraairichtingPoort

Case "DIN Links"
'Suppressen onderdelen aanslag Din Rechts
Component.IsActive("1043_977:2") = False
Component.IsActive("1013_456:2") = False
Component.IsActive("ComponentPatternDinRechts") = False
Component.IsActive("1013_453:2") = False

'UNSuppressen onderdelen aanslag Din Links
Component.IsActive("1043_977_22") = True
Component.IsActive("1013_456_23") = True
Component.IsActive("ComponentPatternDinLinks") = True
Component.IsActive("1013_453_26") = True

PlaatOfPlankDikte = PlankOfPlaatVoorkant


Case "DIN Rechts"
'Suppressen onderdelen aanslag Din Links
Component.IsActive("1043_977_22") = False
Component.IsActive("1013_456_23") = False
Component.IsActive("ComponentPatternDinLinks") = False
Component.IsActive("1013_453_26") = False

'UNSuppressen onderdelen aanslag Din Rechts
Component.IsActive("1043_977:2") = True
Component.IsActive("1013_456:2") = True
Component.IsActive("ComponentPatternDinRechts") = True
Component.IsActive("1013_453:2") = True

PlaatOfPlankDikte = PlankOfPlaatAchterkant

'Updaten rule
Parameter.UpdateAfterChange = True
RuleParametersOutput()
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True

End Select


Select Case Slotkeuze

Case Fortylock
AantalBlokkenSlot = 0 ul

Case Fiftylock
AantalBlokkenSlot = 1 ul

Case Sixtylock
AantalBlokkenSlot = 2 ul

Parameter.UpdateAfterChange = True
RuleParametersOutput()
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True

End Select

 

 


'Array Din Links
ArrayBlokkenDinLinks = (AantalBlokkenSlot + ArrayBlokkenPlaat)

'Array Din Rechts
ArrayBlokkenDinRechts = (AantalBlokkenSlot + ArrayBlokkenPlaat)

'Bepalen som van aantal affstandsblokken bij Din Rechts
If ArrayBlokkenDinRechts = 0 Then
Component.IsActive("ComponentPatternDinRechts") = False
Component.IsActive("1013_453:2") = False
AfstandAanslagDinRechts = 0

Else
Component.IsActive("ComponentPatternDinRechts") = True
Component.IsActive("1013_453:2") = True
AfstandAanslagDinRechts = (ArrayBlokkenDinRechts* DikteAfstandblok)

RuleParametersOutput()
InventorVb.DocumentUpdate()
iLogicVb.DocumentUpdate

End If

'Bepalen som van aantal affstandsblokken bij Din Links
If ArrayBlokkenDinLinks = 0 Then
Component.IsActive("ComponentPatternDinLinks") = False
Component.IsActive("1013_453_26") = False
AfstandAanslagDinLinks = 0

Else
Component.IsActive("ComponentPatternDinLinks") = True
Component.IsActive("1013_453_26") = True
AfstandAanslagDinLinks = (ArrayBlokkenDinLinks * DikteAfstandblok)

RuleParametersOutput()
InventorVb.DocumentUpdate()
iLogicVb.DocumentUpdate


End If

'Bepaling benodigde afstandsblokken ivm plank of plaat
''' Bepaling van de benodigd aantal opvulblokken in verband met plaat of planken op de poortvleugel
''' Deze code is UNIVERSEEL, de draairichting bepaald welke parameter wordt toegepast
''' DIN Links dan wordt PlaatOfPlankDikteVoorkant gebruikt
''' DIN Rechts dan wordt PlaatOfPlankDikteVoorkant gebruikt
'''

Dim Dikte As Double
Dikte = PlaatOfPlankDikte

If Dikte = 0 Then
ArrayBlokkenPlaat = 0 ul

Else If Dikte > 1 And Dikte <= 5 Then
ArrayBlokkenPlaat = 1 ul

Else If Dikte > 5 And Dikte <= 10 Then
ArrayBlokkenPlaat = 2 ul

Else If Dikte >10 And Dikte <= 15 Then
ArrayBlokkenPlaat = 3 ul

Else If Dikte > 15 And Dikte <= 20 Then
ArrayBlokkenPlaat = 4 ul
MessageBox.Show("Indien nodig ter hoogte van tegensluiting uitsparing maken in plaat of plank!", "Melding")

Else If Dikte > 20 Then
MessageBox.Show("De afstand hart frame tot aan aanslag tegensluiting is te groot! Plaat of planken ter hoogte van tegensluiting uitsparen!", "Melding")

Parameter.UpdateAfterChange = True
RuleParametersOutput()
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True

End If

0 Likes
Message 7 of 11

bhavik4244
Collaborator
Collaborator
Accepted solution

@Anonymous 

 

Try this as a new rule, 

 

If DraairichtingPoort = "DIN Links" Or ArrayBlokkenDinRechts = 0
	
	Component.IsActive("ComponentPatternDinRechts") = False

Else If DraairichtingPoort = "DIN Rechts" Or ArrayBlokkenDinRechts <> 0
	
	Component.IsActive("ComponentPatternDinRechts") = True

End If

InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True

 


Bhavik Suthar
0 Likes
Message 8 of 11

WCrihfield
Mentor
Mentor
Accepted solution

It looks like you are trying to use Component.IsActive() to turn component patterns on/off.  That is probably where the problem is.  I don't think that is possible.  You may have to suppress that pattern object, or loop through all possible sub-patterns and suppress (or set visibility to off) for each component within.

OccurrencePatterns Object 

OccurrencePatterns.AddRectangularPattern Method 

RectangularOccurrencePattern Object 

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 9 of 11

Anonymous
Not applicable

@bhavik4244 

 

thanks for the code, do i have to change the code i posted? or does this new rule jusst added?

0 Likes
Message 10 of 11

bhavik4244
Collaborator
Collaborator

@Anonymous 

 

As long as it serves your purpose make it a new rule 🙂


Bhavik Suthar
0 Likes
Message 11 of 11

Anonymous
Not applicable

Whoop, Whoop, It works!!!!!

Thank you all!

 

Next step changing Description in Bill of Materials.......

0 Likes