本文整理汇总了C#中FamilyInstance.GetAnalyticalModel方法的典型用法代码示例。如果您正苦于以下问题:C# FamilyInstance.GetAnalyticalModel方法的具体用法?C# FamilyInstance.GetAnalyticalModel怎么用?C# FamilyInstance.GetAnalyticalModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FamilyInstance
的用法示例。
在下文中一共展示了FamilyInstance.GetAnalyticalModel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeometrySupport
/// <summary>
/// constructor
/// </summary>
/// <param name="element">the host object, must be family instance</param>
/// <param name="geoOptions">the geometry option</param>
public GeometrySupport(FamilyInstance element, Options geoOptions)
{
// get the geometry element of the selected element
Autodesk.Revit.DB.GeometryElement geoElement = element.get_Geometry(new Options());
if (null == geoElement || 0 == geoElement.Objects.Size)
{
throw new Exception("Can't get the geometry of selected element.");
}
AnalyticalModel aModel = element.GetAnalyticalModel();
if (aModel == null)
{
throw new Exception("The selected FamilyInstance don't have AnalyticalModel.");
}
AnalyticalModelSweptProfile swProfile = aModel.GetSweptProfile();
if (swProfile == null || !(swProfile.GetDrivingCurve() is Line))
{
throw new Exception("The selected element driving curve is not a line.");
}
// get the driving path and vector of the beam or column
Line line = swProfile.GetDrivingCurve() as Line;
if (null != line)
{
m_drivingLine = line; // driving path
m_drivingVector = GeomUtil.SubXYZ(line.get_EndPoint(1), line.get_EndPoint(0));
}
//get the geometry object
foreach (GeometryObject geoObject in geoElement.Objects)
{
//get the geometry instance which contain the geometry information
GeoInstance instance = geoObject as GeoInstance;
if (null != instance)
{
foreach (GeometryObject o in instance.SymbolGeometry.Objects)
{
// get the solid of beam of column
Solid solid = o as Solid;
// do some checks.
if (null == solid)
{
continue;
}
if (0 == solid.Faces.Size || 0 == solid.Edges.Size)
{
continue;
}
m_solid = solid;
//get the transform value of instance
m_transform = instance.Transform;
// Get the swept profile curves information
if (!GetSweptProfile(solid))
{
throw new Exception("Can't get the swept profile curves.");
}
break;
}
}
}
// do some checks about profile curves information
if (null == m_edges)
{
throw new Exception("Can't get the geometry edge information.");
}
if (4 != m_points.Count)
{
throw new Exception("The sample only work for rectangular beams or columns.");
}
}
示例2: PrepareData
/// <summary>
/// Search for the In-Place family instance's properties data to be listed
/// and graphics data to be drawn.
/// </summary>
/// <param name="inPlaceMember">properties data to be listed</param>
/// <param name="model">graphics data to be draw</param>
/// <returns>Returns true if retrieved this data</returns>
private bool PrepareData(ref FamilyInstance inPlaceMember, ref AnalyticalModel model)
{
ElementSet selected = m_commandData.Application.ActiveUIDocument.Selection.Elements;
if (selected.Size != 1)
{
return false;
}
foreach (object o in selected)
{
inPlaceMember = o as FamilyInstance;
if (null == inPlaceMember)
{
return false;
}
}
model = inPlaceMember.GetAnalyticalModel();
if (null==model)
{
return false;
}
return true;
}