本文整理汇总了C#中Autodesk.GetEndPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Autodesk.GetEndPoint方法的具体用法?C# Autodesk.GetEndPoint怎么用?C# Autodesk.GetEndPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autodesk
的用法示例。
在下文中一共展示了Autodesk.GetEndPoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCreationData
private static FamilyInstanceCreationData GetCreationData(Autodesk.Revit.DB.Curve curve, Autodesk.Revit.DB.XYZ upVector, Autodesk.Revit.DB.Level level, Autodesk.Revit.DB.Structure.StructuralType structuralType, Autodesk.Revit.DB.FamilySymbol symbol)
{
//calculate the desired rotation
//we do this by finding the angle between the z axis
//and vector between the start of the beam and the target point
//both projected onto the start plane of the beam.
var zAxis = new XYZ(0, 0, 1);
var yAxis = new XYZ(0, 1, 0);
//flatten the beam line onto the XZ plane
//using the start's z coordinate
var start = curve.GetEndPoint(0);
var end = curve.GetEndPoint(1);
var newEnd = new XYZ(end.X, end.Y, start.Z); //drop end point to plane
//catch the case where the end is directly above
//the start, creating a normal with zero length
//in that case, use the Z axis
XYZ planeNormal = newEnd.IsAlmostEqualTo(start) ? zAxis : (newEnd - start).Normalize();
double gamma = upVector.AngleOnPlaneTo(zAxis.IsAlmostEqualTo(planeNormal) ? yAxis : zAxis, planeNormal);
return new FamilyInstanceCreationData(curve, symbol, level, structuralType)
{
RotateAngle = gamma
};
}
示例2: NewSketchPlaneFromCurve
/// <summary>
/// Creates a new Sketch Plane from a Curve
/// </summary>
/// <param name="document">Active Document</param>
/// <param name="curve">Curve to get plane from</param>
/// <returns>Plane of the curve</returns>
public static SketchPlane NewSketchPlaneFromCurve(Document document, Autodesk.Revit.DB.Curve curve)
{
XYZ startPoint = curve.GetEndPoint(0);
XYZ endPoint = curve.GetEndPoint(1);
// If Start end Endpoint are the same check further points.
int i = 2;
while (startPoint == endPoint && endPoint != null)
{
endPoint = curve.GetEndPoint(i);
i++;
}
// Plane to return
Plane plane;
// If Z Values are equal the Plane is XY
if (startPoint.Z == endPoint.Z)
{
plane = document.Application.Create.NewPlane(XYZ.BasisZ, startPoint);
}
// If X Values are equal the Plane is YZ
else if (startPoint.X == endPoint.X)
{
plane = document.Application.Create.NewPlane(XYZ.BasisX, startPoint);
}
// If Y Values are equal the Plane is XZ
else if (startPoint.Y == endPoint.Y)
{
plane = document.Application.Create.NewPlane(XYZ.BasisY, startPoint);
}
// Otherwise the Planes Normal Vector is not X,Y or Z.
// We draw lines from the Origin to each Point and use the Plane this one spans up.
else
{
CurveArray curves = new CurveArray();
curves.Append(curve);
curves.Append(Autodesk.Revit.DB.Line.CreateBound(new XYZ(0, 0, 0), startPoint));
curves.Append(Autodesk.Revit.DB.Line.CreateBound(endPoint, new XYZ(0, 0, 0)));
plane = document.Application.Create.NewPlane(curves);
}
// return new Sketchplane
return SketchPlane.Create(document, plane);
}
示例3: CreateReversedCurve
/// <summary>
/// Create a new curve with the same
/// geometry in the reverse direction.
/// rom Jeremy Tammik
/// </summary>
/// <param name="orig">The original curve.</param>
/// <returns>The reversed curve.</returns>
/// <throws cref="NotImplementedException">If the
/// curve type is not supported by this utility.</throws>
static Autodesk.Revit.DB.Curve CreateReversedCurve(Autodesk.Revit.DB.Curve orig)
{
if (orig is Autodesk.Revit.DB.Line)
{
return Autodesk.Revit.DB.Line.CreateBound(
orig.GetEndPoint(1),
orig.GetEndPoint(0));
}
else if (orig is Autodesk.Revit.DB.Arc)
{
return Autodesk.Revit.DB.Arc.Create(orig.GetEndPoint(1),
orig.GetEndPoint(0),
orig.Evaluate(0.5, true));
}
else
{
throw new Exception(
"CreateReversedCurve - Unreachable");
}
}
示例4: Convert
private static Autodesk.DesignScript.Geometry.Line Convert(Autodesk.Revit.DB.Line crv)
{
return Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(
crv.GetEndPoint(0).ToPoint(), crv.GetEndPoint(1).ToPoint());
}