cdhit
cdhit

Reputation: 1454

Revit .Net API has function overloading, however Python doesn't support overloading

I am using this function - NewFamilyInstance Method (Line, FamilySymbol, View). However, this function has overloading in API.

enter image description here

The .net support function overloading, however Python doesn't support that. How can Revit Python API work in this case?

When I use one of these functions and pass the different parameters, how can this work properly?

fis = db.Collector(of_class='FamilyInstance')

start_point = XYZ(1, 0, 0)
end_point = XYZ(2, 0, 0)

line = Line.new(start_point, end_point)

views = db.Collector(of_class='View')
ItemFactoryBase.NewFamilyInstance(line, fis[1].Symbol, views[1])

The code above gave me the following error in RevitPythonShell

ItemFactoryBase.NewFamilyInstance(line, fis[1].Symbol, views[1])

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: NewFamilyInstance() takes at least 4 arguments (3 given)

I just found it might be not caused by function overloading. Actually this function is not a static method but a common method.

The

However, when I tried to initilize it and get an instance of the class. It complained - no public constructor.

enter image description here

Upvotes: 0

Views: 143

Answers (0)

Related Questions