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.
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
Solved! Go to Solution.
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.
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
Solved! Go to Solution.
Solved by MCADAEPFW. Go to Solution.
Solved by JhoelForshav. Go to Solution.
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 🙂
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
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 🙂
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
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"
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
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"
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
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.
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.
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.
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.