Nirtec Studio Forum

General Category => Machines Simulator => Topic started by: KCP_Robin on May 19, 2015, 10:30:28 AM

Title: Help with Codes
Post by: KCP_Robin on May 19, 2015, 10:30:28 AM
 hello everyone!
:'( I have Model_1(Base) and Model_2(advance/reverse)... What I'm trying to Achieve is , Model_2 is on top of Model_1 so that when Model_1(Base) moves, Model_2 will follow,
Model_1 can move on X_axis but cannot move on Z_axis and Model_2 can move on Z_axis..

I'm using the Wagon2 code (provided by admin on previous post) for base positioning..

Thank You in advance!!!!

[attachment deleted by admin]
Title: Re: Help with Codes
Post by: EasyPLC_Master on May 19, 2015, 12:17:09 PM
I'm think you want that Model 2 will be joined to Model1 and move in X axis with it, but also be able to move (inside the dimension of Model1) in Z axis, is it correct?.
Then is some similar to the behaviour of some components like the Robots (Scara and 3,4,5 degrees types) and also more similar to the Vertical Gantry Component. I recommend you to take a look to these components as example.
Title: Re: Help with Codes
Post by: KCP_Robin on May 19, 2015, 03:48:51 PM
Can I have the Commented codes for me to study?? Thank you in advance..
Title: Re: Help with Codes
Post by: KCP_Robin on May 21, 2015, 08:31:16 AM
attached is the cmp.
i have the base which moves on X_axis .. and I want the machine_1 to move Z-Axis through "Advance/Reverse" Button...
thank you very much...

[attachment deleted by admin]
Title: Re: Help with Codes
Post by: EasyPLC_Master on May 21, 2015, 03:29:00 PM
An important issue is: what do you want to do with the machine_1 component?, I mean the behaviour.
Must to push workparts? or must to transport along the X-Z axis???, this is very important to know in order what programming strategy to choose.
Also the models used by your component are not included in the example, then I can not make an idea about how to move or how it will look.
Other important item is about the model positioning, is useful is the component is static and not is moved, but in the case the component have to move, the model position must be always 0, otherwise you will be experiment problems in the 3D moving transformations.
Then I recomend you, the models you import in Machines Simulator have always the coordinate reference in the middle of the moving center.
Title: Re: Help with Codes
Post by: KCP_Robin on May 25, 2015, 03:59:31 AM
Sorry for the late reply,
machine_1 is used to transport machine_2 on 5 positions X-axis only (which is already set) , if machine_1 is in the desired  position, machine_2 will  "advance" if pushbutton1 is pressed  to fill something then "reverse" if pushbutton2  is pressed it will retract going to the original position..
then user will again pick where machine_1 will move to next position to fill ..

Summary: machine_1 - used to position machine_2 on X-Axis
                machine_2 - used to fill tanks, has a conveyor connected to machine_1 to move "advance/reverse"


need help on: Proper Joints? (if needed)
                     codes for "advance and reverse" Z- axis

Title: Re: Help with Codes
Post by: EasyPLC_Master on May 28, 2015, 04:01:43 PM
Hello!
Here is attached an example, the component modified and one installation showing how it works.

Notes:
- See that I have used standar box models.

- The physics system can not be changed directly, then if you want to move an object, you must to move by code and attach (adding a joint) other body that will be the one that interactuate with the physics system.

[attachment deleted by admin]
Title: Re: Help with Codes
Post by: KCP_Robin on May 29, 2015, 03:13:15 AM
Thank you .. such a big help.. :)  ;D
Title: Re: Help with Codes
Post by: KCP-KIMUEL on June 26, 2015, 07:13:28 AM
Hi Master,

Good day! I just want to ask if I can bind my Special effects to my moving object in machine editor. I mean the special effects that can be located in Components field.
What I want to happen is for example,if  I move my object the special effects object will also move at the same time.
As observed in the machine editor joint list is not available unlike in components editor, that's why I cant think for alternative solution.

Looking forward for your response master. Thank you!!
Title: Re: Help with Codes
Post by: EasyPLC_Master on June 26, 2015, 05:56:31 PM
Hello;

Of course is possible, for example take a look to the Solder Robot UserDefinedComponent, there is used the FirexFX to simulate the sparks in the soldering process.
Here is attached an example how to call the Special FX components from code and how to attach to any component.
Also take a look at the Tools Tab at the code Window (press F9 in the main screen) there you have examples about programming and how to use these components.

[attachment deleted by admin]
Title: Re: Help with Codes
Post by: KCP-KIMUEL on July 01, 2015, 07:40:01 AM
Hi Master,

I try to do the same example, but my effect (waterFX) is not attached to the component while it's moving.
What's wrong with my code. See attached!

Thanks,

[attachment deleted by admin]
Title: Re: Help with Codes
Post by: EasyPLC_Master on July 01, 2015, 10:04:33 AM
In order to do as you need, you must to modify the UserDefinedComponent to attach the WaterFX component to the moving box.
Here is attached a possible solution

[attachment deleted by admin]
Title: Re: Help with Codes
Post by: KCP-KIMUEL on July 03, 2015, 05:47:51 AM
Hi Master,

Just a quick question. I added a model in my component file then change its texture.
After that I used the joint list property to merge it with my moving component, then I run my component unfortunately the model disappear.
I think there something wrong with my joint list. can you have a look?

See attached file.

Thank you as always!

[attachment deleted by admin]
Title: Re: Help with Codes
Post by: EasyPLC_Master on July 03, 2015, 09:23:55 AM
You made a mistake with negative Mass, rotation and box scale.
Here is corrected ;)

[attachment deleted by admin]
Title: Re: Help with Codes
Post by: KCP-KIMUEL on July 03, 2015, 11:01:40 AM
thank you master!!  ;D ;D
Title: Re: Help with Codes
Post by: KCP-KIMUEL on July 06, 2015, 05:39:58 AM
Hi Master,

I'm in the process now of modifying my machine and I'm asking your help for some of coding stuff which I can't imagine how to do. :-[
What I want to do now is to lock my device in every position when the advance and back PLC output is triggered.
Is it possible to have a PLC output "LOCK" and if it is triggered it will do the stuff that i want.
Please see attached sample file.

[attachment deleted by admin]
Title: Re: Help with Codes
Post by: EasyPLC_Master on July 06, 2015, 08:51:03 AM
Sorry, but this is very simple and I'm sure you will be able to do it, if you spend a little time on it !!!
Title: Re: Help with Codes
Post by: KCP-KIMUEL on July 06, 2015, 11:55:47 AM
Now I understand why you said it was simple. ;D ;D
Thank you master!