Can't create sloped floors

Sydra7
Contributor
Contributor

Can't create sloped floors

Sydra7
Contributor
Contributor

Sample code:

public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
try
{
var document = commandData.Application.ActiveUIDocument.Document;

 

Transaction transaction = new Transaction(document, "Create Floor");
transaction.Start();

 

var points = new List<XYZ>()
{
new XYZ(5.0, 0.0, 0.0),
new XYZ(0.0, 5.0, 0.0),
new XYZ(0.0, 0.0, 5.0)
};

var curves = new CurveArray();
curves.Insert(document.Application.Create.NewLine(points[0], points[1], true), 0);
curves.Insert(document.Application.Create.NewLine(points[1], points[2], true), 1);
curves.Insert(document.Application.Create.NewLine(points[2], points[0], true), 2);

 

var floorTypes = new FilteredElementCollector(document).OfClass(typeof(FloorType));
var floorType = floorTypes.ToList()[0] as FloorType;

 

var levels = new FilteredElementCollector(document).OfClass(typeof(Level));
var level = levels.ToList()[0] as Level;

 

var normal = new XYZ(1.0, 1.0, 1.0);

 

var floor = document.Create.NewFloor(curves, floorType, level, true, normal);

 

transaction.Commit();
}
catch
{
return Result.Failed;
}

return Result.Succeeded;
}

If I want to run this code an error message comes up:

"A first chance exception of type 'Autodesk.Revit.Exceptions.InvalidOperationException' occurred in RevitAPI.dll

Additional information: Could not construct a proper face with the input curves to create a floor correctly."

The NewFloor function is works well with horizontal lines and vertical normal vector. What is the role of the normal vector if the function is only works with horizontal lines? There is other NewFloor function without normal vector parameter ... why is the normal vector parameter there at the first version?

How can i create sloped floor?

(I use Revit 2013 API)

Regards
David Schmidt 

0 Likes
Reply
Accepted solutions (2)
1,977 Views
6 Replies
Replies (6)

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear David,

 

I suspect that the problem is that the lines are not in the horizontal plane.

 

No matter how you wish to slope the floor, the fundamental sketch of its boundary is always based on a level, and hence horizontal.

 

Please define the boundary profile horizontally and let us know how it goes.

 

You can still apply a slope to it, afterwards.

 

Also, I would recommend trying it in Revit 2014, if you can.

 

Thank you!

 

Cheers and happy weekend,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes

jeremytammik
Autodesk
Autodesk

I went on to discuss this in much more detail:

 

http://thebuildingcoder.typepad.com/blog/2014/03/creating-a-sloped-floor.html

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes

Sydra7
Contributor
Contributor

Ah thanks for that! 🙂

anyway ... the generation of sloped floors is mostly perfect when i generates only a few of them. But if i creates hundreds of them, the revit tend to create bad analytical models.

am01.jpg

 

As you can see on the picture, the solids of the floors are perfect, but the analytical models are sometimes not on the plane of the floor. There are mistical regularities in some mistakes ... it seems some analytical floors are inherit their slope from a neighbour floor. Maybe the revit cant regenerate the model correctly.

Regards

David Schmidt

0 Likes

jeremytammik
Autodesk
Autodesk

Dear David,

Can you provide a reproducible case to generate such an error?

Preferably just with a few floors, if possible.

However, if it requires a large number to generate the error, then that should also be OK.

It would be a really great help if it were possible to reduce the problem to a small, simple, reproducible case, e.g., by providing a minimal sample project and a test command, i.e.

  • A complete yet minimal Revit sample model to run a test in.
  • A complete yet minimal Visual Studio solution with add-in manifest so that we can compile, load and run the application with a single click and explore its behaviour live in the sample model you provide.
  • Detailed step-by-step instructions for reproducing the issue.
  • Specification of the exact behaviour you observe versus what you expect.

Is that possible?

When sending us sample material, please do not include any information that you consider to be confidential or a trade secret to your company.

Thank you!

Cheers,

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes

Sydra7
Contributor
Contributor

I'll try to make a small example later if I'll have some time to make experiments.

0 Likes

andrzej.trelinski
Participant
Participant
Accepted solution

Hi David,

Basic assumption for Floors and Structural Foundation Slab is that Structural Analytical Model of those elements is always planar.

For Structural Walls, Structural Analytical Model can be either planar or cylindrical.

In this case, I recommend to set in analytical model following values:

-          “Alignment Method” to “Projection”

-          “z Projection” to “Top of Element”

You may also add some Analytical Links (option available inside Analytical Adjust option)

 

Structural Analytical Model is used to make structural calculations (Robot Structural Analysis (RSA)) for buildings (not Energetic analysis)

 

If You need connected structural analytical model for calculations, I would recommend You to contact with Autodesk Developer Network Support (ADN) to verify requirements of calculations programs for that case

 

Regards,

Andrzej Trelinski

Revit Structure Developer

0 Likes