FamilyInstance.ByPoint

Hi! I am trying to insert a bunch of Generic Models (Panels) to fill a “surface”, to do so I am finding the insertion points for the panels on the surface.
What is throwing me off is If I do so In one direction I get a perfect result. But is the other direction (cross direction) Although It returns all the panels the panels are placed almost randomly, not a single one it placed in the specified location.

snip1

As you can see the points on the surface are correct and spaced correctly. If I aligned the panels manually everything fits nice.

Any ideas?

That is the code I use to insert the Panels.

import clr
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
from Revit.Elements import *
clr.AddReference('System')
from System.Collections.Generic import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
symbol = UnwrapElement(IN[0])
refPlane = UnwrapElement(IN[1][0])
location = UnwrapElement(IN[2])
referenceDirection = UnwrapElement(IN[3])
out = []

if type(refPlane) == "List":
	refPlane = refPlane[0]

TransactionManager.Instance.EnsureInTransaction(doc)

if symbol.IsActive == False:
	symbol.Activate()

doc.Regenerate()	

reference = Reference(refPlane)

for z in location:
	r1=[]
	for e in z:
		new = doc.Create.NewFamilyInstance(reference,e.ToXyz(),referenceDirection.ToXyz(),symbol)
		r1.append(new)
	out.append(r1)
TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = out

Thanks!