本文整理汇总了C#中Autodesk.IsAlmostEqualTo方法的典型用法代码示例。如果您正苦于以下问题:C# Autodesk.IsAlmostEqualTo方法的具体用法?C# Autodesk.IsAlmostEqualTo怎么用?C# Autodesk.IsAlmostEqualTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autodesk
的用法示例。
在下文中一共展示了Autodesk.IsAlmostEqualTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeLine
/// <summary>
/// Make a line from start point to end point with the direction and style
/// </summary>
/// <param name="startpt">start point</param>
/// <param name="endpt">end point</param>
/// <param name="direction">the direction which decide the plane</param>
/// <param name="style">line style name</param>
public void MakeLine(Autodesk.Revit.DB.XYZ startpt, Autodesk.Revit.DB.XYZ endpt, Autodesk.Revit.DB.XYZ direction, string style)
{
try
{
m_LineCount = m_LineCount + 1;
Line line = m_app.Application.Create.NewLineBound(startpt, endpt);
// Line must lie in the sketch plane. Use the direction of the line to construct a plane that hosts the target line.
XYZ rotatedDirection = XYZ.BasisX;
// If the direction is not vertical, cross the direction vector with Z to get a vector rotated ninety degrees. That vector,
// plus the original vector, form the axes of the sketch plane.
if (!direction.IsAlmostEqualTo(XYZ.BasisZ) && !direction.IsAlmostEqualTo(-XYZ.BasisZ))
{
rotatedDirection = direction.Normalize().CrossProduct(XYZ.BasisZ);
}
Plane geometryPlane = m_app.Application.Create.NewPlane(direction, rotatedDirection, startpt);
SketchPlane skplane = m_app.ActiveUIDocument.Document.Create.NewSketchPlane(geometryPlane);
ModelCurve mcurve = m_app.ActiveUIDocument.Document.Create.NewModelCurve(line, skplane);
m_app.ActiveUIDocument.Document.Regenerate();
ElementArray lsArr = mcurve.LineStyles;
foreach (Autodesk.Revit.DB.Element e in lsArr)
{
if (e.Name == style)
{
mcurve.LineStyle = e;
break;
}
}
m_app.ActiveUIDocument.Document.Regenerate();
}
catch (System.Exception ex)
{
m_outputInfo.Add("Failed to create lines: " + ex.ToString());
}
}
示例2: MakeLine
/// <summary>
/// Draw a small line for debug porpouse
/// </summary>
public static void MakeLine(Autodesk.Revit.UI.UIApplication app,
Autodesk.Revit.DB.XYZ startpt, Autodesk.Revit.DB.XYZ endpt,
Autodesk.Revit.DB.XYZ direction, string style)
{
try
{
Line line = app.Application.Create.NewLineBound(startpt,
endpt);
XYZ rotatedDirection = XYZ.BasisX;
if (!direction.IsAlmostEqualTo(XYZ.BasisZ) &&
!direction.IsAlmostEqualTo(-XYZ.BasisZ))
{
rotatedDirection =
direction.Normalize().CrossProduct(XYZ.BasisZ);
}
Plane geometryPlane = app.Application.Create.NewPlane
(direction, rotatedDirection, startpt);
SketchPlane skplane = app.ActiveUIDocument.Document.
Create.NewSketchPlane(geometryPlane);
ModelCurve mcurve = app.ActiveUIDocument.Document.Create.
NewModelCurve(line, skplane);
ElementArray lsArr = mcurve.LineStyles;
foreach (Autodesk.Revit.DB.Element e in lsArr)
{
if (e.Name == style)
{
mcurve.LineStyle = e;
break;
}
}
}
catch (System.Exception e)
{
}
}
示例3: GetEdgeByEndPoints
/// <summary>
/// Get an edge from the form by its endpoints
/// </summary>
/// <param name="form">The form contains the edge</param>
/// <param name="startPoint">Start point of the edge</param>
/// <param name="endPoint">End point of the edge</param>
/// <returns>The edge found</returns>
private Edge GetEdgeByEndPoints(Form form, Autodesk.Revit.DB.XYZ startPoint, Autodesk.Revit.DB.XYZ endPoint)
{
Edge edge = null;
// Get all edges of the form
EdgeArray edges = null;
Options geoOptions = m_revitApp.Create.NewGeometryOptions();
geoOptions.ComputeReferences = true;
Autodesk.Revit.DB.GeometryElement geoElement = form.get_Geometry(geoOptions);
foreach (GeometryObject geoObject in geoElement.Objects)
{
Solid solid = geoObject as Solid;
if (null == solid)
continue;
edges = solid.Edges;
}
// Traverse the edges and look for the edge with the right endpoints
foreach (Edge ed in edges)
{
Autodesk.Revit.DB.XYZ rpPos1 = ed.Evaluate(0);
Autodesk.Revit.DB.XYZ rpPos2 = ed.Evaluate(1);
if ((startPoint.IsAlmostEqualTo(rpPos1) && endPoint.IsAlmostEqualTo(rpPos2)) ||
(startPoint.IsAlmostEqualTo(rpPos2) && endPoint.IsAlmostEqualTo(rpPos1)))
{
edge = ed;
break;
}
}
return edge;
}