Constraining multiple parts to the same plane in assembly

Constraining multiple parts to the same plane in assembly

Anonymous
Not applicable
7,048 Views
13 Replies
Message 1 of 14

Constraining multiple parts to the same plane in assembly

Anonymous
Not applicable

I am trying to constrain multiple parts to the base plane in an assembly.  I cannot figure out how to select multiple faces and have them all be constrained the same plane at once.  It would save me a lot of time if I was able to do this instead of selecting each face individually.

 

Thanks for your time

0 Likes
Accepted solutions (1)
7,049 Views
13 Replies
Replies (13)
Message 2 of 14

cbenner
Mentor
Mentor

@Anonymous wrote:

I am trying to constrain multiple parts to the base plane in an assembly.  I cannot figure out how to select multiple faces and have them all be constrained the same plane at once.  It would save me a lot of time if I was able to do this instead of selecting each face individually.

 

Thanks for your time


Unfortunately that is not the way that Inventor works.  Each part will need it's own individual constraints, one face at a time.  It's better this way... would you rather have one constraint fail, or several at the same time?

0 Likes
Message 3 of 14

Curtis_Waguespack
Consultant
Consultant

Hi jvb17,

 

Is it always the same plane in the components that you want to constrain?

 

I think I have an ilogic example that constrains panels (all with the bottom of the part on the XY plane) using the XY plane of each part to the XY of the assembly, would something like that work for you?

 

Or are the plane/faces of each part different?

 

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

EESignature

Message 4 of 14

Anonymous
Not applicable
That's exactly it!! I would very much appreciate that! I have not used iLogic yet.
0 Likes
Message 5 of 14

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi jvb17,

 

Here's an iLogic rule to place a Flush Constraint between every component and the assembly XY plane, and a quick video showing how to put it in place.

 

Post back if you have questions.

 

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

 

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

Dim oPlane As WorkPlane
Dim oProxyPlane As WorkPlaneProxy

'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)  

	'check for and skip virtual components
	'(in case a virtual component trips things up)
	If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then		
    	oPlane = oOccurrence.Definition.WorkPlanes.Item(3) 'XY plane
		'create component proxy plane in assembly		
   		Call oOccurrence.CreateGeometryProxy(oPlane, oProxyPlane)
	End If
	
	'get assembly plane
	Dim oPlane2 As WorkPlane
	oPlane2 = oAsmCompDef.WorkPlanes.Item(3) 'XY plane
	
	' Create the constraint using the work plane proxies.
    Call oAsmCompDef.Constraints.AddFlushConstraint(oProxyPlane, oPlane2, 0)	
Next

 

EESignature

Message 6 of 14

Anonymous
Not applicable

Wow, really appreciate this!!  I'll get back to you when I use it at work tomorrow!

Message 7 of 14

Curtis_Waguespack
Consultant
Consultant

Hi jvb17,

 

Here's a quick modification that deletes existing constraints of a certain name, and then re-applies them.  This allows you to add more panels, and use the rule again, without creating duplicate constraints.

 

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

 

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition


'Delete Existing Constraints named XY_Flush...
Dim oConstraint As AssemblyConstraint 
	For Each oConstraint In oAsmCompDef.Constraints 
	If oConstraint.Name.Contains("XY_Flush") Then
		oConstraint.Delete
	End If
Next

Dim oPlane As WorkPlane
Dim oProxyPlane As WorkPlaneProxy

'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
i = 1
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)  

	'check for and skip virtual components
	'(in case a virtual component trips things up)
	If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then		
    	oPlane = oOccurrence.Definition.WorkPlanes.Item(3) 'XY plane
		'create component proxy plane in assembly		
   		Call oOccurrence.CreateGeometryProxy(oPlane, oProxyPlane)
	End If
	
	'get assembly plane
	Dim oPlane2 As WorkPlane
	oPlane2 = oAsmCompDef.WorkPlanes.Item(3) 'XY plane
	
	' Create the constraint using the work plane proxies.
    oConstraint =  oAsmCompDef.Constraints.AddFlushConstraint(oProxyPlane, oPlane2, 0)
	oConstraint.Name = "XY_Flush:" & i
	i=i+1
Next

 

EESignature

Message 8 of 14

kadscad
Collaborator
Collaborator

I can't believe this not an option. yes, I know it could be dangerous. Who doesn't enjoy a little danger?

 

Kirk
Inventor 2023
Message 9 of 14

IgorMir
Mentor
Mentor

No need for a little danger here. Using Muscular Modeling technique allows user to place most of the component into an assembly - grounded. Because the individual components share the same Origin Planes.

Cheers,

Igor.

 


@kadscad wrote:

I can't believe this not an option. yes, I know it could be dangerous. Who doesn't enjoy a little danger?

 


 

Web: www.meqc.com.au
0 Likes
Message 10 of 14

Mark.Hynd
Explorer
Explorer
Hi Curtis,

Is it possible to run the same rule but instead of a "Flush" constraint apply an "Angle" constraint between the same XY planes?

Thank you!
0 Likes
Message 11 of 14

Curtis_Waguespack
Consultant
Consultant

Hi @Mark.Hynd

 

See this example. I'm not sure if this is exactly what you are looking for, but it does place an angle rather than a flush

 

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

 

 

'oAngle = 15 'angle in degrees
oAngle = InputBox("Enter angle", "iLogic", 0)

If oAngle Is Nothing Then Exit Sub
If IsNumeric(oAngle) = False Then Exit Sub

oConstraintName = "XY_Angle"

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Delete Existing Constraints 
Dim oConstraint As AssemblyConstraint
For Each oConstraint In oAsmCompDef.Constraints
	If oConstraint.Name.Contains(oConstraintName) Then
		oConstraint.Delete
	End If
Next

Dim oPlane As WorkPlane
Dim oProxyPlane As WorkPlaneProxy

'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
i = 1
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)

	'check for and skip virtual components
	'(in case a virtual component trips things up)
	If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
		oPlane = oOccurrence.Definition.WorkPlanes.Item(3) 'XY plane
		'create component proxy plane in assembly		
		Call oOccurrence.CreateGeometryProxy(oPlane, oProxyPlane)
	End If

	'get assembly plane
	Dim oPlane2 As WorkPlane
	oPlane2 = oAsmCompDef.WorkPlanes.Item(3) 'XY plane

	' Create the constraint using the work plane proxies.
	oConstraint = oAsmCompDef.Constraints.AddAngleConstraint(oProxyPlane, oPlane2, oAngle * 180 / PI,
	AngleConstraintSolutionTypeEnum.kReferenceVectorSolution, oAsmCompDef.WorkAxes.Item("X Axis"))

	'optionaly you could use this line and NOT specify an rotation vector
	'oConstraint = oAsmCompDef.Constraints.AddAngleConstraint(oProxyPlane, oPlane2, oAngle * 180 / PI)

	oConstraint.Name = oConstraintName & i
	i = i + 1
Next

 

EESignature

Message 12 of 14

Mark.Hynd
Explorer
Explorer
I'll be sure to try this next week! Thank you very much for the active help!!
0 Likes
Message 13 of 14

kkryzerDDLSP
Community Visitor
Community Visitor

Is there a way to use this method without constraining ALL of the parts in assembly?  Could I do it just to a select group of objects so my entire assembly doesn't come apart?

0 Likes
Message 14 of 14

johnsonshiue
Community Manager
Community Manager

Hi! You may demote the components into a subassembly. The entire subassembly move together.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes