Nirtec Studio Forum

General Category => Machines Simulator => Topic started by: fredz0003 on May 09, 2012, 02:45:44 PM

Title: Light Curtain Help
Post by: fredz0003 on May 09, 2012, 02:45:44 PM
Hi everyone I am in need of some assistance I don't know where to start I would like to make a light curtain to detect height in boxes, http://www.stiscanners.com/measuring_light_curtains/valuscan_VS6500.html
I just don't know how to do it, all I will need is an analog output based on the height of the box. Any help is greatly appreciated.   :D

[attachment deleted by admin]
Title: Re: Light Curtain Help
Post by: fredz0003 on May 09, 2012, 11:32:22 PM
If is not too much to ask, if it can be added to the distribution boxes advanced machine, and have random heights of boxes come out of the conveyor.
Title: Re: Light Curtain Help
Post by: EasyPLC_Master on May 10, 2012, 01:07:00 AM
Is not difficult, you can create a UserDefinedComponent with two boxes (one for each curtain column).
You can add red lines or a red plane to simulate the light between each curtain column (only for visual porpoise).

You can add a code in the Main Method like this:

// The box with id 0 will be the scanning unit located at the left
int wp = Editor.WorkPartDistRayColId(0, box[0].body.Position, new Vector3(1,0,0), 0.5f);
// This function returns the WorkPart Id number that collides with a Ray from the 0 id box component,
// with box[0] position, the target is right direction and the distance is equal or lower than 0.5.

if(wp > -1)
{
    TmpMoveItem bx = (TmpMoveItem)WorkPartListF[wp];
    // if a workpart is detected the size variable will contain the size of the workpart:
    Vector3 size = bx.Scale;
}