本文整理汇总了C#中System.Line.get_EndPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Line.get_EndPoint方法的具体用法?C# Line.get_EndPoint怎么用?C# Line.get_EndPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Line
的用法示例。
在下文中一共展示了Line.get_EndPoint方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateLine
/// <summary>
/// Creates an IFC line from a Revit line object.
/// </summary>
/// <param name="exporterIFC">The exporter.</param>
/// <param name="line">The line.</param>
/// <param name="scaledPlane">The scaled plane.</param>
/// <returns>The line handle.</returns>
public static IFCAnyHandle CreateLine(ExporterIFC exporterIFC, Line line, Plane scaledPlane)
{
List<XYZ> points = new List<XYZ>();
points.Add(line.get_EndPoint(0));
points.Add(line.get_EndPoint(1));
return CreatePolyLineCommon(exporterIFC, points, scaledPlane);
}
示例2: ConvertTo2DLine
/// <summary>
/// use the X and Y coordinate of 3D Line to new a Line2D instance
/// </summary>
/// <param name="line">3D Line</param>
/// <returns>2D Line</returns>
private static Line2D ConvertTo2DLine(Line line)
{
PointF pnt1 = new PointF((float)line.get_EndPoint(0).X, (float)line.get_EndPoint(0).Y);
PointF pnt2 = new PointF((float)line.get_EndPoint(1).X, (float)line.get_EndPoint(1).Y);
return new Line2D(pnt1, pnt2);
}
示例3: IsVertical
/// <param name="face"></param>
/// <param name="line"></param>
/// <returns>return true when line is perpendicular to the face</returns>
/// <summary>
/// Judge whether the line is perpendicular to the face
/// </summary>
/// <param name="face">the face reference</param>
/// <param name="line">the line reference</param>
/// <param name="faceTrans">the transform for the face</param>
/// <param name="lineTrans">the transform for the line</param>
/// <returns>true if line is perpendicular to the face, otherwise false</returns>
public static bool IsVertical(Face face, Line line,
Transform faceTrans, Transform lineTrans)
{
//get points which the face contains
List<XYZ> points = face.Triangulate().Vertices as List<XYZ>;
if (3 > points.Count) // face's point number should be above 2
{
return false;
}
// get three points from the face points
Autodesk.Revit.DB.XYZ first = points[0];
Autodesk.Revit.DB.XYZ second = points[1];
Autodesk.Revit.DB.XYZ third = points[2];
// get start and end point of line
Autodesk.Revit.DB.XYZ lineStart = line.get_EndPoint(0);
Autodesk.Revit.DB.XYZ lineEnd = line.get_EndPoint(1);
// transForm the three points if necessary
if (null != faceTrans)
{
first = TransformPoint(first, faceTrans);
second = TransformPoint(second, faceTrans);
third = TransformPoint(third, faceTrans);
}
// transform the start and end points if necessary
if (null != lineTrans)
{
lineStart = TransformPoint(lineStart, lineTrans);
lineEnd = TransformPoint(lineEnd, lineTrans);
}
// form two vectors from the face and a vector stand for the line
// Use SubXYZ() method to get the vectors
Autodesk.Revit.DB.XYZ vector1 = SubXYZ(first, second); // first vector of face
Autodesk.Revit.DB.XYZ vector2 = SubXYZ(first, third); // second vector of face
Autodesk.Revit.DB.XYZ vector3 = SubXYZ(lineStart, lineEnd); // line vector
// get two dot products of the face vectors and line vector
double result1 = DotMatrix(vector1, vector3);
double result2 = DotMatrix(vector2, vector3);
// if two dot products are all zero, the line is perpendicular to the face
return (IsEqual(result1, 0) && IsEqual(result2, 0));
}
示例4: NewSketchPlanePassLine
/// <summary>
/// Create a Sketch Plane which pass the defined line
/// the defined line must be one of BoundingBox Profile
/// </summary>
/// <param name="app">Application get from RevitAPI</param>
/// <param name="aline">a line which sketch plane pass</param>
private SketchPlane NewSketchPlanePassLine(Line aline, UIApplication app)
{
//in a cube only
Autodesk.Revit.DB.XYZ norm;
if (aline.get_EndPoint(0).X == aline.get_EndPoint(1).X)
{
norm = new Autodesk.Revit.DB.XYZ (1, 0, 0);
}
else if (aline.get_EndPoint(0).Y == aline.get_EndPoint(1).Y)
{
norm = new Autodesk.Revit.DB.XYZ (0, 1, 0);
}
else
{
norm = new Autodesk.Revit.DB.XYZ (0, 0, 1);
}
Autodesk.Revit.DB.XYZ point = aline.get_EndPoint(0);
Plane plane = app.Application.Create.NewPlane(norm, point);
SketchPlane sketchPlane = app.ActiveUIDocument.Document.Create.NewSketchPlane(plane);
return sketchPlane;
}
示例5: Obstructions
/// <summary>
/// Return all the obstructions which intersect with a bound line.
/// </summary>
/// <param name="boundLine">Bound line</param>
/// <returns>Obstructions intersected with the bound line</returns>
public List<ReferenceWithContext> Obstructions(Line boundLine)
{
List<ReferenceWithContext> result = new List<ReferenceWithContext>();
Autodesk.Revit.DB.XYZ startPt = boundLine.get_EndPoint(0);
Autodesk.Revit.DB.XYZ endPt = boundLine.get_EndPoint(1);
Autodesk.Revit.DB.XYZ dir = (endPt - startPt).Normalize();
IList<ReferenceWithContext> obstructionsOnUnboundLine = m_rvtDoc.FindReferencesWithContextByDirection(startPt, dir, m_view3d);
foreach (ReferenceWithContext gRefWithContext in obstructionsOnUnboundLine)
{
Reference gRef = gRefWithContext.GetReference();
// Judge whether the point is in the bound line or not, if the distance between the point and line
// is Zero, then the point is in the bound line.
if (boundLine.Distance(gRef.GlobalPoint) < 1e-9 &&
gRef.ElementReferenceType == ElementReferenceType.REFERENCE_TYPE_SURFACE)
{
if (!InArray(result, gRefWithContext))
{
result.Add(gRefWithContext);
}
}
}
result.Sort(CompareReferencesWithContext);
return result;
}
示例6: LogWallCurve
/// <summary>
/// Dump wall's curve(end points) to log
/// </summary>
/// <param name="wallCurve">Wall curve to be dumped.</param>
private void LogWallCurve(Line wallCurve)
{
Debug.WriteLine("Wall curve is line: ");
Debug.WriteLine("Start point: " + XYZToString(wallCurve.get_EndPoint(0)));
Debug.WriteLine("End point: " + XYZToString(wallCurve.get_EndPoint(1)));
}