Copy schedule properties

Hi All,

has anyone tried to match schedule properties, like matching column widths, position, and maybe the template? I tried Revit Lookup tool, but still have no idea where these properties can be found and if they can be applied to a selected schedule.

Parameters like the column width are in the ScheduleField class. You can get the fields in a schedule through the ScheduleDefinition class.

Thank you for the response. I think i’m on quite interesting (and maybe useful) path:

parsing field #0
Field: Comments, hidden?: True , heading: 'Comments', Align: Left, width: 0.0833' (25.4 mm), format: default 

parsing field #1
Field: Occupancy, hidden?: True , heading: 'Butas', Align: Center, width: 0.0345' (10.5107 mm), format: default 

parsing field #2
Field: Number, hidden?: False , heading: 'Nr.', Align: Center, width: 0.0328' (10.0 mm), format: default 

parsing field #3
Field: Name, hidden?: False , heading: 'Kambario pavadinimas', Align: Left, width: 0.0984' (30.0 mm), format: default 

parsing field #4
Field: Area, hidden?: False , heading: 'Plotas, m²', Align: Right, width: 0.0492' (15.0 mm), format: default 
   accuracy: 0.01, symbol: '', '+' prefix?: False 

parsing field #5
Field: Level, hidden?: True , heading: 'Level', Align: Left, width: 0.0833' (25.4 mm), format: default 

I hope it will be possible to apply column titles and widths with point-n-click in the future

Hi All,

any idea why

AttributeError: attribute 'SetUnitTypeId' of 'FormatOptions' object is read-only

The code seems fine, I can’t “untick” the “Use project settings” for the column. For now I need to untick it manually, and the field format options are applied correctly.

fo = field.GetFormatOptions()
if hasattr(column_definition, 'FO'):
    fo.UseDefault = False
    fo.RoundingMethod = DB.RoundingMethod.Nearest
#  fo.SetUnitTypeId = DB.ForgeTypeId('autodesk.unit.symbol:mSup2-1.0.1')
    fo.Accuracy = column_definition.FO_Accuracy
    fo.UsePlusPrefix = column_definition.FO_usePlus
    fo.SetSymbolTypeId(DB.ForgeTypeId(column_definition.FO_sym))          
else:
    fo.UseDefault = True

I am guessing that as long as you use the default length format option you won’t be able to set the unit type, which kind of make sense

that seems to be what you are doing

fo.UseDefault = False

check that one

Thank You for the response, it did helped a lot.

Memo for the future: you are not allowed to override the units for the column, but it is allowed to apply different units, as long as they are compatible. So instead of assigning a new unit type to formatOptions, CREATE the formatingOption for the appropriate unit type, format it properly and assign to a column, like in:

fo = DB.FormatOptions(DB.UnitTypeId.SquareMeters) # substitute for for FO_Units in the future perfect

fo.UseDefault = False
fo.RoundingMethod = DB.RoundingMethod.Nearest
fo.Accuracy = column_definition.FO_Accuracy
fo.UsePlusPrefix = column_definition.FO_usePlus
fo.SetSymbolTypeId(DB.ForgeTypeId(column_definition.FO_sym))
...
if fo.IsValidObject:
  with rpw.db.Transaction("Setting column '{}' parameters".format(field.GetName())):
    field.SetFormatOptions(fo)
...
1 Like