Using Expressions/Constraints in Arrangements
Using Expressions/Constraints in Arrangements
(OP)
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
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





RE: Using Expressions/Constraints in 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.
RE: Using Expressions/Constraints in Arrangements
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!
RE: Using Expressions/Constraints in Arrangements
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.
RE: Using Expressions/Constraints in Arrangements
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
RE: Using Expressions/Constraints in Arrangements
RE: Using Expressions/Constraints in Arrangements
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.
RE: Using Expressions/Constraints in Arrangements
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!
RE: Using Expressions/Constraints in 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.
RE: Using Expressions/Constraints in Arrangements
I am looking for the same function and I will also open an ER.
Is there any way by visual basic ?
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: Using Expressions/Constraints in Arrangements
Didier,
CODE --> VB
'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 arrangementSo 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
RE: Using Expressions/Constraints in Arrangements
Thanks for your suggection, but in fact I am not able to write any lines of vb by myself.
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: Using Expressions/Constraints in Arrangements
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 --> VB
' 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 ModuleThe resulting string expression "Active_arrangement" can be used to define the value for other NX expressions using "if/then"
CODE --> expression
HTH,
Joe
RE: Using Expressions/Constraints in Arrangements
Thanks a lot. It's perfect
Regards
Didier Psaltopoulos
http://www.psi-cad.com