- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good morning
I was wondering if anyone could help me with iLogic for constraints. I have an adaptive pipe, which dependant on which one of 2 plates in the assembly is un-suppressed will be constrained to its bottom face.
What is the ilogic syntax for this? And also is it best to have one constraint from the top of the pipe face which will change what face it is constraint too dependant on what plate is active, or is it best to have 2 constraints one of which is suppressed if the component relating to it is suppressed?
i have attached the components and assembly also.
Cheers
Jamie
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @jamieking89
First create the constraints and name them something like "Plate1_constraint" and "Plate2_constraint"
Add this rule to your assembly:
If Component.IsActive("Plate1:1") = True And Component.IsActive("Plate2:1") = False Constraint.IsActive("Plate2_constraint") = False Constraint.IsActive("Plate1_constraint") = True ElseIf Component.IsActive("Plate1:1") = False And Component.IsActive("Plate2:1") = True Constraint.IsActive("Plate1_constraint") = False Constraint.IsActive("Plate2_constraint") = True Else Constraint.IsActive("Plate1_constraint") = False Constraint.IsActive("Plate2_constraint") = False End If ThisDoc.Document.Rebuild
I named the rule ActiveConstraint.
Add a trigger for the rule on Component Suppression Change.
Hope it helps ![]()
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
See attached file ![]()
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
That works great thanks.
Are you aware if i can do a smilar thing with only using 1 constraint but changing the plate face in the constraint dependant on the suppression of components using ilogic?
Thanks for your help!
Jamie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @jamieking89
Happy to help!
You can do that but it's much more complex. Try the iLogic code below. You'll have to make a constraint and name it
Plate_Constraint in which the first entity in the constraint is "Top_of_pipe_plane" and the second is one of the planes from your parts.
You should have the same event trigger as before.
Dim oDoc As AssemblyDocument = ThisDoc.Document Dim oConstraint As MateConstraint = oDoc.ComponentDefinition.Constraints.Item("Plate_Constraint") Dim oPlaneProx1 As WorkPlaneProxy = Nothing Dim oPlaneProx2 As WorkPlaneProxy = Nothing Dim oPlate1 As ComponentOccurrence = oDoc.ComponentDefinition.Occurrences.ItemByName("Plate1:1") Dim oPlate2 As ComponentOccurrence = oDoc.ComponentDefinition.Occurrences.ItemByName("Plate2:1") If Component.IsActive("Plate1:1") = True And Component.IsActive("Plate2:1") = False Call oPlate1.CreateGeometryProxy(oPlate1.Definition.WorkPlanes.Item("Plate1_face_plane"), oPlaneProx1) oConstraint.ConvertToMateConstraint(oConstraint.EntityOne, oPlaneProx1, oConstraint.Offset.Value) ElseIf Component.IsActive("Plate1:1") = False And Component.IsActive("Plate2:1") = True Call oPlate2.CreateGeometryProxy(oPlate2.Definition.WorkPlanes.Item("Plate2_face_plane"), oPlaneProx2) oConstraint.ConvertToMateConstraint(oConstraint.EntityOne, oPlaneProx2, oConstraint.Offset.Value) Else Exit Sub End If oConstraint.Name = "Plate_Constraint" ThisDoc.Document.Rebuild
See attached file ![]()
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks again, that is great. I am trying to expand my ilogic/coding skills with Inventor. This has helped me a great deal. I will have a play around with the slightly more complex version aswell and see how it works.
Thanks again, much appreciated!
Jamie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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 ffound code but nothing that says 'use this part' and suppress.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @MCADAEPFW
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 ![]()
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've started a thread about this here: https://forums.autodesk.com/t5/inventor-customization/specify-part-specifically-and-suppress-constra...