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!

PTS - replace component 2

Status
Not open for further replies.

wOOzi

Automotive
May 4, 2015
10
Hello everyone,

does anyone know if it is possible to replace components by Product Template Studio?
I do have an assembly and one part has a variable length. But I don't want to change the measure. I would like to replace the components

Is that possible? I saw Visual Rules in PTS. But I don't know how that works...

I am using NX 9

Thank you´!

I would appreciate any Information.
 
Replies continue below

Recommended for you

wOOzi --

Yes, it's definitely possible. :)

The simplest way is to use Component Suppression By Expression (which can be set up with expressions in NX, without using Visual Rules at all.)

If you need to actually replace the components, then you'll need to use Visual Rules.

The key is to have one Visual Rule containing the logic, which then calls one Visual Rule for each actual replacement action. Here's a slide from a 2013 PLM World "PTS 201" presentation I gave about slightly more advanced PTS topics:

150507_PTS_component_swap.png


For a two-part swap, this might look like this, with one rule like this containing the logic:

150507_PTS_component_swap_01.png


And one rule like this driving each specific replacement:

150507_PTS_component_swap_02.png
_________
150507_PTS_component_swap_03.png


For a larger swap involving five components, for instance, the individual rules would look just like the two above, while the logic rule might look more like this:

150507_PTS_component_swap_04.png


There is some basic training for Visual Rules is in the Learning Advantage course for PTS, but in a nutshell, you'll drag rules from the palette on the left into the workspace, string them together with arrows, and fill out the forms. :)

Will that help get you started?

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)
 
Hello Taylor,

thank you so much for that Information. That is really awesome.

But there is one think I didn't understand. Could you please show me how your Interface with the expression look like?
Is "$1" the name of the expression?

Cause the name of my expression is for example "lenght"

Fetch Expression --> "length"

2. Conditional: "length" = 500

Is there any way to check the rule while working in PTS?
"MAINCHANNEL" is the name of the component you want to replace?

Thank you so much.
 
2015-05-08_09_56_33-Clipboard_ht89ef.jpg


maybe that screenshot will help you to find my mistake.
 
wOOzi --

The $1 is whatever is coming in the arrow from the previous block. :)

What's happening here is that the Conditional block is more generic than you're thinking. More to the point, It's not specifically looking for an expression, and so it's not recognizing "length" as an expression name.

Using the $1 ensures that the expression "length" is what gets passed into the conditional, as opposed to just the random string "length". (Does that make sense?)

This conditional block can be used for lots of things besides expressions. For example you might create a rule that counts the number of holes in a body, and then decides to either do or not do something based on that quantity. The number of holes doesn't have to be an expression at all. If it was calculated in the previous block and passed in with an arrow, then the $1 will pick it up and use it.

Does that help?

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)
 
thank you for your response. I understand what you are saying but unfortunately my visual rule does not work in NX.

Maybe you could help me with that for the last time.
I do have an assembly (TEST_ASSY) and one part (PART_1).
In that TEST_ASSY there is the Expression "lenght".

Ok, then I created that rules. Replace Component "PART_1" with "PART_2" and Fetch Expression "length" --> "$1" == 200 --> TRUE --> swap_to_2
And I activated the Checkbox "Run Visual Rule when value changed" for the Expression "length".

But when I open NX and I Change the value of the Expression to "200" nothing happens. Do you have an idea why not?
I updated all but nothing changed.

Attached you will find my TEST_Assembly.
Unfortunately I am not able to work on NX during the Weekends.

you can also PM me@ dominik.schreiner@hotmail.com

I really really appreciate your help. Thank you!

Have a nice weekend.
 
 http://files.engineering.com/getfile.aspx?folder=bc7bba28-36f5-464e-9fd7-79c77b24e63e&file=replace_component.zip
wOOzi --

You are very, very close. :)

Four little things I tweaked in the way you'd done this:

1. In your Visual Rules, you had created your "swap_to_2" rule perfectly, and had correctly selected that rule as the action for the TRUE branch in your "swap" rule. But your FALSE branch didn't have anything to do. I added a "swap_to_1" rule just like your "swap_to_2" rule (though referring to the other part, of course), and selected it for the FALSE branch:

2015-05-11_fill_both_branches.png


2. While you had indeed checked "Run Visual Rule when value changed" for the Expression "length", you'd not selected you "swap" rule there... But I see why. :) [You couldn't see it there.]

When creating the "swap" rule, you'd checked the little "Invoked From Visual Rule" box. This check indicates that the rule is going to be invoked only from other Visual Rules, and not invoked directly from the UI. In your example, your "swap_to_1" and "swap_to_2" rules are exactly this, and should have this checked, because each of them will only be used from the context of your conditional "swap" rule.

But because you want your "length" expression to invoke your main "swap" rule, this should not be checked. With this checked, your "swap" rule was not visible in the list of available rules in your "length" expression:

2015-05-11_check_for_subroutines_only.png


Unchecking this for the "swap" rule makes it visible there:

2015-05-11_uncheck_makes_visible.png


...and so...

3. At that point you can then SELECT your "swap" rule, and you're off to the races. :)

2015-05-11_select_visual_rule.png


4. The last one is a stylistic thing, but I also removed the file paths from the Replace Component blocks, like this:

2015-05-11_no_path_here.png


This just helps with portability, if the template location moves around on disk (like when you send it to me, and when I send it back to you.)

Does that all make sense? :)


Here's a brief video of your swap working:

150511_PTS_VR_component_swap-1.m4v

...and the modified assembly is attached.

Does that help?

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)
 
Hello Taylor,

thank you very much for that fast and detailed response. That was a great help.

I was wondering why I could not select a rule but now I know why :)

My collegues thought it is not possible. I am looking forward to show them another nice function of NX.

Best regards

wOOzi
 
Great to hear. Knock 'em dead, wOOzi. ;-)

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)
 
Hello Taylor,

my colleagues were really impressed by that function. But I have another question. Everything works really fine but when I add that assembly to another assembly the template doesn't work anymore. Do you have a solution for that problem?

Attached you will find an screenshot. Hopefully you understand what I mean. :)

Edit: Just changed the assembly load Options and now it works. Guess that was the Problem ;)


German Engineering
 
 http://files.engineering.com/getfile.aspx?folder=52c3b034-4831-47df-ba8b-f514c3747560&file=2015-06-05_09_24_55-NX_9_-_Modeling.jpg
Great to hear. Thanks for the update. :)

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor