本文整理汇总了C#中CurveArray.get_Item方法的典型用法代码示例。如果您正苦于以下问题:C# CurveArray.get_Item方法的具体用法?C# CurveArray.get_Item怎么用?C# CurveArray.get_Item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CurveArray
的用法示例。
在下文中一共展示了CurveArray.get_Item方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsRectangular
const double PRECISION = 0.00001; //precision when judge whether two doubles are equal
#endregion Fields
#region Methods
/// <summary>
/// judge whether given 4 lines can form a rectangular
/// </summary>
/// <param name="lines"></param>
/// <returns>is rectangular</returns>
/// <summary>
/// judge whether given 4 lines can form a rectangular
/// </summary>
/// <param name="lines"></param>
/// <returns>is rectangular</returns>
public static bool IsRectangular(CurveArray curves)
{
if (curves.Size != 4)
{
return false;
}
Line[] lines = new Line[4];
for (int i = 0; i < 4; i++)
{
lines[i] = curves.get_Item(i) as Line;
if (null == lines[i])
{
return false;
}
}
Line iniLine = lines[0];
Line[] verticalLines = new Line[2];
Line paraLine = null;
int index = 0;
for (int i = 1; i < 4; i++)
{
if (IsVertical(lines[0], lines[i]))
{
verticalLines[index] = lines[i];
index++;
}
else
{
paraLine = lines[i];
}
}
if (index != 2)
{
return false;
}
bool flag = IsVertical(paraLine, verticalLines[0]);
return flag;
}
示例2: AddInlaidCurves
/// <summary>
/// create CurveArray which contain 8 curves, 4 is exterior lines and 4 is interior lines
/// </summary>
/// <param name="curves"></param>
/// <param name="scale"></param>
/// <returns></returns>
private CurveArray AddInlaidCurves(CurveArray curves, double scale)
{
//because curves is readonly, can't use method Curve.Append(Curve)
List<Line> lines = new List<Line>();
for (int i = 0; i < 4; i++)
{
Line temp = curves.get_Item(i) as Line;
lines.Add(temp);
}
//length and width of the rectangle
double length = GeomUtil.GetLength(lines[0]);
double width = GeomUtil.GetLength(lines[1]);
for (int i = 0; i < 2; i++)
{
//height line
Line tempLine1 = lines[i * 2];
Line scaledLine1 = GeomUtil.GetScaledLine(tempLine1, scale);
double distance1 = scale / 2 * width;
Line movedLine1 = GeomUtil.GetXYParallelLine(scaledLine1, distance1);
lines.Add(movedLine1);
//width line
Line tempLine2 = lines[i * 2 + 1];
Line scaledLine2 = GeomUtil.GetScaledLine(tempLine2, scale);
double distance2 = scale / 2 * length;
Line movedLine2 = GeomUtil.GetXYParallelLine(scaledLine2, distance2);
lines.Add(movedLine2);
}
//add all 8 lines into return array
CurveArray allLines = new CurveArray();
for (int i = 0; i < 8; i++)
{
allLines.Append(lines[i]);
}
return allLines;
}
示例3: FindFloorViewDirection
/// <summary>
/// Find the view direction vector,
/// which is the same meaning of ViewDirection property in View class
/// </summary>
/// <param name="curveArray">the curve array which form floor's AnalyticalModel</param>
/// <returns>the view direction vector</returns>
public static Autodesk.Revit.DB.XYZ FindFloorViewDirection(CurveArray curveArray)
{
// Because the floor is always on the level,
// so each curve can give the direction information.
Curve curve = curveArray.get_Item(0);
Autodesk.Revit.DB.XYZ first = curve.get_EndPoint(0);
Autodesk.Revit.DB.XYZ second = curve.get_EndPoint(1);
return FindDirection(first, second);
}
示例4: SortCurves
/// <summary>
/// Chaining the profile.
/// </summary>
/// <param name="lines">none-chained profile</param>
private void SortCurves(CurveArray lines)
{
Autodesk.Revit.DB.XYZ temp = lines.get_Item(0).get_EndPoint(1);
Curve temCurve = lines.get_Item(0);
Profile.Append(temCurve);
while (Profile.Size != lines.Size)
{
temCurve = GetNext(lines, temp, temCurve);
if (Math.Abs(temp.X - temCurve.get_EndPoint(0).X) < PRECISION
&& Math.Abs(temp.Y - temCurve.get_EndPoint(0).Y) < PRECISION)
{
temp = temCurve.get_EndPoint(1);
}
else
{
temp = temCurve.get_EndPoint(0);
}
Profile.Append(temCurve);
}
if (Math.Abs(temp.X - lines.get_Item(0).get_EndPoint(0).X) > PRECISION
|| Math.Abs(temp.Y - lines.get_Item(0).get_EndPoint(0).Y) > PRECISION
|| Math.Abs(temp.Z - lines.get_Item(0).get_EndPoint(0).Z) > PRECISION)
{
throw new InvalidOperationException("The selected walls should be closed.");
}
}