Line from Points Feature

  • LinePt()

Properties
  • Name: Allows the feature to be named; for example, "TableTopLines"

  • Operation: agc.Add for 'Add Material' (default if not specified) and agc.Frozen for 'Add Frozen'

Functions
  • AddSegment(Pt, Pt, ID, x, y, z): Adds a segment to the Line feature, and optionally sets its ID and alignment. The ID and alignment are optional arguments. To supply the alignment, an ID must be supplied. However, if the ID is zero, it will not be used. If during the creation of this feature this segment is split into multiple edges, each will get the specified ID and/or alignment, if specified.

  • GetNumBodies(): This can only be used after a Line feature is created and Regen called. Gets the number of Line bodies created from the feature. This may not be the same as the number of segments added. It depends on how many segments are connected, or intersect, and if segments connect with segments from other Line features. Because of this the number can range from 0 to the number of segments added.

  • GetBody(index): This can only be used after a Line feature is created and Regen called. This is called with a value of 1 to the number returned by GetNumBodies.

  • GetNumEdges(): This can only be used after a Line feature is created and Regen called. Gets the number of Line edges created from the feature. This may not be the same as the number of segments added. It depends on how many segments intersect other edges (this can create additional edges), and if segments overlap existing edges. A segment that totally overlaps an existing edge will not create any edge. Because of this the number can range from 0 to more than number of segments added.

  • GetEdge(index): This can only be used after a Line feature is created and Regen called. This is called with a value of 1 to the number returned by GetNumEdges.


Note:  Using an ID in "AddSegment" and then the selection function "AddSelectEdgeID" provides for much more reliable selections!


Line Body Function
  • SetCrossSection(cs): Assigns the Cross Section (cs) to the Line Body

The Line from Points feature can be created from existing points. These must be points defined by the Point feature. Naming it is optional. This feature can be created by either using AddSegment calls after creation function, LinePt(), or by putting the points in the selection list before calling LinePt(). If you put the points in the selection list first, via agb.AddSelect(agc.TypeFPoint, point), where GetPoint is used to get the point, there are two restrictions.

First, this method does not allow you to set the alignment vector. Second, a point can only be in the select list once, so this cannot be used if you need to use a point more than once. With either method, the feature is not complete until you issue the Regen() command.

Example
  var PF1 = agb.FPoint(agc.FPointConstruction, agc.FPointCoordinateFile);  //Creates basic feature
	PF1.Name = "TablePoints";  //This is not required
	PF1.CoordinateFile = "D:\\Samples\\Table.txt";
	agb.Regen();	//Feature not complete until this is done

	var LF1 = agb.LinePt();	//Creates basic feature
	LF1.Name = "TableTop";
	LF1.AddSegment(PF1.GetPoint(1, 1), PF1.GetPoint(1, 2));
	LF1.AddSegment(PF1.GetPoint(1, 2), PF1.GetPoint(1, 3));
	LF1.AddSegment(PF1.GetPoint(1, 3), PF1.GetPoint(1, 4));
	LF1.AddSegment(PF1.GetPoint(1, 4), PF1.GetPoint(1, 1));
	agb.Regen();	//Feature not complete until this is done

	var LF2 = agb.LinePt();
	LF2.Name = "TableLegs";
	LF2.Operation = agc.Frozen;	//Sets the Material property to Add Frozen
	//The following commands also set the alignment for the created edges
	//The zero value for the ID is because it is not used here
	LF2.AddSegment(PF1.GetPoint(1, 1), PF1.GetPoint(2, 1), 0, 1.0, 0.0, 0.0);
	LF2.AddSegment(PF1.GetPoint(1, 2), PF1.GetPoint(2, 2), 0, 0.0, 1.0, 0.0);
	LF2.AddSegment(PF1.GetPoint(1, 3), PF1.GetPoint(2, 3), 0, -1.0, 0.0, 0.0);
	LF2.AddSegment(PF1.GetPoint(1, 4), PF1.GetPoint(2, 4), 0, 0.0, -1.0, 0.0);
	agb.Regen();	//Feature not complete until this is done

	//Create Cross Section
	var CS1 = agb.CSRect(6.0, 4.5);  //Creates rectangular Cross Section 6 units wide by 4.5 units high
	var CS2 = agb.CSLSection(4.0, 4.0, 0.5, 0.5);  //Creates L section Cross Section

	//Assign Cross Section to Line Bodies created
	var num = LF1.GetNumBodies();
	var i;
	var body;
	for(i=1; i<= num; i++)
	{
	    body = LF1.GetBody(i);
	    if(body)
	        body.SetCrossSection(CS1);
	}
	num = LF2.GetNumBodies();
	for(i=1; i<= num; i++)
	{
	    body = LF2.GetBody(i);
	    if(body)
	        body.SetCrossSection(CS2);
	}