本文整理匯總了C#中Autodesk.Normalize方法的典型用法代碼示例。如果您正苦於以下問題:C# Autodesk.Normalize方法的具體用法?C# Autodesk.Normalize怎麽用?C# Autodesk.Normalize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Autodesk
的用法示例。
在下文中一共展示了Autodesk.Normalize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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)
{
}
}
示例2: 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());
}
}