Simon posted in the forum looking for “the possibility to convert a floor to a ceiling by sketch or a roof by sketch and vice versa”. Yes, this can be done with the Revit API! You can find the source code here.
Simon posted in the forum looking for “the possibility to convert a floor to a ceiling by sketch or a roof by sketch and vice versa”. Yes, this can be done with the Revit API! You can find the source code here.
i am trying to use same same fundamental for Area to Floor conversion .can you help me with this def area_to_floor(area, offset, level):
new_floor = None
try:
# Make sure that Area is bounding.
if not area.get_Parameter(BuiltInParameter.ROOM_AREA).AsDouble():
return None
# Check the shared parameter “Area Type” value
area_type_param = area.LookupParameter(“Area Type”)
if area_type_param:
area_type_value = area_type_param.AsString()
selected_floor_type = select_floor_type(area_type_value)
# AREA BOUNDARIES
#area_boundaries = area.GetBoundarySegments(SpatialElementBoundaryOptions())
#sorted_curve_loops = sort_area_boundaries(area_boundaries)
opt = DB.SpatialElementBoundaryOptions()
print opt
curve_loop = ExporterIFCUtils.GetRoomBoundaryAsCurveLoopArray(area, opt, True)
print curve_loop
with Transaction(doc, ‘Create Floor’) as t:
t.Start()
new_floor = Floor.Create(doc, curve_loop, selected_floor_type.Id, level.Id) #FIXME
if new_floor:
# SET OFFSET
param = new_floor.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM)
param.Set(offset)
failOpt = t.GetFailureHandlingOptions()
failOpt.SetFailuresPreprocessor(FloorsCreationWarningSwallower())
t.SetFailureHandlingOptions(failOpt)
t.Commit()
except:
# print(traceback.format_exc())
pass
if new_floor:
return new_floor
Hi – how is this not working? Are selected_floor_type.Id and level.Id valid values? I find it helpful to create model lines from the curves to make sure that they are making a valid profile using the “makeCurve” function (https://bitbucket.org/BoostYourBIM/boostyourbimterrifictools/src/8022b2f76fe6e9015cbe9155b85976f293e4686c/BoostYourBIMTerrificTools/Utils.cs#lines-82)