Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Duplicate FloorType

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
724 Views, 2 Replies

Duplicate FloorType

Hi All,

I was trying to duplicate floor types with code below. It looks working but for some reason it's not reflected on Revit Type Selector. I tested it with dynamo and the new type is showing there..Something am i missing? Thanks.

 

                {
                    FloorType floorType = new FilteredElementCollector(doc)
                    .OfClass(typeof(FloorType))
                    .WhereElementIsElementType()
                    .Cast<FloorType>()
                    .Last();

                    Element newType = floorType.Duplicate("SAMPLE TYPE");
                    doc.Regenerate();
                    
                }

Untitled.png

2 REPLIES 2
Message 2 of 3
recepagah12
in reply to: Anonymous

I tested the same code in Revit 2020 and it worked. Did you write this code in open transaction? Also, you don't need to regenerate the document. Also, don't forget the test if the floor type is null or not. If you have any further question don't hesitate to ask?

 

I hope this helps,

Recep.

 

 

Tags (2)
Message 3 of 3
Anonymous
in reply to: recepagah12

yeah it works after i restart mu revit. Cheers!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community