private void FrameWall( Autodesk.Revit.ApplicationServices.Application rvtApp, Autodesk.Revit.DB.Wall wall, double spacing, FamilySymbol columnType )
{
Document rvtDoc = wall.Document;
LocationCurve loc = (LocationCurve) wall.Location;
XYZ startPt = loc.Curve.GetEndPoint( 0 );
XYZ endPt = loc.Curve.GetEndPoint( 1 );
UV wallVec = new UV( endPt.X - startPt.X, endPt.Y - startPt.Y );
UV axis = new UV( 1.0, 0.0 );
ElementId baseLevelId = wall.get_Parameter( BuiltInParameter.WALL_BASE_CONSTRAINT ).AsElementId();
ElementId topLevelId = wall.get_Parameter( BuiltInParameter.WALL_HEIGHT_TYPE ).AsElementId();
double wallLength = VecLength( wallVec );
wallVec = VecNormalise( wallVec );
int nmax = (int) ( wallLength / spacing );
MessageBox.Show( "Wall Length = " + wallLength + "\nSpacing = " + spacing + "\nMax Number = " + nmax, "Structural Sample", MessageBoxButtons.OK, MessageBoxIcon.Information );
double angle = VecAngle( wallVec, axis );
XYZ loc2 = startPt;
double dx = wallVec.U * spacing;
double dy = wallVec.V * spacing;
for( int i = 0; i < nmax; i++ )
{
PlaceColumn( rvtApp, rvtDoc, loc2, angle, columnType, baseLevelId, topLevelId );
loc2 = new XYZ( startPt.X + dx, startPt.Y + dy, startPt.Z );
}
PlaceColumn( rvtApp, rvtDoc, endPt, angle, columnType, baseLevelId, topLevelId );
}