- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everybody! hope this ticket finds you well
I've managed to create direct shapes as baseboard elements, the problem is that those shapes are not editable so I will need to use their location to place family instances. So the real issue is to get 1 of the bottom edges from a cubic solid
I'm using the following piece of code:
foreach (Face face in partialBaseBoard.Faces)
{
PlanarFace planarFace = face as PlanarFace;
if (planarFace != null)
{
#region Method 2: use wall face orientation
List<XYZ> pts = new List<XYZ>();
//getting the face in contact with the wall (use the -)
if (planarWallFc.FaceNormal.IsAlmostEqualTo(-planarFace.FaceNormal)) {
tailorBird.tessellateFaces(doc,face);
List<Tuple<Line, double>> lines = new List<Tuple<Line, double>>();
foreach (CurveLoop cvLoop in face.GetEdgesAsCurveLoops()) {
foreach (Curve cv in cvLoop) {
Line line = cv as Line;
if (line != null) {
if (line.Direction.Z <= 0.05) {
lines.Add(new Tuple<Line, double>(line,line.Length));
}
}
}
}
if (lines.Any()) {
lines =lines.OrderByDescending(x=>x.Item2).ToList();
Line theLine = lines[0].Item1;
XYZ init = new XYZ(theLine.GetEndPoint(0).X,theLine.GetEndPoint(0).Y,doc.ActiveView.GenLevel.Elevation);
XYZ end = new XYZ(theLine.GetEndPoint(1).X,theLine.GetEndPoint(1).Y,doc.ActiveView.GenLevel.Elevation);
if (init.DistanceTo(end) > doc.Application.ShortCurveTolerance) {
doc.Create.NewDetailCurve(doc.ActiveView,Line.CreateBound(init,end));
}
}
it works fine for the most part as it only retrieves one bottom edge.
The problem comes with this room called "STORAGE":
somehow in Line 32, I'm filtering one face from the direct shape solid, from it I'm only selecting the larget horizontal edge (Z direction value EQUAL to zero ) and for most rooms this code draws a single line in the space but for this storage room revit is drawing more than 1 line at the same place which doesnt make sense because I'm only passing 1 line as input. So there is not even chance to add overlaping filters between lines because I'm using 1 line as input.
- 3 lines at same place from 1 cubic solid
- 1 large line and 2 small lines:
Any ideas of what might be causing this issue?
In other rooms there are not problems at all
Best regards,
Miguel G.
PD: I'm attaching the Revit project with the direct shapes already generated so you guys can do the test
Solved! Go to Solution.