Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

problem with the "symbol" parameter in the code for creating window in Revit

toan-nghia_le
Explorer

problem with the "symbol" parameter in the code for creating window in Revit

toan-nghia_le
Explorer
Explorer

Hi guys,

I'm trying to make a plug-in in Revit by using python, pyrevit and i also have an user interface to take and place a window on the wall in Revit.

Actually, i'm facing this kind of problem.
I'm trying to create a new family instance using the doc.Create.NewFamilyInstance method.
I think the potential causes is that the parameter "symbol" cannot be null.
for more information, I added the window types manually.

toannghia_le_1-1685457709969.png

this is a part of the code:

toannghia_le_2-1685458026068.png

toannghia_le_3-1685458065013.png

can anyone help me to fix this kind of problem? Pls

Reply
293 Views
3 Replies
Replies (3)

mhannonQ65N2
Advocate
Advocate

You didn't share the code where you call doc.Create.NewFamilyInstance.

toan-nghia_le
Explorer
Explorer

sorry, my fault

this is the code with NewFamilyInstance methode

toannghia_le_0-1685516445001.png

 

0 Likes

RPTHOMAS108
Mentor
Mentor

You should not be using integers to create ElementIds representing FamilySymbols, you should be filtering for such with FilteredElementCollector.

 

It's not relevant that you have a type in the model named '34 x 36' since you've not used that name to find anything named that, so as a starting point filter for a type named that.

 

If it is telling you there is an ArgumentNullException for that Symbol argument then that is pretty clear as to what is wrong.

 

Not sure what you are trying to do by getting a face from the wall and creating an offset but that isn't the easiest way of putting a window in a wall with that overload.

 

Refer to the example in RevitAPI.chm for:

ItemFactoryBase.NewFamilyInstance(XYZ, FamilySymbol, Element, StructuralType).

 

From that it is evident that the point should be on the centreline of the wall, which you can get via it's location property (LocationCurve).

0 Likes