Inserting Level based family within a family document, prior to Revit 2024

Inserting Level based family within a family document, prior to Revit 2024

alanmlevy
Contributor Contributor
373 Views
5 Replies
Message 1 of 6

Inserting Level based family within a family document, prior to Revit 2024

alanmlevy
Contributor
Contributor

I was trying to add a level based family (e.g., structural column) to a family document in Revit 2023, but I see that there is no method in FamilyItemFactory that includes level. I did notice that Revit 2024 has added a method to FamilyItemFactory that includes level, but I am not yet using Revit 2024. Is there any way to accomplish this in versions prior to Revit 2024?

0 Likes
Accepted solutions (1)
374 Views
5 Replies
Replies (5)
Message 2 of 6

Mohamed_Arshad
Advisor
Advisor

Hi @alanmlevy 

Are you trying to place a column in the family document?


Mohamed Arshad K
Software Developer (CAD & BIM)

0 Likes
Message 3 of 6

alanmlevy
Contributor
Contributor

Yes that's correct.

0 Likes
Message 4 of 6

Mohamed_Arshad
Advisor
Advisor
Accepted solution

Hi @alanmlevy,


  As you mentioned, there is no direct method for Inserting a Column in FamilyDocument for Revit 2023 and lower versions too. In 2024 it has been updated.  

  But using NewFamilyInstances2( List<FamilyInstanceCreationData> dataList) you can Insert a column in Family Document. Kindly check the below code for additional reference.

 

Reference Code:

 

 

  using (Transaction insertColumn=new Transaction(doc,"Insert Column"))
            {
                insertColumn.Start();

                if(!sym.IsActive)
                {
                    sym.Activate();
                }


                FamilyInstanceCreationData data = new FamilyInstanceCreationData(new XYZ(0, 0, 0), sym, level, StructuralType.Column);

                doc.FamilyCreate.NewFamilyInstances2(new List<FamilyInstanceCreationData>() { data });

                insertColumn.Commit();
            }

 

 

 

Hope this will Helps 🙂


Mohamed Arshad K
Software Developer (CAD & BIM)

Message 5 of 6

alanmlevy
Contributor
Contributor

I didn't think to use that, but it looks like it should work. Thanks!

0 Likes
Message 6 of 6

alanmlevy
Contributor
Contributor

Do you happen to know if there is a way of determining if the Family/FamilySymbol is level-based without doing try/catch on the error? I didn't see a method or property that would tell me that in either of the Family or FamilySymbol classes.

 

Edit: Never mind, I think I found it - the FamilyPlacementType Property under the Family Class.

0 Likes