本文整理汇总了C#中Curve.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Curve.GetType方法的具体用法?C# Curve.GetType怎么用?C# Curve.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Curve
的用法示例。
在下文中一共展示了Curve.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateReversedCurve
/// <summary>
/// Create a new curve with the same
/// geometry in the reverse direction.
/// </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 Curve CreateReversedCurve(
Autodesk.Revit.Creation.Application creapp,
Curve orig )
{
if( !IsSupported( orig ) )
{
throw new NotImplementedException(
"CreateReversedCurve for type "
+ orig.GetType().Name );
}
if( orig is Line )
{
return Line.CreateBound(
orig.GetEndPoint( 1 ),
orig.GetEndPoint( 0 ) );
}
else if( orig is Arc )
{
return Arc.Create( orig.GetEndPoint( 1 ),
orig.GetEndPoint( 0 ),
orig.Evaluate( 0.5, true ) );
}
else
{
throw new Exception(
"CreateReversedCurve - Unreachable" );
}
}
示例2: CreateCurveByPoints
private Autodesk.Revit.DB.CurveByPoints CreateCurveByPoints(Autodesk.Revit.DB.CurveByPoints c, Curve gc, XYZ start, XYZ end)
{
//Add the geometry curves start and end points to a ReferencePointArray.
ReferencePointArray refPtArr = new ReferencePointArray();
if (gc.GetType() == typeof(Line))
{
ReferencePoint refPointStart = this.UIDocument.Document.FamilyCreate.NewReferencePoint(start);
ReferencePoint refPointEnd = this.UIDocument.Document.FamilyCreate.NewReferencePoint(end);
refPtArr.Append(refPointStart);
refPtArr.Append(refPointEnd);
//c = dynRevitSettings.Doc.Document.FamilyCreate.NewCurveByPoints(refPtArr);
}
else if (gc.GetType() == typeof(Arc) && foundCreateArcThroughPoints)
{
Type CurveByPointsUtilsType = typeof(Autodesk.Revit.DB.CurveByPointsUtils);
MethodInfo[] curveElementMethods = CurveByPointsUtilsType.GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
System.String nameOfMethodSetCurve = "CreateArcThroughPoints";
foreach (MethodInfo m in curveElementMethods)
{
if (m.Name == nameOfMethodSetCurve)
{
object[] argsM = new object[4];
ReferencePoint refPointStart = this.UIDocument.Document.FamilyCreate.NewReferencePoint(start);
ReferencePoint refPointEnd = this.UIDocument.Document.FamilyCreate.NewReferencePoint(end);
XYZ midPoint = gc.Evaluate(0.5, true);
ReferencePoint refMidPoint = this.UIDocument.Document.FamilyCreate.NewReferencePoint(midPoint);
argsM[0] = this.UIDocument.Document;
argsM[1] = refPointStart;
argsM[2] = refPointEnd;
argsM[3] = refMidPoint;
c = (Autodesk.Revit.DB.CurveByPoints)m.Invoke(null, argsM);
if (c != null && c.GeometryCurve.GetType() == typeof(Arc))
return c;
if (c != null)
this.DeleteElement(c.Id);
break;
}
}
foundCreateArcThroughPoints = false;
}
if (gc.GetType() != typeof(Line))
{
IList <XYZ> xyzList = gc.Tessellate();
int numPoints = xyzList.Count;
for (int ii = 0; ii < numPoints; ii++)
{
ReferencePoint refPoint = this.UIDocument.Document.FamilyCreate.NewReferencePoint(xyzList[ii]);
refPtArr.Append(refPoint);
}
}
c = dynRevitSettings.Doc.Document.FamilyCreate.NewCurveByPoints(refPtArr);
return c;
}
示例3: handleJoinsRight
/// <summary>
/// Get the Insulation Layer of Right hand joined Walls
/// </summary>
public Tuple<Curve, Curve> handleJoinsRight(Document doc, LocationCurve wallLocCurve, Curve lower, Curve upper, ref List<int> bannedWalls)
{
Tuple<Curve, Curve> existing = new Tuple<Curve, Curve>(upper, lower);
if (lower.GetType() == typeof(Arc) || lower.GetType() == typeof(NurbSpline)) return existing;
if (upper.GetType() == typeof(Arc) || upper.GetType() == typeof(NurbSpline)) return existing;
XYZ IntersectionPointLower = null;
XYZ IntersectionPointUpper = null;
ElementArray elems = wallLocCurve.get_ElementsAtJoin(1);
if (elems == null || elems.Size == 0) return existing;
foreach (Element elem in elems)
{
if (elem.GetType() == typeof(Wall))
{
Wall wnext = (Wall)elem;
if (!bannedWalls.Contains(wnext.Id.IntegerValue))
{
Tuple<Curve, Curve> curves = getInsulationLayer(doc, wnext);
Curve lowerunbound = lower.Clone();
lowerunbound.MakeUnbound();
Curve upperunbound = upper.Clone();
upperunbound.MakeUnbound();
Curve lowernext = curves.Item2.Clone();
lowernext.MakeUnbound();
IntersectionResultArray result = new IntersectionResultArray();
lowerunbound.Intersect(lowernext, out result);
if (result != null && result.Size == 1)
{
IntersectionPointLower = result.get_Item(0).XYZPoint;
}
upperunbound.Intersect(lowernext, out result);
if (result != null && result.Size == 1)
{
IntersectionPointUpper = result.get_Item(0).XYZPoint;
}
}
}
}
if (IntersectionPointLower == null || IntersectionPointUpper == null) return existing;
return new Tuple<Curve, Curve>(Line.CreateBound(upper.GetEndPoint(0), IntersectionPointUpper), Line.CreateBound(lower.GetEndPoint(0), IntersectionPointLower));
}
示例4: CreateCurveByPoints
private CurveByPoints CreateCurveByPoints(CurveByPoints c, Curve gc, XYZ start, XYZ end)
{
//Add the geometry curves start and end points to a ReferencePointArray.
ReferencePointArray refPtArr = new ReferencePointArray();
if (gc.GetType() == typeof(Line))
{
ReferencePoint refPointStart = this.UIDocument.Document.FamilyCreate.NewReferencePoint(start);
ReferencePoint refPointEnd = this.UIDocument.Document.FamilyCreate.NewReferencePoint(end);
refPtArr.Append(refPointStart);
refPtArr.Append(refPointEnd);
}
c = dynRevitSettings.Doc.Document.FamilyCreate.NewCurveByPoints(refPtArr);
return c;
}
示例5: handleJoinsLeft
/// <summary>
/// Get the Insulation Layer of Left hand joined Walls
/// </summary>
public Curve handleJoinsLeft(Document doc, LocationCurve wallLocCurve, Curve lower, ref List<int> bannedWalls)
{
if (lower.GetType() == typeof(Arc) || lower.GetType() == typeof(NurbSpline)) return lower;
XYZ IntersectionPoint = null;
ElementArray elems = wallLocCurve.get_ElementsAtJoin(0);
if (elems == null || elems.Size == 0) return lower;
foreach (Element elem in elems)
{
if (elem.GetType() == typeof(Wall))
{
Wall wnext = (Wall)elem;
if (!bannedWalls.Contains(wnext.Id.IntegerValue))
{
Tuple<Curve, Curve> curves = getInsulationLayer(doc, wnext);
Curve lowerunbound = lower.Clone();
lowerunbound.MakeUnbound();
Curve upper = curves.Item1.Clone();
upper.MakeUnbound();
IntersectionResultArray result = new IntersectionResultArray();
lowerunbound.Intersect(upper, out result);
if (result != null && result.Size == 1)
{
IntersectionPoint = result.get_Item(0).XYZPoint;
}
}
}
}
if (IntersectionPoint == null) return lower;
Line l = Line.CreateBound(IntersectionPoint, lower.GetEndPoint(1));
return l;
}