SolidIntersectWithCurve Method |
Calculates and returns the intersection between a curve and this solid.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntaxpublic SolidCurveIntersection IntersectWithCurve(
Curve curve,
SolidCurveIntersectionOptions options
)
Public Function IntersectWithCurve (
curve As Curve,
options As SolidCurveIntersectionOptions
) As SolidCurveIntersection
public:
SolidCurveIntersection^ IntersectWithCurve(
Curve^ curve,
SolidCurveIntersectionOptions^ options
)
member IntersectWithCurve :
curve : Curve *
options : SolidCurveIntersectionOptions -> SolidCurveIntersection Parameters
- curve Curve
-
The curve.
- options SolidCurveIntersectionOptions
-
The options. If NULL, the default options will be used.
Return Value
SolidCurveIntersection
The intersection results.
Exceptions
Exampleprivate void FindColumnRebarIntersections(Document document, FamilyInstance column)
{
double totalRebarLengthInColumn = 0;
RebarHostData rebarHostData = RebarHostData.GetRebarHostData(column);
if (rebarHostData == null)
{
return;
}
IList<Rebar> rebars = rebarHostData.GetRebarsInHost();
if (rebars.Count == 0)
{
return;
}
Options geomOptions = new Options();
geomOptions.ComputeReferences = true;
geomOptions.DetailLevel = ViewDetailLevel.Fine;
GeometryElement elemGeometry = column.get_Geometry(geomOptions);
foreach (GeometryObject elemPrimitive in elemGeometry)
{
GeometryInstance gInstance = elemPrimitive as GeometryInstance;
if (gInstance == null)
{
continue;
}
GeometryElement instGeometry = gInstance.GetInstanceGeometry();
foreach (GeometryObject instPrimitive in instGeometry)
{
Solid solid = instPrimitive as Solid;
if (solid == null)
{
continue;
}
SolidCurveIntersectionOptions intersectOptions = new SolidCurveIntersectionOptions();
foreach (Rebar rebar in rebars)
{
bool selfIntersection = false;
bool suppresHooks = false;
bool suppresBends = false;
IList<Curve> curves = rebar.GetCenterlineCurves(selfIntersection, suppresHooks, suppresBends, MultiplanarOption.IncludeOnlyPlanarCurves, 0);
foreach (Curve curve in curves)
{
SolidCurveIntersection intersection = solid.IntersectWithCurve(curve, intersectOptions);
for (int segment = 0; segment <= intersection.SegmentCount - 1; segment++)
{
Curve curveInside = intersection.GetCurveSegment(segment);
double rebarLengthInColumn = curveInside.Length;
totalRebarLengthInColumn = totalRebarLengthInColumn + rebarLengthInColumn;
}
}
}
}
}
}
See Also