Stagger Grid Lines of Sloped Glazing?


#1

Seeking clues on how to “Add/Remove Segments” of Curtain Grids programmatically. E.g.:

 


#2

I’ve only found a clue in the Revit SDK’s Application: CurtainWallGrid

So it must be possible…

 

public void RemoveSegment()
{
// verify that the mouse is inside the curtain grid area
List<KeyValuePair<Line2D, Pen>> lines2D = m_drawing.DrawObject.Lines2D;
if (lines2D.Count < 1)
{
return;
}

List<SegmentLine2D> toBeRemovedList = new List<SegmentLine2D>();
// check whether the deletion is valid
bool canRemove = true;
MimicRemoveSegments(ref canRemove, toBeRemovedList);
// in the “MimicRemove” process, we didn’t find that we need to “Remove the last segment of the grid line”
// so the “Remove” action can go on
if (true == canRemove)
{
try
{
Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());
act.Start();
foreach (SegmentLine2D seg2D in toBeRemovedList)
{
int gridLineIndex = seg2D.GridLineIndex;
int segIndex = seg2D.SegmentIndex;
bool isUSegment = seg2D.IsUSegment;

CurtainGridLine line;
if (true == isUSegment)
{
line = m_uGridLines[gridLineIndex];
}
else
{
line = m_vGridLines[gridLineIndex];
}
Curve curve = line.AllSegmentCurves.get_Item(segIndex);
line.RemoveSegment(curve);
}
act.Commit();
}
catch (System.Exception e)
{
TaskDialog.Show(“Exception”, e.Message);
return;
}
}
// in the “MimicRemove” process, we found that we would “Remove the last segment of the grid line”
// so the whole “Remove” action will roll back
else
{
foreach (SegmentLine2D seg2D in toBeRemovedList)
{
int gridLineIndex = seg2D.GridLineIndex;
int segIndex = seg2D.SegmentIndex;
bool isUSegment = seg2D.IsUSegment;
GridLine2D gridLine2D;

if (true == isUSegment)
{
gridLine2D = m_drawing.UGridLines2D[gridLineIndex];
}
else
{
gridLine2D = m_drawing.VGridLines2D[gridLineIndex];
}

gridLine2D.RemovedNumber–;
SegmentLine2D segLine2D = gridLine2D.Segments[segIndex];
segLine2D.Removed = false;
gridLine2D.Segments[segIndex] = segLine2D;
}
string statusMsg = “Delete this segment will make some grid lines have no existent segments.”;
m_myDocument.Message = new KeyValuePair<string, bool>(statusMsg, true);
}

this.ReloadGeometryData();
m_drawing.DrawObject.Clear();
}