Hi there,
Not sure what's cause.
The following code can successfully create a floor and set the span direction. After creating the floor, and edit the floor, I can see the span symbol in the floor editor.
Here is the code.
<code>
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit .DB;
using Autodesk.Revit.UI;
using Autodesk.Revit .ApplicationServices;
using Autodesk.Revit.Attributes ;
using Autodesk.Revit.UI.Selection;
[TransactionAttribute(TransactionMode.Manual)]
public class RevitCommand : IExternalCommand
{
public Result Execute(ExternalCommandData commandData,
ref string messages, ElementSet elements)
{
UIApplication app = commandData.Application;
Document doc = app.ActiveUIDocument.Document;
Transaction trans = new Transaction(doc);
trans.Start("CreateFloorChangeSpanDirection");
//create a floor.
CurveArray ca = new CurveArray();
double width = 5;
Line l1 = Line.CreateBound(new XYZ(width, width, 0), new XYZ(width, -width, 0));
Line l2 = Line.CreateBound(new XYZ(width, -width, 0), new XYZ(-width, -width, 0));
Line l3 = Line.CreateBound(new XYZ(-width, -width, 0), new XYZ(-width, width, 0));
Line l4 = Line.CreateBound(new XYZ(-width, width, 0), new XYZ(width, width, 0));
ca.Append(l1);
ca.Append(l2);
ca.Append(l3);
ca.Append(l4);
Floor f = doc.Create.NewFloor(ca, false);
f.SpanDirectionAngle = 0;
trans.Commit();
return Result.Succeeded ;
}
}
<code>
Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network