How to change the Height, Width and Length of the Products / Items (chairs, tables etc.) for their Family Types?

How to change the Height, Width and Length of the Products / Items (chairs, tables etc.) for their Family Types?

konrad.pEGTVF
Contributor Contributor
526 Views
5 Replies
Message 1 of 6

How to change the Height, Width and Length of the Products / Items (chairs, tables etc.) for their Family Types?

konrad.pEGTVF
Contributor
Contributor

I want to duplicate then resize their family type, and create a new one with a new name. How to do that?

0 Likes
Accepted solutions (3)
527 Views
5 Replies
Replies (5)
Message 2 of 6

Mohamed_Arshad
Advisor
Advisor
Accepted 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 🙂


Mohamed Arshad K
Software Developer (CAD & BIM)

Message 3 of 6

konrad.pEGTVF
Contributor
Contributor

Thank you, let me try this out? What about the lengths?

0 Likes
Message 4 of 6

Mohamed_Arshad
Advisor
Advisor
Accepted solution

HI @konrad.pEGTVF 
   

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 🙂

 


Mohamed Arshad K
Software Developer (CAD & BIM)

Message 5 of 6

konrad.pEGTVF
Contributor
Contributor

konradpEGTVF_0-1694432023504.png

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?

Message 6 of 6

Mohamed_Arshad
Advisor
Advisor
Accepted solution

HI @konrad.pEGTVF 
   

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 🙂


Mohamed Arshad K
Software Developer (CAD & BIM)