Revit Lookup and Project values dont match

Hi, im trying to write a script that will change the ‘Start / End Join Cutback’ parameter.
Problem is that the values in the project are 1.27 while in Revit Lookup and my code I get 0.

Has anybody encountered a similar situation?


class ISelectionFilter_beams(ISelectionFilter):
    def AllowElement(self, element):
        """overriding existing method
        you can add more checks
        if you get an error it wont be shown and False will be returned"""
        if type(element) == FamilyInstance and element.Category.Name == 'Structural Framing':
            return True

# create instance from new class
beam_filter = ISelectionFilter_beams()
# invoke selection and filter
ref_picked_beams = [selection.PickObjects(ObjectType.Element, beam_filter)]
picked_beams = [doc.GetElement(ref) for ref in ref_picked_beams]
if (picked_beams):
    for beam in picked_beams:
        param_start_join_cutback = beam.get_Parameter(BuiltInParameter.START_JOIN_CUTBACK)
        param_end_join_cutback   = beam.get_Parameter(BuiltInParameter.END_JOIN_CUTBACK)
        print('start join cutback: {}'.format(param_start_join_cutback.AsInteger()))
        print('end join cutback: {}'.format(param_end_join_cutback.AsInteger()))
else:
    print('No selected beams')

# ---------------------------------------------------------
print(50 * '-')
print('Script -{}- has finished running'.format(__title__))

@IdoRevit ,

i just tested this way

uidoc = __revit__.ActiveUIDocument
doc   = __revit__.ActiveUIDocument.Document

# 0️⃣ collect
beams = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralFraming).WhereElementIsNotElementType().ToElements()

# 1️⃣ start extension
startPoints = [i.get_Parameter(BuiltInParameter.START_EXTENSION).AsDouble() for i in beams]

# 2️⃣ end extension
endPoints = [i.get_Parameter(BuiltInParameter.END_EXTENSION).AsDouble() for i in beams]

# ✅ result
for i in zip(startPoints,endPoints):
    print(i)

1 Like

Thank you. I assumed its an int (even though its not a whole number :expressionless:) and didnt check the storage type.
But even when i use the AsDouble() method I still dont get that 1.27.
Maybe its because of the data structure Double?
I dont see something similar to 1.27 or 0.0127 in your prints as well…

@IdoRevit

thats a unit topic

here it is explained well. and the snipptets work also in clean python.

@andreasd811 ,
It appears so that the actual value in Revit is stored in feet but the properties in my project are set to cm.
Is it right to assume that all length are stored in feet?
How can I know the measuring unit for each parameter?
Sounds exhausting to try to match everything…

@IdoRevit

by default it is imperial system…

when you use it inside your transactions it is well.

But when it comes to a result you have to set the correct units.

@andreasd811 ,
So let me see if i got it right,
Where I from we work with the metric system and if I want for example to set the length of some element to lets say 1.5m, I have to:

  1. convert the 1.5m to feet
  2. parameter.Set(‘new_length’)
  3. transaction.commit()
    Or in simple words commit the values in Imperial system only?

@IdoRevit

i have this helper… its depending what and when you handle the data.

1 Like

For the sake of getting it clearly stated for others:

Revit length are stored in Decimal feet

2 Likes