Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Expressions/Constraints in Arrangements 2

Status
Not open for further replies.

rocketgofire

Aerospace
Jan 13, 2011
12
I have an assembly with several parts that are connected and oriented at specific angles. These angles can change, and we'd like to have an easy method of seeing what the assembly looks like in multiple configurations, so I am doing different arrangements.

Currently, I have the parts positioned using constraints, including orient angle constraints that are linked to expressions. This way, I can change the angles in the expressions dialog, which makes it easy to change all of the angles at once. What I'd like to be able to do is select an arrangement, use the expressions dialog to set the angles, and then move onto the next arrangement. However, when I try this, all of the arrangements end up being the same, and I can't find an arrangement-specific option within the expressions dialog. I know that I've set different values in different arrangements for the same constraint before but I just can't remember how, and it might have been in a previous version of NX. I'm currently using NX7.5.

Any help would be appreciated.

Thanks,
Andy

 
Replies continue below

Recommended for you

First you have to create multiple, albeit redundant, Constraints (as many as the number of Arrangements). Then change Arrangements one at a time, each time selecting a different Constraint, pressing MB3 and selecting 'Arrangement Specific'. Now each Constraint will only be in effect for one of the Arrangements. Now simply set the desired angle value for each Constraint/Arrangement combination and you should be home free.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.
 
Thanks for the reply, John. I guess I was looking for an arrangement-specific option for expressions, and that unfortunately doesn't exist.

Following your solution, I found the "Arrangement Specific" option for the constraints, and I also found something called "Edit in Arrangements," which allows me to set expressions for each specific arrangement. It looks like I can then go into the expression editor and rename them something like Arr1_JointAngle1, Arr2_JointAngle1, Arr1_JointAngle2, etc. It's not exactly what I was hoping for, since I have to create and rename new expressions for each arrangement, but it saves me the trouble of creating new constraints, which I didn't want to do since Orient Angle constraints are a pain to figure out what to click. Plus, the expressions dialog is easy to use and this method should allow less-experienced coworkers to easily edit my expressions, which was a goal I didn't mention.

I find it odd that I can have arrangement-specific positions, constraints, suppression, and even exploded views, but I can't have expressions. Are there any plans to add this in future versions, or does it come up rarely enough that it's not really a significant problem?

Thanks for your help!
 
Sorry about my earlier suggestion. I think I may have misunderstood what you were trying to do, so what you discovered with the 'Edit in Arrangement' is the better solution.

That being said, how exactly is this NOT creating Arrangement specific Expressions? How else would you expect it to work?

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.
 
Hi,
I hope i am not that late to make a reply.I guess you can set the expressions values as per the arrangements (only for those expressions which are created from /originate from Constraints and not for every expression)for ex.Let us say giving a distance constartint).Please notice the usage of SPECIFIC in the dialog box.
I am attaching an image herewith.This shows how you can have different constraint expression values in different arrangements.
Hi John,
Please correct me if i am wrong.
Best Regards
Kapil Sharma
 
Yes, that's correct.

However, the word 'Specific' does not actually refer to the Expressions which are related ONLY to Constraints, but rather this allows you to define that a Constraint is 'Shared' by MORE than one Arrangement or that it's 'unique' or 'Specific' to a particular Arrangement. By definition, ALL Constraints are created and thus are considered 'Shared' by ALL Arrangements unless explicitly designated as being 'Specific' to one or more Arrangements.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.
 
Sharing the constraints works well - I can have a base arrangement where the constraints are linked to my joint angle expressions. After setting the proper joint angle, I can just make a new arrangement, click "Edit in Arrangements" on my orient angle constraints, and set the values to constants. This way, I can maintain an expression-linked arrangement at all times and still have different arrangements with my joint angles. Now I have another question about arrangements now too, but I'll start a new thread since it's different.

