General Category > Machines Simulator

Request for components

(1/1)

KCP_Robin:
Hello Master! Good day! May i have a copy of the .cmp of the Stopper on Box Discarding?? aside from the Stopper can i have any additional components that is not on default library?. Thank you very much! Especially that might help on making a Machine Simulator for packaging system.

EasyPLC_Master:
Hello!
The Stopper component in Box Discarding machine is not a User Defined Component, is a Static Element with some logic in the machine program.
If you click on it, see in the property box the Name property, you will see StaticElement. Now see the ID number is 23.
If you see the machine logic program (F9), you will see how the behaviour of this component is:


--- Code: ---if(IO.GetOutput(11))
  {
  if(rot1 > 90)
  {
  machine[23].body.DisableBody();
  rot1 -= speed * fTimeScale;
  if(rot1 < 90)
  { 
  rot1 = 90f;
  IO.SetInput(6, true);
  }
  matRotX = Matrix.CreateRotationX(MathHelper.ToRadians(rot1));
  Matrix worldMatrix = Matrix.CreateTranslation(0, 0.5f, 0) * matRotX * Matrix.CreateTranslation(0, 0.5f, 0);               
machine[23].body.Orientation = worldMatrix;
  }
  }
  else
  {
  if(rot1 < 180)
  {
  machine[23].body.DisableBody();
  rot1 += speed * fTimeScale;
  if(rot1 > 180) 
  rot1 = 180f;
  matRotX = Matrix.CreateRotationX(MathHelper.ToRadians(rot1));
  Matrix worldMatrix = Matrix.CreateTranslation(0, 0.5f, 0) * matRotX * Matrix.CreateTranslation(0, 0.5f, 0);               
machine[23].body.Orientation = worldMatrix;
IO.SetInput(6, false);
  }
  else
  machine[23].body.EnableBody();
  }
--- End code ---

This is other way to customize components, you can create User Defined Components if you need to reuse, or you can give special behaviour to standard components for special needs...

Hope this help you!

KCP_Robin:
Thank you master! how about the sensors? I cant seem to find it in components editor, and on the World editor I cant rotate it Upside down. just left and right.. thank you..

EasyPLC_Master:
What sensors do you mean?

The Inductive Switch can be placed Horizontal or Vertical (Location property). If is in Horizontal, you can rotate to to desired position.

Any way you can create sensors (switch, proximity detectors, opticals,...) elements using the following script funcitions for each component placed in the machine:


--- Code: ---PhysicObject WorkPartCollision();

Description: returns the PhysicObject from the WorkPartList that collides with the Component.
Example: PhysicObject searchPart = machine[1].WorkPartCollision();

PhysicObject WorkPartRayCol(Vector3 pos, Vector3 target);

Description: returns the PhysicObject from the WorkPartList that collides with the Component ray that has the origin in the 'pos' position and has a direction 'target'.
Example: PhysicObject searchPart = machine[1].WorkPartRayCol(box[1].body.Position, Vector3.Up);

PhysicObject WorkPartDistRayCol(Vector3 pos, Vector3 target, float distance);

Description: returns the PhysicObject from the WorkPartList that collides with the Component ray that has the origin in the 'pos' position, has a direction 'target' and the distance between the Component and the WorkPart it's less or equal that distance.
Example: PhysicObject searchPart = machine[0].WorkPartDistRayCol(machine[0].body.Position, machine[0].body.Orientation.Right, 0.5f);

List<PhysicObject> WorkPartCollisionList()

Description: returns all the PhysicObjects from the WorkPartList that collides with the Component.
Example: PhysicObjectList collisionPartList = machine[1].WorkPartCollisionList();

--- End code ---

Or User Defined Component:


--- Code: ---PhysicObject WorkPartCollision();

Description: returns the PhysicObject from the WorkPartList that collides with the PhysicObject.
Example: PhysicObject searchPart = box[1].WorkPartCollision();

PhysicObject WorkPartRayCol(Vector3 pos, Vector3 target);

Description: returns the PhysicObject from the WorkPartList that collides with the PhysicObject ray that has the origin in the 'pos' position and has a direction 'target'.
Example: PhysicObject searchPart = box[1].WorkPartRayCol(box[1].body.Position, Vector3.Up);

PhysicObject WorkPartDistRayCol(Vector3 pos, Vector3 target, float distance);

Description: returns the PhysicObject from the WorkPartList that collides with the PhysicObject ray that has the origin in the 'pos' position, has a direction 'target' and the distance between the PhysicObject and the WorkPart it's less or equal that distance.
Example: PhysicObject searchPart = box[0].WorkPartDistRayCol(box[0].body.Position, box[0].body.Orientation.Right, 0.5f);

List<PhysicObject> WorkPartCollisionList()

Description: returns all the PhysicObjects from the WorkPartList that collides with the PhysicObject.
Example: PhysicObjectList collisionPartList = box[1].WorkPartCollisionList();

--- End code ---

Navigation

[0] Message Index

Go to full version