Wrong Position with FamilyInstance.ByPoint and FamilyInstance.Coordinates

Hi Everyone,

This is my first post here, I want to thanks all of you for the great help that I already find here for many question.

I’m writing because, have a problem with dynamo 1.3.2 on revit 2016.

I made a dynamo script that create the support structure for mep, one of the family (the round hanger) is placed using the node FamilyInstance.ByPoint

the calculation is made by extracting the line of the duct and then subdividing it, to find the coordinate were to place the the family of the hanger and all the other elements.

the strange thing is that the first time I run the script the hanger are placed on the wrong position (picture 1), I need to select again the duct and rerun the definition, to have the hangers in the correct positions. (picture 2)

I tried also the node FamilyInstance.Coordinates but I have the same rusult.

does anyone have the some problem? Is there a solution?