Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JBerns
407 Views, 12 Replies

Help with creating an assembly constraint with offset that uses an expression

Community,

 

I have searched Help, Forums, and have asked Gemini to write ilogic code, but have been unsuccessful in creating an assembly constraint that uses an expression for the offset.

 

Here is the code I have tried:

Dim offsetExpression As String = "Return_Rail_Liner_Thickness * -1.0 ul"
oConstraintSub = oAsmCompDef.Constraints.AddFlushConstraint(oAsmCompDef.WorkPlanes("XY Plane"), oproxyPlaneAFLXY, Offset:=offsetExpression)

 

The error message is, "The parameter is incorrect."

 

I know the rest of the line is good because I was originally using an offset value of 0 and the constraint was created.

 

Within the iLogic Editor, I used the relationship capture tool. This was the result:

JBerns_0-1732225231957.png

 

I thought it was bad practice to use parameters as shown in gold above.

 

I tried this - after creating the constraint with an offset of 0 (zero), I tried to edit the constraint:

oConstraintSub.Offset = offsetExpression

but Inventor reports that the Offset is Read-Only.

 

Your assistance would be appreciated to create an assembly constraint using an expression for the offset.

If there is a reference or an example for this, I would welcome the link.

 

Thank you for your time and attention. I look forward to your replies.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Labels (4)