To answer your question, John (about how this approach is different from arrangement-specific expressions), I think it's partly where you edit it and partly because it's only related to constraints. In order to edit my arrangement-specific value, I have to right click on the constraint and change it. In my opinion, it would be much easier to open the expressions dialog and have either A) a drop-down at the top that changes what arrangement I'm currently editing, or B) the ability to right-click an expression and change its values for each arrangement - "x" is 4 in Arr1, 20 in Arr2, 40 in Arr3, etc. Both of these could also be nice.

The second reason I stated is that right now, these expressions only relate to constraints. If I use an expression for something else, like maybe to create a component array, I can't have that change per arrangement. Say I want three PartX's in one arrangement, and four PartX's in another, or I want to vary the distance between array components in a linear array for different arrangements. I could currently do that with constraints, but having 4 distance constraints instead of one component array seems redundant. It's probably not a major issue, and I've certainly never run into this problem before, but it could be a nice feature.

Thanks for the help!
 
The issue is that an Expression can have ONLY a single value. Therefore, what the Arrangement specific dialog does is simply create a duplicate Expression which is then assigned to what is in essence now a 'duplicate' constraint that is only effective when ITS arrangement is active. The expression system is totally unaware of which Arrangement is active or not, so as far as it's concerned ALL the expressions are being used for something and just because a particular constraint in currently not effecting anything, i.e. it's inactive because it's not part of the current Arrangement, the rest of the system doesn't really care. Now it would be nice if there was a scheme inside the expression system where you could query for which was the current Arrangement since you could then use that information in a logical statement to determine the values of other expressions thus accomplishing what you're looking for, perhaps not in as direct an approach as you're looking for, but one which would end-up being just as effective. You may wish to contact GTAC and have them open an ER to that effec: "Provide a way to determine, using a built-in expression system 'function', the name of the current Arrangement."

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.
 

Didier,

Code:
'The arrangement of the work part...

            lw.WriteLine("Work Part Active Arrangement Name: " & workPart.ComponentAssembly.ActiveArrangement.Name.ToString)

' The arrangement used by child component (sub assemblies)

            Try
                lw.WriteLine(newIndent & "Arrangement Name: " & child.UsedArrangement.Name.ToString)
            Catch ex As Exception
            End Try 

' The Try is needed since leaf node components won't use an arrangement

So it should be possible to determine the name of the active arrangement and the set the value of an expression based on the active arrangement name (each time the program is run). This technique could server as an interim solution.

HTH,

Joe
 
Didier,

This journal will set (or create) the string expression "Active_Arrangement" (line 11) in the work part to the name of the active arrangement.

Code:
' J. Petach, Creative Commons (CC0) 2013
Option Strict On
Imports System
Imports NXOpen

Module Active_Arrangement_Expression
Sub Main

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim Exp_title As String = "Active_arrangement"
Dim Arr_name As String = workPart.ComponentAssembly.ActiveArrangement.Name.ToString
Dim new_exp As String = exp_title & "=""" & Arr_name & """"
Dim edit_exp As String = """" & Arr_name & """"

Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Arrangement_Expression")

Dim expression1 As Expression
Dim nErrs1 As Integer

Try
    ' Create the expression if it does not already exist
    expression1 = workPart.Expressions.CreateExpression("String", new_exp)
    nErrs1 = theSession.UpdateManager.DoUpdate(markId1)
Catch Ex As Exception
    ' Modify the existing expression
    expression1 = CType(workPart.Expressions.FindObject(Exp_title), Expression)
    Dim nullUnit As Unit = Nothing
    workPart.Expressions.EditWithUnits(expression1, nullUnit, edit_exp)
    nErrs1 = theSession.UpdateManager.DoUpdate(markId1)
End Try

End Sub
End Module

The resulting string expression "Active_arrangement" can be used to define the value for other NX expressions using "if/then"

Code:
if Active_arrangement = "Arrangement 2" then 2 else 0

HTH,
Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor