Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Specify part Specifically and suppress constraints

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
MCADAEPFW
745 Views, 4 Replies

Specify part Specifically and suppress constraints

MCADAEPFW
Enthusiast
Enthusiast

I'm creating a new post from a question I asked from another thread this is a copy paste from that question.  

This is the original thread link:  Originating Thread for this question (Starting at Reply 7)

That's all fine and dandy but I want to specify a specific component in my assembly and then have it iterate through all the associated relationships and suppress them.   I can not find any documentation on how to set a specific component to do a 

 

   'For each joint attached to THIS SPECIFIC PART go through and suppress the joint if it is not already suppressed.' 

Also want to do the same thing with the constraints.   

 

i have found  code but nothing that says 'use this part' and suppress.  

 

 
 
 
MESSAGE 8 OF 8
 

 

  
in reply to: erikk6WMUN
 
 

Hi @erikk6WMUN 

You want to pick the occurrence and all constraints/joints associated should be suppressed?

Dim oOcc As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Pick component")
For Each oConstraint As AssemblyConstraint In oOcc.Constraints
oConstraint.Suppressed = True
Next
For Each oJoint As AssemblyJoint In oOcc.Joints
oJoint.Suppressed = True
Next

 

If this answer is not what you're looking for, start a new thread and we'll try to solve your problem there 

 

 

 This thread is already solved and your topic isn't really the same 

 

 

If this answer solved your problem please ACCEPT AS SOLUTION or like if you found it helpful

 

 


I'd really appreciate if you voted for this idea aswell: Feature properties, suppress if no effect - Autodesk Community 


/Jhoel Forshav

0 Likes

Specify part Specifically and suppress constraints

I'm creating a new post from a question I asked from another thread this is a copy paste from that question.  

This is the original thread link:  Originating Thread for this question (Starting at Reply 7)

That's all fine and dandy but I want to specify a specific component in my assembly and then have it iterate through all the associated relationships and suppress them.   I can not find any documentation on how to set a specific component to do a 

 

   'For each joint attached to THIS SPECIFIC PART go through and suppress the joint if it is not already suppressed.' 

Also want to do the same thing with the constraints.   

 

i have found  code but nothing that says 'use this part' and suppress.  

 

 
 
 
MESSAGE 8 OF 8
 

 

  
in reply to: erikk6WMUN
 
 

Hi @erikk6WMUN 

You want to pick the occurrence and all constraints/joints associated should be suppressed?

Dim oOcc As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Pick component")
For Each oConstraint As AssemblyConstraint In oOcc.Constraints
oConstraint.Suppressed = True
Next
For Each oJoint As AssemblyJoint In oOcc.Joints
oJoint.Suppressed = True
Next

 

If this answer is not what you're looking for, start a new thread and we'll try to solve your problem there 

 

 

 This thread is already solved and your topic isn't really the same 

 

 

If this answer solved your problem please ACCEPT AS SOLUTION or like if you found it helpful

 

 


I'd really appreciate if you voted for this idea aswell: Feature properties, suppress if no effect - Autodesk Community 


/Jhoel Forshav

4 REPLIES 4
Message 2 of 5
JhoelForshav
in reply to: MCADAEPFW

JhoelForshav
Mentor
Mentor

@MCADAEPFW 

I take it the code i posted there wasn't what you're looking for? Could you give an example as to why that is? In what way does the code not give the results you need? 🙂

 

EDIT: I see now that you posted an explaination in the other thread 🙂

0 Likes

@MCADAEPFW 

I take it the code i posted there wasn't what you're looking for? Could you give an example as to why that is? In what way does the code not give the results you need? 🙂

 

EDIT: I see now that you posted an explaination in the other thread 🙂

Message 3 of 5
JhoelForshav
in reply to: JhoelForshav

JhoelForshav
Mentor
Mentor
Accepted solution

How about this?

Dim oAsm As AssemblyDocument = ThisDoc.Document
Dim oName As String = "NameOfOccurrence"
Dim oOcc As ComponentOccurrence = oAsm.ComponentDefinition.Occurrences.ItemByName(oName)
For Each oConstraint As AssemblyConstraint In oOcc.Constraints
oConstraint.Suppressed = True
Next
For Each oJoint As AssemblyJoint In oOcc.Joints
oJoint.Suppressed = True
Next

Just change "NameOfOccurrence" to whatever the name of your component is ex: "Part1:1"

How about this?

Dim oAsm As AssemblyDocument = ThisDoc.Document
Dim oName As String = "NameOfOccurrence"
Dim oOcc As ComponentOccurrence = oAsm.ComponentDefinition.Occurrences.ItemByName(oName)
For Each oConstraint As AssemblyConstraint In oOcc.Constraints
oConstraint.Suppressed = True
Next
For Each oJoint As AssemblyJoint In oOcc.Joints
oJoint.Suppressed = True
Next

Just change "NameOfOccurrence" to whatever the name of your component is ex: "Part1:1"

Message 4 of 5
MCADAEPFW
in reply to: JhoelForshav

MCADAEPFW
Enthusiast
Enthusiast
Accepted solution

Yes perfect that will work.   I still struggle with all the Dim this and that.  I never know when to use it and the API help file is not really helpful unless you have a better understanding of coding.  

 

What would be helpful is if explained what it is doing or a little incontext example of how.  I've looked at the sample codes but it seems that everything I want to customize never has a sample file that close.  I was going kind of down that same route but gave up because I kept getting an error.   

 

Thank you thank you thank you so very much!!!!   Going to add this to my Snippets now.   

0 Likes

Yes perfect that will work.   I still struggle with all the Dim this and that.  I never know when to use it and the API help file is not really helpful unless you have a better understanding of coding.  

 

What would be helpful is if explained what it is doing or a little incontext example of how.  I've looked at the sample codes but it seems that everything I want to customize never has a sample file that close.  I was going kind of down that same route but gave up because I kept getting an error.   

 

Thank you thank you thank you so very much!!!!   Going to add this to my Snippets now.   

Message 5 of 5
rogerJDLE5
in reply to: JhoelForshav

rogerJDLE5
Contributor
Contributor

Hi,

 

This looks really neat and seems pretty much what I'm looking for, but is there some way of coding this so that it can be called as a custom function or subroutine with the name of a component or sub-assembly as the input argument?

 

Below is the code I am running currently. I would like to replace the constraint suppression code which is explicit for the existing constraints with a single function as above so that if a constraint name is changed or a constraint replaced the iLogic code does not need updating.

 

If TF_LENGTH_3 = 0 Then
	Component.IsActive("FLANGE_TOP_#3:1") = False
	Constraint.IsActive("Flush:FRONT_TF3") = False
	Constraint.IsActive("Mate:TF3_WEB") = False
	Constraint.IsActive("Mate:END_TF2_TF3") = False
	Constraint.IsActive("Mate:END_TF3_TF4") = False
	
ElseIf TF_LENGTH_3 > 0 And TF_LENGTH_4 = 0 Then
	Component.IsActive("FLANGE_TOP_#3:1") = True
	Constraint.IsActive("Flush:FRONT_TF3") = True
	Constraint.IsActive("Mate:TF3_WEB") = True
	Constraint.IsActive("Mate:END_TF2_TF3") = True
	Constraint.IsActive("Mate:END_TF3_TF4") = True
	
ElseIf TF_LENGTH_4 > 0 And TF_LENGTH_5 = 0 Then
	Component.IsActive("FLANGE_TOP_#3:1") = True
	Constraint.IsActive("Flush:FRONT_TF3") = True
	Constraint.IsActive("Mate:TF3_WEB") = True
	Constraint.IsActive("Mate:END_TF2_TF3") = True
	Constraint.IsActive("Mate:END_TF3_TF4") = True
	
ElseIf TF_LENGTH_5 > 0 Then
	Component.IsActive("FLANGE_TOP_#3:1") = True
	Constraint.IsActive("Flush:FRONT_TF3") = True
	Constraint.IsActive("Mate:TF3_WEB") = True
	Constraint.IsActive("Mate:END_TF2_TF3") = True
	Constraint.IsActive("Mate:END_TF3_TF4") = True
		
End If

 

Best regards.

0 Likes

Hi,

 

This looks really neat and seems pretty much what I'm looking for, but is there some way of coding this so that it can be called as a custom function or subroutine with the name of a component or sub-assembly as the input argument?

 

Below is the code I am running currently. I would like to replace the constraint suppression code which is explicit for the existing constraints with a single function as above so that if a constraint name is changed or a constraint replaced the iLogic code does not need updating.

 

If TF_LENGTH_3 = 0 Then
	Component.IsActive("FLANGE_TOP_#3:1") = False
	Constraint.IsActive("Flush:FRONT_TF3") = False
	Constraint.IsActive("Mate:TF3_WEB") = False
	Constraint.IsActive("Mate:END_TF2_TF3") = False
	Constraint.IsActive("Mate:END_TF3_TF4") = False
	
ElseIf TF_LENGTH_3 > 0 And TF_LENGTH_4 = 0 Then
	Component.IsActive("FLANGE_TOP_#3:1") = True
	Constraint.IsActive("Flush:FRONT_TF3") = True
	Constraint.IsActive("Mate:TF3_WEB") = True
	Constraint.IsActive("Mate:END_TF2_TF3") = True
	Constraint.IsActive("Mate:END_TF3_TF4") = True
	
ElseIf TF_LENGTH_4 > 0 And TF_LENGTH_5 = 0 Then
	Component.IsActive("FLANGE_TOP_#3:1") = True
	Constraint.IsActive("Flush:FRONT_TF3") = True
	Constraint.IsActive("Mate:TF3_WEB") = True
	Constraint.IsActive("Mate:END_TF2_TF3") = True
	Constraint.IsActive("Mate:END_TF3_TF4") = True
	
ElseIf TF_LENGTH_5 > 0 Then
	Component.IsActive("FLANGE_TOP_#3:1") = True
	Constraint.IsActive("Flush:FRONT_TF3") = True
	Constraint.IsActive("Mate:TF3_WEB") = True
	Constraint.IsActive("Mate:END_TF2_TF3") = True
	Constraint.IsActive("Mate:END_TF3_TF4") = True
		
End If

 

Best regards.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report