Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Converting Mate Constraint to Flush Constraint

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
512 Views, 2 Replies

Converting Mate Constraint to Flush Constraint

Hey,

 

I am using Inventor 2018.

Does anyone know how to convert a mate constraint to a flush constraint?

 

In my code I want to create a mate constraint between the XY Plane of "Rib Frame 1-1" and the XY plane of "FSP Body Fabrication"  The code works but I want the XZ planes I want to constrain flush.  Is there a way to convert the mate to flush or a way to constrain directly to flush without converting it?

 

below is my code:

 

Dim compOcc1 As ComponentOccurrence = Component.InventorComponent("Rib Frame 1-1:1")
                Dim compOcc2 As ComponentOccurrence = Component.InventorComponent("FSP Body Fabrication 1:1")
                
                    Dim oWorkPlane1 As WorkPlane
                        oWorkPlane1 = compOcc1.Definition.WorkPlanes("XY Plane")
                    Dim oWorkPlane2 As WorkPlane
                        oWorkPlane2 = compOcc2.Definition.WorkPlanes("XY Plane")
                Dim oproxyWorkPlane1 As WorkPlaneProxy = Nothing
                    compOcc1.CreateGeometryProxy(oWorkPlane1, oproxyWorkPlane1)
                Dim oproxyWorkPlane2 As WorkPlaneProxy = Nothing
                    compOcc2.CreateGeometryProxy(oWorkPlane2, oproxyWorkPlane2)
                    Dim oAConstraint As MateConstraint
                        oAConstraint = oAsmCompDef.Constraints.AddMateConstraint(oProxyWorkPlane1,oProxyWorkPlane2, 0)
                        

                    Dim oWorkPlane3 As WorkPlane
                        oWorkPlane3 = compOcc1.Definition.WorkPlanes("XZ Plane")
                    Dim oWorkPlane4 As WorkPlane
                        oWorkPlane4 = compOcc2.Definition.WorkPlanes("XZ Plane")
                Dim oproxyWorkPlane3 As WorkPlaneProxy = Nothing
                    compOcc1.CreateGeometryProxy(oWorkPlane3, oproxyWorkPlane3)
                Dim oproxyWorkPlane4 As WorkPlaneProxy = Nothing
                    compOcc2.CreateGeometryProxy(oWorkPlane4, oproxyWorkPlane4)
                    Dim oAConstraint2 As MateConstraint
                        oAConstraint = oAsmCompDef.Constraints.AddMateConstraint(oProxyWorkPlane3,oProxyWorkPlane4, 0)                        

 

2 REPLIES 2
Message 2 of 3
mcgyvr
in reply to: Anonymous

Just change the first instances of 

MateConstraint

to

FlushConstraint

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 3 of 3
Anonymous
in reply to: mcgyvr

When I try this:

Dim oAConstraint2 As FlushConstraint
                        oAConstraint = oAsmCompDef.Constraints.AddFlushConstraint(oProxyWorkPlane3,oProxyWorkPlane4, 0)                        

I get this error

 

Error in rule: Place Ribs, in document: FSP Module 1.iam

Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.MateConstraint'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{CEFDC141-B989-4BF3-BDD7-8308D8089FFE}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

 

and when I try this:

 

Dim oAConstraint2 As FlushConstraint oAConstraint = oAsmCompDef.Constraints.AddMateConstraint(oProxyWorkPlane3,oProxyWorkPlane4, 0)

 

It will create a mate constraint.

 

 

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report