Dear Jeremy, as far as i managed to investigate, a BasicRoof and a SlopedGlazing are the same category, the same creation method should work for them. My code below works fine, if I specify a BasicRoof as the roof type and create the slope of the roof, with the iterator.
It also works fine, if I specify a SlopedGlazing as type, and don't specify slope for the footprint, so a flat sloped glazing is created.
But if I switch the type of the sloped roof from basic, to SlopedGlazing in code, the roof element disappears from the model, without any warning.
Any idea why that's happening?
Thanks, Gergő
public static IEnumerable<FootPrintRoof> RoofCreator(Document doc, IEnumerable<InputRoof> inputRoofs,
IEnumerable<Level> levels, IEnumerable<RoofType> roofTypes )
{
var levelList = levels.ToList();
var roofTypesList = roofTypes.ToList();
const string roofTemplate = "RoofTemplate";
foreach (var inputRoof in inputRoofs)
{
var level = levelList.Single(l => l.Name == inputRoof.LevelName);
var roofTemp = roofTypesList.Single(r => r.Name == roofTemplate);
var footPrintToModelCurveMapping = new ModelCurveArray();
var roof = doc.Create.NewFootPrintRoof(inputRoof.RoofContour, level, roofTemp, out footPrintToModelCurveMapping);
var iterator = footPrintToModelCurveMapping.ForwardIterator();
iterator.Reset();
var i = 1;
while (iterator.MoveNext())
{
i++;
var modelCurve = iterator.Current as ModelCurve;
if (i % 2 == 0)
{
roof.set_DefinesSlope(modelCurve, true);
roof.set_SlopeAngle(modelCurve, Converter.DegToRad(inputRoof.Slope));
}
else
{
roof.set_DefinesSlope(modelCurve, false);
}
}
var rType = roofTypesList.First(r => r.Name == inputRoof.RoofTypeName);
roof.RoofType = rType;
Log.Trace(roof.RoofType.Name);
yield return roof;
}
}