Quick rundown of what im trying to do. User selects all the beams, the code is inserting a family at all end points and specified maxing spacings along the beams, this is creating duplicates at all the end points. Is there a way to collect these and delete the duplicates while inserting an element?
I have attempted to make a lists of all the xyz coordinates and compare them but i havent been successful yet. Im wondering if there is something in the api that will return these duplicates that i can then delete.
i did find, DuplicateInstances Property in the revit api, but i havent figured out how to use it.
i managed to filter out the duplicates before inserting the family, i had to round the coordinates to just a few decimal places, as they werent exactly the same for some reason even though they were based off the same start and endpoints.
And yes that’s correct. Computers are pretty bad at floating point precision. It’s because of the way they’re stored in memory. When comparing 2 floats It’s always best to add in a margin to make sure.
You may have noticed that a float that should be uhm say 5.0 actually prints as 4.9999…? Same issue.
Anyway, XYZ objects have a XYZ.IsAlmostEqualTo( otherXYZ) function for that.
You can use that to easily compare points.
As for regular floats, best make a function for comparisson.