Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to duplicate then resize their family type, and create a new one with a new name. How to do that?
Solved! Go to Solution.
I want to duplicate then resize their family type, and create a new one with a new name. How to do that?
Solved! Go to Solution.
Hi @konrad.pEGTVF
Kindly follow the below steps
1. Filter Family Symbol
2. Duplicate the Symbol
3. Access the Parameters and Change the Value.
I think you have already posted the same question. I answered the same is threre any issue with the answer ?🙂
https://forums.autodesk.com/t5/revit-api-forum/how-to-resize-certain-revit-families-using-c-code/m-p...
Reference Code:
FamilySymbol furnitureSymbol = new FilteredElementCollector(doc)
.OfClass(typeof(FamilySymbol))
.OfCategory(BuiltInCategory.OST_Windows)
.Where(x => x.Name.Equals("0406 x 0610mm"))
.First() as FamilySymbol;
using (Transaction duplicateAndEditParameter=new Transaction(doc,"Duplicate and Edit Parameter"))
{
duplicateAndEditParameter.Start();
FamilySymbol newSymbol= furnitureSymbol.Duplicate("600 x 600mm") as FamilySymbol;
//Access Parameter
newSymbol.get_Parameter(BuiltInParameter.FAMILY_HEIGHT_PARAM).Set(600 / 304.8);
newSymbol.get_Parameter(BuiltInParameter.FURNITURE_WIDTH).Set(600 / 304.8);
duplicateAndEditParameter.Commit();
}
Hope this will Helps 🙂
Thank you, let me try this out? What about the lengths?
In Revit API we have two types of parameter
1.BuiltInParameter (System Parameters)
2. User Defined Parameter
To access the parameter through API we have two Methods.
1. get_parameter (For Built In Parameters)
2. Lookup Parameter (User-Defined Parameters)
If you need to access the length, First you have check whether the parameter was Built-In or User-Defined parameter,
Then choose the Revit API Method and Set the value. This will common for all parameters.
For Your Example
newSymbol.LookupParameter("Length").Set(50 / 304.8); //If it is System Family you can use get_Parameter()
Hope this will helps 🙂
So these ones I can get by using the following (as they are probably not built in parameters, right?):
newSymbol.LookupParameter("W").Set(50 / 304.8);
newSymbol.LookupParameter("L").Set(50 / 304.8);
newSymbol.LookupParameter("H").Set(50 / 304.8);
Is this the correct way to get these?
Yes, absolutely correct 🙂
But little changes are needed, In Example code I used 304.8 it is a Unit Conversion (Feet to mm) because My Project units are in Millimeters. But in your case, the project unit is on Feet, So you can give the value directly no need for unit conversion.
Note :
Revit's Default Unit is in Feet.
Hope this will help 🙂