Hi All,
I'm starting to learn programming in Machine Simulator Editor to control the movement of my component in X-Axis and Y-Axis.
I'm currently programmed some component (see attached), using C# and observed that my component is not stable if not press during run-time.
Can somebody have a look at my code and tell me whats wrong.
Thanks,
[attachment deleted by admin]
Hi All,
I'm starting to learn programming in Machine Simulator Editor to control the movement of my component in X-Axis and Z-Axis.
I'm currently programmed some component (see attached), using C# and observed that my component is not stable if not press during run-time.
Can somebody have a look at my code and tell me whats wrong.
Thanks,
An important target to know is what your component must to do, or in other words, what should be the behaviour of your component.
You must to explain in order to adecuate the programming.
Other problem is if you use Models that are not in the default library, is hard to see nothing due the other users nothing see, and must imagine what should be the shape of the objects, then or you use standar models or you attach also the used.
Why you declare the 'Plane' component as not inmovable?, if the code must move it could be not a good idea to set as 'affected by gravity'.
Please explain.
I'm sorry for my not so good programming skill. :( :( :(
What I want to do is to move the Plane and the Box Unit together meaning they are join in X-axis movement.
But during Z-axis I only want to move the plane.
Example is Position 1,2,3,4,5 Plane and Box Unit is moving together in x-axis, but if I press the Advance or Reverse Button the Plane will only move.
Is it possible?
Can you please help me fix the code even if you use the available components in your library not the component that I send.
I will really appreciate it and will learn a lot after that fix.
Thank you.
I thought that if I set Plane component as not immovable the code works in Z-axis and yes it happened.
But now I know that its not a good idea.
OK, understood!
Then I think the code you need is very similar to this example used in this forum thread:
http://nirtec.com/forum/index.php?topic=329.0 (http://nirtec.com/forum/index.php?topic=329.0)
Hi,
Just a quick question base on the exampe you gave at this thread: http://nirtec.com/forum/index.php?topic=329.0
How you set the position of your Pusher_Virtual and Pusher_phys. Is it depends on the code or in the Position Setting in Machine Simulator Editor?
Thank you!
if you see the help about the available functions for the Translate method, is explained:
void Translate(int id, Vector3 value);
Description: Translate the box element with index 'id' to the 'value' position. The translation is relative to the component coordinates.
Example: Editor.Translate(2, new Vector3(0.6f, 1.5f, -3.6f));
Pay attention to the explanation: The translation is relative to the component coordinates.
This means that the final movement will be transformed to the final component position. This is very important, otherwise you can have a undesired effect, viewing that your component have a correct behavior if you place it in the World Zero coordinate (0,0,0) but if you place in another position the movements are not correct.
Then, the translate method automatically applies the necessary transformations in order to move the box correctly no matter where the component is placed by the user in the Editor.
Hope my explanation helps you!
Wow very well explained!!
Thank you so much, I'm learning a lot from you. ;D ;D ;D
Hi Again,
I'm currently studying how to rotate the models like conveyor did.
When I try the object like Conveyor Roller there is no problem my code works.
But when I try to change the object to Tube_O. It rotates in a way that I never expect. The rotation is like a windmill.( I'm using the code, I used in Conveyor Roller that I created.)
I thought there is no problem If I change the objects it that way.
Can you help me look at my code and tell me whats wrong.
Thanks!!
[attachment deleted by admin]
Hi Sorry I already created the correct one. I just change Editor.RotateX(1,rot); to Editor.RotateZ(1,rot);.
:) Great!
Hi EasyPLC_Master,
Can I ask for a copy of cmp file for elevator, because it's not available in my Components file.
I want to study how things works for it, also the code how it fits together.
Thank You!
I make a simple code it it goes like this (see attached)
Do you have any idea of making it more simpler.
[attachment deleted by admin]
The Elevator is not a UserDefinedComponent (belongs to the default system library), then not cmp file is available.
About your elevator (in general) seems me correct, but if you are not using orientation, better is to use the Translate function to move the elevator up & down.
void Translate(int id, Vector3 value);
Also some performance corrections can be done, see the attached file. Is better not to create always new Vector3 objects, and work directly with the Y component of the Vector.
[attachment deleted by admin]
Understand ;D..Thank you!
Hi Master,
I'm having a difficult time mixing my special effects to my moving component.
Can you help me with this one ( see attached file ).
Attached is the sample you gave which actually a moving component in 5 positions plus the advance and back position movement.
What i want as a sample is to put a water effects during the advance movement of the box and if i pressed the back movement the effects will not activate same as in the 5 position.
Meaning the special effect (water) will only activate if i pressed the advance button in PLC output.
Looking forward for your response.
Thank you!
[attachment deleted by admin]
In this thread you can find an example about how to attach a special effect to any component:
http://nirtec.com/forum/index.php?topic=329.0 (http://nirtec.com/forum/index.php?topic=329.0)
Do not hesitate to ask if you have more doubts!
Hi Master,
Yes that thread is more about special effects in machine editor, SpecialEffects.maq you gave.
But I want now is to build a sample like Solder Robot UserDefinedComponent in component editor.
I understand the concept of your sample in SpecialEffects.maq. But the Solder_Robot.cmp(attached) with special effects in component editor gave me a hard time.
If you can give me another sample it will be a good way to avoid confusion. This is what i like for better understanding,what i want as a sample is to put a water effects during the advance movement of the box and if i pressed the back movement the effect(water) will not activate same as in the 5 position.Please see attached (XandZaxis.cmp)
Meaning the special effect (water) will only activate if i pressed the advance button in PLC output.
Thank you for always enlighten my mind. :)
[attachment deleted by admin]
I do not understand is how the water must to move, dropping? from bottom to up?
Please explain how the water effect must to behave.
Hi Master,
Sorry for not clear information. What i want is the water effect to be joint in the box that is moving Advance and back.
And the effect of water is flowing ifthe PLC triggered the advance button only, if the back button is triggered the effect will not be activated.