本文整理汇总了C#中Floor.get_Geometry方法的典型用法代码示例。如果您正苦于以下问题:C# Floor.get_Geometry方法的具体用法?C# Floor.get_Geometry怎么用?C# Floor.get_Geometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floor
的用法示例。
在下文中一共展示了Floor.get_Geometry方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloneElement
/// <summary>
///
/// </summary>
/// <param name="app"></param>
/// <param name="floor"></param>
/// <returns></returns>
private static Revit.Element CloneElement( Autodesk.Revit.UI.UIApplication app, Floor floor )
{
//get geometry to figure out location of floor
Options options = app.Application.Create.NewGeometryOptions();
options.DetailLevel = ViewDetailLevel.Coarse;
GeometryElement geomElem = floor.get_Geometry( options );
Solid solid = null;
foreach( GeometryObject geoObject in geomElem )
{
if( geoObject is Solid )
{
solid = geoObject as Solid;
break;
}
}
Level level = floor.Document.GetElement( floor.LevelId ) as Level;
double absoluteElev = level.Elevation + floor.get_Parameter( BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM ).AsDouble();
CurveArray curveArray = Utils.Geometry.GetProfile( solid, absoluteElev, app.Application );
Floor floorClone = app.ActiveUIDocument.Document.Create.NewFloor( curveArray, floor.FloorType, level, false );
Utils.ParamUtil.SetParameters( floorClone.Parameters, floor.Parameters );
return floorClone;
}
示例2: LocateSlab
/// <summary>
/// Located the buttom of a slab object.
/// </summary>
/// <param name="floor">A floor object.</param>
/// <param name="bubbleEnd">The bubble end of new reference plane.</param>
/// <param name="freeEnd">The free end of new reference plane.</param>
/// <param name="thirdPnt">The third point of new reference plane.</param>
private void LocateSlab(Floor floor, ref Autodesk.Revit.DB.XYZ bubbleEnd, ref Autodesk.Revit.DB.XYZ freeEnd, ref Autodesk.Revit.DB.XYZ thirdPnt)
{
//Obtain the geometry data of the floor.
GElement geometry = floor.get_Geometry(m_options);
Face buttomFace = null;
foreach (GeometryObject go in geometry.Objects)
{
Solid solid = go as Solid;
if (null == solid)
{
continue;
}
else
{
//Get the bottom face of this floor.
buttomFace = GeoHelper.GetBottomFace(solid.Faces);
}
}
Mesh mesh = buttomFace.Triangulate();
GeoHelper.Distribute(mesh, ref bubbleEnd, ref freeEnd, ref thirdPnt);
}
示例3: CopyFloor
private Floor CopyFloor(Floor sourceFloor)
{
var floorGeometryElement =
sourceFloor.get_Geometry(new Options());
foreach (var geometryObject in floorGeometryElement)
{
var floorSolid =
geometryObject as Solid;
if (floorSolid == null)
continue;
var topFace =
GetTopFace(floorSolid);
if (topFace == null)
throw new NotSupportedException(Resources.FloorDoesNotHaveTopFace);
if (topFace.EdgeLoops.IsEmpty)
throw new NotSupportedException(Resources.FloorTopFateDoesNotHaveEdges);
var outerBoundary =
topFace.EdgeLoops.get_Item(0);
// create new floor using source floor outer boundaries
CurveArray floorCurveArray =
GetCurveArrayFromEdgeArary(outerBoundary);
var newFloor =
sourceFloor
.Document
.Create
.NewFloor(floorCurveArray, false);
/*
// if source floor has openings
if (topFace.EdgeLoops.Size > 1)
{
for (int i = 1; i < topFace.EdgeLoops.Size; i++)
{
var openingEdges =
topFace.EdgeLoops.get_Item(i);
var openingCurveArray =
GetCurveArrayFromEdgeArary(openingEdges);
var opening =
sourceFloor
.Document
.Create
.NewOpening(newFloor,
openingCurveArray,
true);
}
}
*/
return newFloor;
}
return null;
}
示例4: GetFloorProfile
/// <summary>
/// Get a floor's profile.
/// </summary>
/// <param name="floor">The floor whose profile you want to get.</param>
/// <returns>The profile of the floor.</returns>
private CurveArray GetFloorProfile(Floor floor)
{
CurveArray floorProfile = new CurveArray();
// Structural slab's profile can be found in it's AnalyticalModel.
if (null != floor.GetAnalyticalModel())
{
AnalyticalModel analyticalModel = floor.GetAnalyticalModel();
IList<Curve> curveList= analyticalModel.GetCurves(AnalyticalCurveType.ActiveCurves);
for (int i = 0; i < curveList.Count; i++)
{
floorProfile.Append(curveList[i]);
}
return floorProfile;
}
// Nonstructural floor's profile can be formed through it's Geometry.
Options aOptions = m_revit.Application.Create.NewGeometryOptions();
Autodesk.Revit.DB.GeometryElement aElementOfGeometry = floor.get_Geometry(aOptions);
GeometryObjectArray geometryObjects = aElementOfGeometry.Objects;
foreach (GeometryObject o in geometryObjects)
{
Solid solid = o as Solid;
if (null == solid)
continue;
// Form the floor's profile through solid's edges.
EdgeArray edges = solid.Edges;
for (int i = 0; i < (edges.Size) / 3; i++)
{
Edge edge = edges.get_Item(i);
List<XYZ> xyzArray = edge.Tessellate() as List<XYZ>; // A set of points.
for (int j = 0; j < (xyzArray.Count - 1); j++)
{
Autodesk.Revit.DB.XYZ startPoint = xyzArray[j];
Autodesk.Revit.DB.XYZ endPoint = xyzArray[j + 1];
Line line = CreApp.NewLine(startPoint, endPoint,true);
floorProfile.Append(line);
}
}
}
return floorProfile;
}
示例5: CreateFloorOpenings
private void CreateFloorOpenings(Floor sourceFloor, Floor destFloor)
{
// looking if source floor has openings
var floorGeometryElement =
sourceFloor.get_Geometry(new Options());
foreach (var geometryObject in floorGeometryElement)
{
var floorSolid =
geometryObject as Solid;
if (floorSolid == null)
continue;
var topFace =
GetTopFace(floorSolid);
if (topFace == null)
throw new NotSupportedException(Resources.FloorDoesNotHaveTopFace);
if (topFace.EdgeLoops.IsEmpty)
throw new NotSupportedException(Resources.FloorTopFateDoesNotHaveEdges);
// if source floor has openings
if (topFace.EdgeLoops.Size > 1)
{
for (int i = 1; i < topFace.EdgeLoops.Size; i++)
{
var openingEdges =
topFace.EdgeLoops.get_Item(i);
var openingCurveArray =
GetCurveArrayFromEdgeArary(openingEdges);
var opening =
sourceFloor
.Document
.Create
.NewOpening(destFloor,
openingCurveArray,
true);
}
}
}
}