本文整理汇总了C#中Curve.get_EndPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Curve.get_EndPoint方法的具体用法?C# Curve.get_EndPoint怎么用?C# Curve.get_EndPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Curve
的用法示例。
在下文中一共展示了Curve.get_EndPoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSimpleSweptSolid
/// <summary>
/// Creates a simple swept solid from a list of curve loops.
/// </summary>
/// <param name="exporterIFC">The exporter.</param>
/// <param name="profileName">The profile name.</param>
/// <param name="profileCurveLoops">The profile curve loops.</param>
/// <param name="normal">The normal of the plane that the path lies on.</param>
/// <param name="directrix">The path curve.</param>
/// <returns>The swept solid handle.</returns>
public static IFCAnyHandle CreateSimpleSweptSolid(ExporterIFC exporterIFC, string profileName, IList<CurveLoop> profileCurveLoops,
XYZ normal, Curve directrix)
{
// see definition of IfcSurfaceCurveSweptAreaSolid from
// http://www.buildingsmart-tech.org/ifc/IFC2x4/rc4/html/schema/ifcgeometricmodelresource/lexical/ifcsurfacecurvesweptareasolid.htm
IFCAnyHandle simpleSweptSolidHnd = null;
if (profileCurveLoops.Count == 0)
return simpleSweptSolidHnd;
IFCFile file = exporterIFC.GetFile();
XYZ startPoint = directrix.get_EndPoint(0);
XYZ profilePlaneNormal = null;
XYZ profilePlaneXDir = null;
XYZ profilePlaneYDir = null;
IFCAnyHandle curveHandle = null;
double startParam = 0, endParam = 1;
Plane scaledReferencePlane = null;
if (directrix is Line)
{
Line line = directrix as Line;
startParam = line.get_EndParameter(0);
endParam = line.get_EndParameter(1);
profilePlaneNormal = line.Direction;
profilePlaneYDir = normal;
profilePlaneXDir = profilePlaneNormal.CrossProduct(profilePlaneYDir);
XYZ linePlaneNormal = profilePlaneYDir;
XYZ linePlaneXDir = profilePlaneXDir;
XYZ linePlaneYDir = linePlaneNormal.CrossProduct(linePlaneXDir);
XYZ linePlaneOrig = startPoint;
scaledReferencePlane = GeometryUtil.CreateScaledPlane(exporterIFC, linePlaneXDir, linePlaneYDir, linePlaneOrig);
curveHandle = GeometryUtil.CreateLine(exporterIFC, line, scaledReferencePlane);
}
else if (directrix is Arc)
{
Arc arc = directrix as Arc;
startParam = MathUtil.PutInRange(arc.get_EndParameter(0), Math.PI, 2 * Math.PI) * (180 / Math.PI);
endParam = MathUtil.PutInRange(arc.get_EndParameter(1), Math.PI, 2 * Math.PI) * (180 / Math.PI);
profilePlaneNormal = directrix.ComputeDerivatives(0, true).BasisX;
profilePlaneXDir = (arc.Center - startPoint).Normalize();
profilePlaneYDir = profilePlaneNormal.CrossProduct(profilePlaneXDir).Normalize();
XYZ arcPlaneNormal = arc.Normal;
XYZ arcPlaneXDir = profilePlaneXDir;
XYZ arcPlaneYDir = arcPlaneNormal.CrossProduct(arcPlaneXDir);
XYZ arcPlaneOrig = startPoint;
scaledReferencePlane = GeometryUtil.CreateScaledPlane(exporterIFC, arcPlaneXDir, arcPlaneYDir, arcPlaneOrig);
curveHandle = GeometryUtil.CreateArc(exporterIFC, arc, scaledReferencePlane);
}
else
return simpleSweptSolidHnd;
IFCAnyHandle referencePlaneAxisHandle = ExporterUtil.CreateAxis(file, scaledReferencePlane.Origin, scaledReferencePlane.Normal, scaledReferencePlane.XVec);
IFCAnyHandle referencePlaneHandle = IFCInstanceExporter.CreatePlane(file, referencePlaneAxisHandle);
Plane profilePlane = new Plane(profilePlaneXDir, profilePlaneYDir, startPoint);
IList<CurveLoop> curveLoops = null;
try
{
// Check that curve loops are valid.
curveLoops = ExporterIFCUtils.ValidateCurveLoops(profileCurveLoops, profilePlaneNormal);
}
catch (Exception)
{
return null;
}
if (curveLoops == null || curveLoops.Count == 0)
return simpleSweptSolidHnd;
IFCAnyHandle sweptArea = ExtrusionExporter.CreateSweptArea(exporterIFC, profileName, curveLoops, profilePlane, profilePlaneNormal);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(sweptArea))
return simpleSweptSolidHnd;
profilePlane = GeometryUtil.GetScaledPlane(exporterIFC, profilePlane);
IFCAnyHandle solidAxis = ExporterUtil.CreateAxis(file, profilePlane.Origin, profilePlane.Normal, profilePlane.XVec);
simpleSweptSolidHnd = IFCInstanceExporter.CreateSurfaceCurveSweptAreaSolid(file, sweptArea, solidAxis, curveHandle, startParam,
endParam, referencePlaneHandle);
return simpleSweptSolidHnd;
}
示例2: CreateExtrudedSurfaceFromCurve
/// <summary>
/// Creates an extruded surface of type IfcSurfaceOfLinearExtrusion given a base 2D curve, a direction and a length.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC class.</param>
/// <param name="baseCurve">The curve to be extruded.</param>
/// <param name="extrusionDir">The direction of the extrusion.</param>
/// <param name="scaledExtrusionSize">The length of the extrusion, in IFC unit scale.</param>
/// <param name="unscaledBaseHeight">The Z value of the base level for the surface, in Revit unit scale.</param>
/// <returns>The extrusion handle.</returns>
/// <remarks>Note that scaledExtrusionSize and unscaledBaseHeight are in potentially different scaling units.</remarks>
public static IFCAnyHandle CreateExtrudedSurfaceFromCurve(ExporterIFC exporterIFC, Curve baseCurve, XYZ extrusionDir,
double scaledExtrusionSize, double unscaledBaseHeight)
{
IFCFile file = exporterIFC.GetFile();
Plane plane = new Plane(extrusionDir,XYZ.Zero);
// A list of IfcCurve entities.
IFCGeometryInfo info = IFCGeometryInfo.CreateCurveGeometryInfo(exporterIFC, plane, extrusionDir, true);
ExporterIFCUtils.CollectGeometryInfo(exporterIFC, info, baseCurve, XYZ.Zero, true);
IList<IFCAnyHandle> profileCurves = info.GetCurves();
if ((profileCurves.Count != 1) || (!IFCAnyHandleUtil.IsSubTypeOf(profileCurves[0], IFCEntityType.IfcBoundedCurve)))
return null;
IFCAnyHandle sweptCurve = IFCInstanceExporter.CreateArbitraryOpenProfileDef(file, IFCProfileType.Curve, null, profileCurves[0]);
XYZ oCurveOrig = baseCurve.get_EndPoint(0);
XYZ orig = (new XYZ(0.0, 0.0, oCurveOrig[2] - unscaledBaseHeight)) * exporterIFC.LinearScale;
IFCAnyHandle surfaceAxis = ExporterUtil.CreateAxis(file, orig, null, null);
IFCAnyHandle direction = ExporterUtil.CreateDirection(file, extrusionDir); // zDir
IFCAnyHandle surfOnRelatingElement = IFCInstanceExporter.CreateSurfaceOfLinearExtrusion(file, sweptCurve, surfaceAxis, direction, scaledExtrusionSize);
IFCAnyHandle extrudedSurfFromCurveHnd = IFCInstanceExporter.CreateConnectionSurfaceGeometry(file, surfOnRelatingElement, null);
return extrudedSurfFromCurveHnd;
}
示例3: Write
/// <summary>
/// Debugging aid.
/// </summary>
/// <param name="label"></param>
/// <param name="curve"></param>
protected void Write(String label, Curve curve)
{
if (m_writer == null)
m_writer = new StreamWriter(@"c:\Directions.txt");
XYZ start = curve.get_EndPoint(0);
XYZ end = curve.get_EndPoint(1);
m_writer.WriteLine(String.Format(label + " {0} {1}", XYZToString(start), XYZToString(end)));
}
示例4: GetNext
/// <summary>
/// Get the connected curve for current curve
/// </summary>
/// <param name="profile">a closed outline made by the selection of walls</param>
/// <param name="connected">current curve's end point</param>
/// <param name="line">current curve</param>
/// <returns>a appropriate curve for generate floor</returns>
private Curve GetNext(CurveArray profile, Autodesk.Revit.DB.XYZ connected, Curve line)
{
foreach (Curve c in profile)
{
if (c.Equals(line))
{
continue;
}
if ((Math.Abs(c.get_EndPoint(0).X - line.get_EndPoint(1).X) < PRECISION && Math.Abs(c.get_EndPoint(0).Y - line.get_EndPoint(1).Y) < PRECISION && Math.Abs(c.get_EndPoint(0).Z - line.get_EndPoint(1).Z) < PRECISION)
&& (Math.Abs(c.get_EndPoint(1).X - line.get_EndPoint(0).X) < PRECISION && Math.Abs(c.get_EndPoint(1).Y - line.get_EndPoint(0).Y) < PRECISION && Math.Abs(c.get_EndPoint(1).Z - line.get_EndPoint(0).Z) < PRECISION)
&& 2 != profile.Size)
{
continue;
}
if (Math.Abs(c.get_EndPoint(0).X - connected.X) < PRECISION && Math.Abs(c.get_EndPoint(0).Y - connected.Y) < PRECISION && Math.Abs(c.get_EndPoint(0).Z - connected.Z) < PRECISION)
{
return c;
}
else if (Math.Abs(c.get_EndPoint(1).X - connected.X) < PRECISION && Math.Abs(c.get_EndPoint(1).Y - connected.Y) < PRECISION && Math.Abs(c.get_EndPoint(1).Z - connected.Z) < PRECISION)
{
if (c.GetType().Name.Equals("Line"))
{
Autodesk.Revit.DB.XYZ start = c.get_EndPoint(1);
Autodesk.Revit.DB.XYZ end = c.get_EndPoint(0);
return m_creApp.NewLineBound(start, end);
}
else if (c.GetType().Name.Equals("Arc"))
{
int size = c.Tessellate().Count;
Autodesk.Revit.DB.XYZ start = c.Tessellate()[0];
Autodesk.Revit.DB.XYZ middle = c.Tessellate()[size / 2];
Autodesk.Revit.DB.XYZ end = c.Tessellate()[size];
return m_creApp.NewArc(start, end, middle);
}
}
}
throw new InvalidOperationException("The selected walls should be closed.");
}