How to create a column??

How to create a column??

Anonymous
Not applicable
3,350 Views
1 Reply
Message 1 of 2

How to create a column??

Anonymous
Not applicable

I referred to Jeremy's Post "Inserting a Column" at Revit 2019, but there are errors . 

-CmdResult 

-Filter

-doc.get_Elements

CmdResult rc
  = CmdResult.Failed;
 
Application app = commandData.Application;
Document doc = app.ActiveDocument;

List<Element> symbols = new List<Element>();
 
Filter filter = app.Create.Filter.NewFamilyFilter(
  family_name );
 
doc.get_Elements( filter, symbols );

So i tried another way but the errors too.

 

This code is my second try.

 

// Get a Column type from Revit
FilteredElementCollector collector = new FilteredElementCollector(doc);
collector.OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_StructuralColumns);
FamilySymbol columnType = collector.FirstElement() as FamilySymbol;
Level level = Level.Create(doc, 20);
FamilyInstance instance = null;
if (null != columnType)
{
// Create a column at the origin
XYZ origin = new XYZ(0, 0, 0);

instance = doc.Create.NewFamilyInstance(origin, columnType, level, StructuralType.Column);
}

 

 

Someone helps me plz!

I use c#.

0 Likes
Accepted solutions (1)
3,351 Views
1 Reply
Reply (1)
Message 2 of 2

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @Anonymous ,

I checked your code and it works fine for me.

1)after collecting the structural column using the FilteredElementCollector check whether the column elements are present inside the collector or not.

2)try to activate the familysymbol 

FamilySymbol FS;
if(!FS.IsActive)
                    {
                        FS.Activate();
                        doc.Regenerate();
                    }

3)After running your code if your columns are not visible then open the 3D view and check whether columns are present in the project or not.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes