Rail3D*


 


A pair of scripts adapted from Mark Hodson's 10 Degree Points, allowing the user to specify the point geometry in the form of Crossing Rate and Curve Radius. The Crossing Rate is the reciprocal of the angle of the rails when they cross, in radians - a rate of "8" corresponds to an angle of "1/8 radians". The Curve Radius is the radius of the curve used for the points. The scripts could be modified to take a crossing angle in degrees, or a set of scripts of specific geometries could be made.

The following tables give some prototypical values for geometries.

Radius  Rate  km/h  mph
190     7    35    20
250    8.25 40    25
300    9   45    30
500    12    60    40
800    15    75    45
1200    18.5  85    50

(http://extranet.artc.com.au/docs/eng/track-civil/procedures/pc/Section3.pdf)

Radius  Rate   km/h  mph
141     7     30    20
184   7     30    20
246   9.25  40    25
332    10.75 50    30
645    15    65    40
981    18.5   80    50
1264    21     95    60
1650    24    115   70
3000    32.365 145   90

(http://www.ihsti.com/NoRCS/%2815pu2kmrgjfayk55acezfnna%29/docs/BRAFAS01/DEPT/ELEC%20PUB/NETWORK_RAIL/NR_COMPLETED/DOCS/L2TRK2049.PDF)


 

Right Hand

// Script to create a custom right hand point

Init()
{
  node mNode=Document.GetCurrentNode();
  node Node1=mNode.GetConnectedNode(0,0);
  node Node2=mNode.GetConnectedNode(1,0);

  float x=mNode.GetX();
  float y=mNode.GetY();
  float z=mNode.GetZ();
  float alpha=mNode.GetAlpha();

  float xb=Node2.GetX();

  if(xb==0)  // Which way to go?
  {
    alpha=3.1417+alpha;
  }

  float angleInput=InputFloat("Crossing Angle, 1 in x");
  float radius=InputFloat("Curve Radius, m");
 
  float angle=1.0/angleInput;

  // Some useful(?) numbers
  float gauge=1.435;  // Std gauge++
  float TrackSpace=Document.GetLineSpacing();
 
  // Hypotenuse to Adjacent
  float length=(gauge/tan(angle))*2.0;

  float alpha2=alpha+angle;

  // Calc position of furthest end
  float x2=x+(length*sin(alpha));
  float y2=y+(length*cos(alpha));

  // Centre
  float xc=x+((length/2.0)*sin(alpha));
  float yc=y+((length/2.0)*cos(alpha));


  // Calc position of left leg
  float x3=xc+((length/2.0)*sin(alpha2));
  float y3=yc+((length/2.0)*cos(alpha2));

  // Calc position of right leg
  float x4=xc-((length/2.0)*sin(alpha2));
  float y4=yc-((length/2.0)*cos(alpha2));

  // Extensions for required track spacing
  float remainingSpace=(TrackSpace/2.0)-gauge;
  float SpaceLength=remainingSpace/tan(angle);

  x2=x2+(SpaceLength*sin(alpha));
  y2=y2+(SpaceLength*cos(alpha));

  x3=x3+(SpaceLength*sin(alpha2));
  y3=y3+(SpaceLength*cos(alpha2));

  // Build links
  Document.BuildLink(x,y,z,x2,y2,z);
  Document.BuildLink(x4,y4,z,x3,y3,z);
  Document.BuildLink(x,y,z,x3,y3,z);
  Document.DeleteNode(x4,y4);

  // Calc position from new ends
  float xs=x2+(SpaceLength*sin(alpha));
  float ys=y2+(SpaceLength*cos(alpha));
  Document.BuildLink(x2,y2,z,xs,ys,z);

  xs=x3+(SpaceLength*sin(alpha2));
  ys=y3+(SpaceLength*cos(alpha2));
  Document.BuildLink(x3,y3,z,xs,ys,z);
}

 

Left Hand

// Script to create a custom lefthand point

Init()
{
  node mNode=Document.GetCurrentNode();
  node Node1=mNode.GetConnectedNode(0,0);
  node Node2=mNode.GetConnectedNode(1,0);

  float x=mNode.GetX();
  float y=mNode.GetY();
  float z=mNode.GetZ();
  float alpha=mNode.GetAlpha();

  float xb=Node2.GetX();

  if(xb==0)  // Which way to go?
  {
    alpha=3.1417+alpha;
  }

  float angleInput=InputFloat("Crossing Angle, 1 in x");
  float radius=InputFloat("Curve Radius, m");
 
  float angle=1.0/angleInput;

  // Some useful(?) numbers
  float gauge=1.435;  // Std gauge++
  float TrackSpace=Document.GetLineSpacing();
 
  // Hypotenuse to Adjacent
  float length=(gauge/tan(angle))*2.0;

  float alpha2=alpha-angle;

  // Calc position of furthest end
  float x2=x+(length*sin(alpha));
  float y2=y+(length*cos(alpha));

  // Centre
  float xc=x+((length/2.0)*sin(alpha));
  float yc=y+((length/2.0)*cos(alpha));


  // Calc position of left leg
  float x3=xc+((length/2.0)*sin(alpha2));
  float y3=yc+((length/2.0)*cos(alpha2));

  // Calc position of right leg
  float x4=xc-((length/2.0)*sin(alpha2));
  float y4=yc-((length/2.0)*cos(alpha2));

  // Extensions for required track spacing
  float remainingSpace=(TrackSpace/2.0)-gauge;
  float SpaceLength=remainingSpace/tan(angle);

  x2=x2+(SpaceLength*sin(alpha));
  y2=y2+(SpaceLength*cos(alpha));

  x3=x3+(SpaceLength*sin(alpha2));
  y3=y3+(SpaceLength*cos(alpha2));

  // Build links
  Document.BuildLink(x,y,z,x2,y2,z);
  Document.BuildLink(x4,y4,z,x3,y3,z);
  Document.BuildLink(x,y,z,x3,y3,z);
  Document.DeleteNode(x4,y4);

  // Calc position from new ends
  float xs=x2+(SpaceLength*sin(alpha));
  float ys=y2+(SpaceLength*cos(alpha));
  Document.BuildLink(x2,y2,z,xs,ys,z);

  xs=x3+(SpaceLength*sin(alpha2));
  ys=y3+(SpaceLength*cos(alpha2));
  Document.BuildLink(x3,y3,z,xs,ys,z);
}
// Script to create a custom right hand point

Init()
{
  node mNode=Document.GetCurrentNode();
  node Node1=mNode.GetConnectedNode(0,0);
  node Node2=mNode.GetConnectedNode(1,0);

  float x=mNode.GetX();
  float y=mNode.GetY();
  float z=mNode.GetZ();
  float alpha=mNode.GetAlpha();

  float xb=Node2.GetX();

  if(xb==0)  // Which way to go?
  {
    alpha=3.1417+alpha;
  }

  float angleInput=InputFloat("Crossing Angle, 1 in x");
  float radius=InputFloat("Curve Radius, m");
 
  float angle=1.0/angleInput;

  // Some useful(?) numbers
  float gauge=1.435;  // Std gauge++
  float TrackSpace=Document.GetLineSpacing();
 
  // Hypotenuse to Adjacent
  float length=(gauge/tan(angle))*2.0;

  float alpha2=alpha+angle;

  // Calc position of furthest end
  float x2=x+(length*sin(alpha));
  float y2=y+(length*cos(alpha));

  // Centre
  float xc=x+((length/2.0)*sin(alpha));
  float yc=y+((length/2.0)*cos(alpha));


  // Calc position of left leg
  float x3=xc+((length/2.0)*sin(alpha2));
  float y3=yc+((length/2.0)*cos(alpha2));

  // Calc position of right leg
  float x4=xc-((length/2.0)*sin(alpha2));
  float y4=yc-((length/2.0)*cos(alpha2));

  // Extensions for required track spacing
  float remainingSpace=(TrackSpace/2.0)-gauge;
  float SpaceLength=remainingSpace/tan(angle);

  x2=x2+(SpaceLength*sin(alpha));
  y2=y2+(SpaceLength*cos(alpha));

  x3=x3+(SpaceLength*sin(alpha2));
  y3=y3+(SpaceLength*cos(alpha2));

  // Build links
  Document.BuildLink(x,y,z,x2,y2,z);
  Document.BuildLink(x4,y4,z,x3,y3,z);
  Document.BuildLink(x,y,z,x3,y3,z);
  Document.DeleteNode(x4,y4);

  // Calc position from new ends
  float xs=x2+(SpaceLength*sin(alpha));
  float ys=y2+(SpaceLength*cos(alpha));
  Document.BuildLink(x2,y2,z,xs,ys,z);

  xs=x3+(SpaceLength*sin(alpha2));
  ys=y3+(SpaceLength*cos(alpha2));
  Document.BuildLink(x3,y3,z,xs,ys,z);
}

DanielEvans 30/09/2015 18:13:36