Conditional control of the assembly component presence with iLogic

Conditional control of the assembly component presence with iLogic

Maxim-CADman77
Advisor Advisor
430 Views
4 Replies
Message 1 of 5

Conditional control of the assembly component presence with iLogic

Maxim-CADman77
Advisor
Advisor

I'd like to know how to control (place/delete) assembly component by means of iLogic.

Let's take standard scissors.iam (see attached, saved with Inventor 2022.5) as a simplest sample.

I've added 'Spring_Exist' parameter (Boolean).

 

What would be the minimal iLogic-rule code to add/remove Scissors_spring component based on the value of my parameter?

 

PS:
I don't interested in old-school methods (like switching Visibility On/Off, Enabled/Disabled, Suppress/Unsuppress).

PPS:
I do see the relevant sample BrewMain-Drawing-ModelState.zip at https://www.autodesk.com/support/technical/article/caas/tsarticles/ts/3gnm93P9sPAWE6vndk7fjq.html but I'd like a simpler one.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Accepted solutions (1)
431 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

Just a quick related note about an old automotive industry technique that you may, or may not already be aware of.  When they wanted to make a configurable assembly, once they have the 'master' assembly the way they want it, with every main type of part and sub assembly in place, they would then work backwards to transfer each component's position & orientation from the origin of the assembly, and duplicate that within the parts and sub assemblies, so that the part would be that exact same position and orientation from its own origin.  Then when they want to switch one type of part or sub assembly out for another, they are all constrained to the origin in the exact same way.  That system may be awkward/challenging to use/maintain in some scenarios, but works pretty good in others.  Never any 'faces don't match' problems.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Maxim-CADman77 

 

See the attached zip file.

 

  • First step is to remove the adaptivity of the spring.
  • Next delete the constraints on the spring and replace them ( not sure why I had to do that, but I did)
  • Then create a rule and right click on the sprig and use Capture Current State as shown . 
    • That will create the code and the named entities in the spring

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Curtis_Waguespack_0-1691077799390.png

 

If Spring_Exist = True Then

	Dim scissor_spring_1 = Components.Add("scissor_spring:1", "scissor_spring.ipt")

	Constraints.AddInsert("Insert:2", "scissor_spring:1", "Edge0", "blade_main:1", "Edge0", axesOpposed := False)
	Constraints.AddMate("Mate:1", "scissor_spring:1", "Edge1", "blade_main:1", "Face0")
Else
	Try : Component.InventorComponent("scissor_spring:1").Delete : Catch : End Try
End If

 

EESignature

0 Likes
Message 4 of 5

Maxim-CADman77
Advisor
Advisor

@WCrihfield 
I believe that to make "new workflow" bullet-proof the named geometry should be used for constraining, right?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 5 of 5

WCrihfield
Mentor
Mentor

Definitely.  Assigning names to Face, Edge, & Vertex objects in all the parts that will be going into your configuration type assemblies is a pretty effective and useful process that many have been using for years now, when your plan includes mating those types of entities together within the assembly, rather than WorkPlane, WorkAxis, & WorkPoint type geometry.  But letting the 'capture current state' tool assign the names may not be the best way to do it.  That is great for quick, simple stuff, but in larger, more complex assemblies, you will want to put in the 'preparation' efforts ahead of time.  Currently, only the part environment has a user interface tool for assigning names (right-click face, select 'Assign Name' from the right-click menu), but there are also other tools for similar functionality within the context of assemblies.  Sometimes you may not want to 'edit' the existing model files, or the model files may be ReadOnly (for one reason or another), so assigning names within the parts may not be an option.  There are add-ins that can help with the assembly side naming, but some of us have our own simple iLogic or VBA based tools that get the job done too.  However, I do still try to use the origin planes of the model files as much as possible, because they are simply the best option in many situations.  But I also rename my origin planes to more useful names, so I will know which ones are for what later on.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes