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: 

Beams and Column creation within a project

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
807 Views, 5 Replies

Beams and Column creation within a project

I've created a program to create concrete beams and columns while you are working in a project(NOT IN FAMILY EDITOR) What I would like to accomplish is if user enters an already existing size (type), I want the program to place that size instead of throwing the exception that comes if the family symbol name already exists. The program has the try/catch for that error, but is there any way to catch and then invoke the place by family instance command instead of catching the error? Please help. the programming language is C#. 

 

Thank you in advance.

 

 

 

Tags (1)
5 REPLIES 5
Message 2 of 6
jeremytammik
in reply to: Anonymous

Please take a look at the Revit SDK sample CreateBeamsColumnsBraces.

 

  • Revit/2018/SDK/Samples/CreateBeamsColumnsBraces

 

That will hopefully answer your question in full.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 6
Anonymous
in reply to: jeremytammik

Jeremy,

 

Thank you for your response. Your program lists the families already existing in the project. My program asks the user to type in their desired size, so if it already exists, i want the user to place that size. ON the contrary, if the size doesnt it exists, it creates it and allows you to place it. However the program spits out the revit.exception that the size(family symbol name) already exists and exits the program. Like I said previously, is there anyway to avoid the exception?

Message 4 of 6
RPTHOMAS108
in reply to: Anonymous

You avoid the exception by looking for the existing FamilySymbol first (filtering).

 

Use one of the Document.LoadFamilySymbol overloads in preference to loading the family and all of it's symbols via LoadFamily.

 

Note you also need to activate the FamilySymbol if it hasn't already been used and you want to use it (check FamilySymbol.IsActive).

 

Picking the right NewFamilyInstance overload to use depends on purpose of element.

Message 5 of 6
Anonymous
in reply to: RPTHOMAS108

RPThomas108,

 

thank you. I have the first part, but the family is already loaded in, and I would like to duplicate the family symbol, rename and change the parameters within a project. See code below.

FilteredElementCollector concRoundcollector = new FilteredElementCollector(doc).OfClass(typeof(Family));
		foreach (Family family in concRoundcollector)
			{
				if (family.Name == familyName)
			{
			foreach (var symbolid in family.GetFamilySymbolIds())
			{
				var symbol = doc.GetElement(symbolid) as FamilySymbol;
				if (symbol.Name == newFamilySymbolname)
// newFamilySymbolname is being pulled from a form { uidoc.PromptForFamilyInstancePlacement(symbol); } else { // Transaction here to duplicate family symbol, // rename, set parameters and place. If I comment out the else. it works where. The else give me the error.
Message 6 of 6
Anonymous
in reply to: Anonymous

Hello desantis15,

 

Were you able to figure this out? I am running into a similar issue. Can't seem to figure out how to create a new familyInstance from scratch, or even duplicate one then try to edit the properties. 

 

 

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

Post to forums  

Autodesk Design & Make Report