How to use face from part in subassembly to constrain subassembly with iLogic

How to use face from part in subassembly to constrain subassembly with iLogic

Anonymous
Not applicable
1,510 Views
7 Replies
Message 1 of 8

How to use face from part in subassembly to constrain subassembly with iLogic

Anonymous
Not applicable

For my internship I am working on a big project where I am automating the design process of industrial catwalks. I am learning a lot of the cool features that iLogic gives. I am at the point now where I am generating new parts by copying master parts, I place and constraint the new generated parts in subassembly's, and place the subassemblys in the main assembly with multiple catwalk pieces. No problems so far.

 

However I have come to the point where I keep on strugling with 1 specific constraining problem. What I want to do is automaticaly constrain parts in an assembly to parts from an underlaying subassembly. However since the subassembly is custom generated I cant assign a name to the generated faces since the model looks different each time based on the given parameters. So the only way I currently have to constrain a part to a subassembly is using the origin planes, which is just a super clumsy way of doing it, and its way to easy to make mistakes doing it that way. So is there a way to use a plane which has a name from a part in the subassembly?

 

To make more clear what I mean I will give an example:

part1 has a hole with the name hole1

part2 has a hole with the namehole2

Subassembly1 has part1 in it

Assembly2 has Subassembly1 and Part2 in it

I want to constrain part2 with hole2 to part1 with hole1 using insert however I cant directly acces part1 since it is in subassembly1 which doesnt recognize hole1

 

I could think of 3 ways how it could possibly be solved.

1 I would need a way to automatically push the name hole1 to a "higher level" so it is recognized in the subassembly

2 I need a way to acces a "lower" laying part when placing the constraint in the contraint command in iLogic

3 I need to stick to my method of using the origin workplanes which would be a pain 😞

 

Thanks a lot in advance for your help!

 

 

 

0 Likes
Accepted solutions (1)
1,511 Views
7 Replies
Replies (7)
Message 2 of 8

LarsBJepsen
Advocate
Advocate

Maybe you can get som inspiration here: https://forums.autodesk.com/t5/inventor-forum/ilogic-fun-changing-an-iproperty-in-each-part-of-an-as...

 

Else, try uploading your files and your ilogic code as it is now, that makes it easier to suggest a solution.

 

/Lars

Message 3 of 8

Anonymous
Not applicable

The models are very complex with a total of around 10000 lines of code I guess, so I dont think you will get wiser from it. Besides that, the rules use specific item locations on the company server. So I wouldnt be able to upload the files nor code. However I did some more research in the meantime and I think I know more clear what I need now.

 

Apperently its not possible to have named geometry in an assembly level. So I would need to use geometry from the part. Using the example I gave earlier the code would have to look something like this:

 

		Constraints.AddInsert(insert1, Subassembly1.Part1, "edge1", Part2, "edge2",
	    		axesOpposed := True, distance := 0.0, lockRotation := False, 
biasPoint1 := Nothing, biasPoint2 := Nothing)

 I know Subassembly1.Part1 doesnt mean anything in ilogic, but what I mean with it is that it should grab edge1 from part1 in subassembly1. I am pretty sure there is some code to get this, but I wouldnt know how

0 Likes
Message 4 of 8

clutsa
Collaborator
Collaborator

Edit: Had the @ person right then wrong fixed again. Sorry.

@Anonymous   I'm at the same point you're at and have come to the same conclusion. I haven't had much of a chance to play with the code yet (and my origin points line up with what I want so I probably won't try) but have you looked into using User Coordinate Systems (UCS). You should be able to programmaticly add the UCSs to SubAssembly1 and use it for your mates in MainAssembly1? Just a thought.

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 5 of 8

Anonymous
Not applicable

That wouldnt have worked for me since the subassemblys where also build up automatically or at least it wouldnt have saved me time, I ended up using the default planes

0 Likes
Message 6 of 8

clutsa
Collaborator
Collaborator
Accepted solution

Think I got it... sounds like I'm late to the party but maybe someone down the road can use it.

Constraints.AddInsert("insert1", {"Subassembly1", "Part1"}, "edge1", "Part2", "edge2",
	    		axesOpposed := True, distance := 0.0, lockRotation := False, 
biasPoint1 := Nothing, biasPoint2 := Nothing)

 I haven't tried the code below because I don't have a use (yet) but I wounder if it would work.

Constraints.AddInsert("insert1", {"Topassembly", {"Subassembly1", "Part1"}}, "edge1", "Part2", "edge2",
	    		axesOpposed := True, distance := 0.0, lockRotation := False, 
                        biasPoint1 := Nothing, biasPoint2 := Nothing)
If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

Message 7 of 8

clutsa
Collaborator
Collaborator

Finally found a need for a three level deep mate. Turns out my first guess was wrong. You just keep adding commas and parts, no need for the extra brackets. Also the objects are called "ComponentArgument" so if you need to Dim them for use in multiple constraints you can.

Dim myCompArg as ComponentArgument = {"Topassembly", "Subassembly1", "Part1"}
Constraints.AddInsert("insert1", myCompArg, "edge1", "Part2", "edge2", axesOpposed := True, distance := 0.0, lockRotation := False, biasPoint1 := Nothing, biasPoint2 := Nothing)

  

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 8 of 8

benjamin.herinckx
Contributor
Contributor

Have you ever managed to use this snippet with an iPart ?

0 Likes