Cancel
Showing results for 
Search instead for 
Did you mean: 

Mechatronics Concept Designer: Buttons and lights

Pioneer
Pioneer

Hi,

 

I am using NX 10 and Mechatronics Concept Designer. Is there a way to make an object (like a button) move down when it is clicked with mouse ,and then send a signal to an OPC output?

 

Another question about the Display changer function, is it possible to make a color change in any other way than collision sensor ?

In other words, I want the color of an object (indicator light) to be changed when an OPC signal (input) is active.

23 REPLIES

Re: Mechatronics Concept Designer: Buttons and lights

Siemens Legend Siemens Legend
Siemens Legend

Hi Makro,

 

1. The Button: In MCD you are able to apply forced by grabbing and pulling the rigid bodies during the simulation, you can use this to simulate a button or a switch (it will not work by just clicking though, you have to hold and pull abit).

 

2. The Display Changer in NX10: Unfortunate the Displaychanger only works with Collision Bodies right now. But If you have a LED, a lamp or similar, you can create your own "Universal Display Changer" with the runtime behaviour feature and abit C# code. See the example (the C# code is included in the example aswell).

 

I have made an example for both the button and the LED which is triggered by the button through a signaladapter (see attachment and video).

(view in My Videos)

 

I hope this will help...

 

Best regards,

Viktor

 

Re: Mechatronics Concept Designer: Buttons and lights

Pioneer
Pioneer

Hey, thank you for the video,

 

How do I define the Search for the component structure of the assembly ? (in row 37 of the example) If I have no split body in my part ?

Re: Mechatronics Concept Designer: Buttons and lights

Siemens Legend Siemens Legend
Siemens Legend

Hey Makro,

 

I used the Split Body  because my LED was one single solid body.

 

I would recommend using the journal for examples like this, that  way you get real C# Code of your actions in NX (e.g. selecting components and switching color in NX).

 

But before you use the Journal I would highly recommend switching the journal language in customer defaults or preferences from VB (Visual Basic) to C#, you can do this here:

2015-06-23_11-57-49.png

 

 

 2015-06-23_11-59-29.png

 

After that you can activate the developer Tab in your Ribbon (right click and activate "Developer")

2015-06-23_12-03-06.png

 

Then you can record your actions in c# and implement them in your runtime behaviour in MCD and dont forget to save your model before running custom code Smiley Wink.

 

Best regards,

Viktor

Re: Mechatronics Concept Designer: Buttons and lights

Pioneer
Pioneer

Ok , but there seems to be something wrong with your example file, the led is not changing color for me ...  The signal does turn true ... 

 

 

 

 

Re: Mechatronics Concept Designer: Buttons and lights

Siemens Legend Siemens Legend
Siemens Legend

I just downloaded and tested it again, but it works in my environment.

Is the Runtime Behaviour connected to the led signal?

2015-06-23_15-37-33.png
What NX Version do you use? I tested it with NX 10.0.1.4 with MP3 installed.

Re: Mechatronics Concept Designer: Buttons and lights

Pioneer
Pioneer

Yes , I have connected the signal. My NX version is 10.0.0.24

 

Is there something I have to change in the C code ?  And when I apply this code in another project, what do I have to change from these lines? 

 

Capture.PNG

Re: Mechatronics Concept Designer: Buttons and lights

Siemens Legend Siemens Legend
Siemens Legend

You have to Change the component to your specific component in the project (e.g. lamp).

 

I have made an Video that shows the process with the same code but another assembly, you can find it in the attachment.

 

In this next example I change the color of the whole part and not only the solid body thats why I dont need to search for the split body feature and just add the whole component to the objects[0]

 

2015-06-24_13-17-02.png

 

2015-06-24_13-22-02.png

2015-06-24_13-23-02.png

Re: Mechatronics Concept Designer: Buttons and lights

Pioneer
Pioneer

Thank you, that cleared something... But I did everything as you said in the last post, but the color still does not change...  

Could there be something wrong with my NX version, or Assembly..

Re: Mechatronics Concept Designer: Buttons and lights

Siemens Legend Siemens Legend
Siemens Legend

Are you able to change color of the components by using the "Edit Object Display" (ctrl + J)  in NX?

2015-06-25_10-46-44.png

 

What rendering mode do you use? 

Have you tried different rendering methods?