Resize cut length of family instance

Resize cut length of family instance

Anonymous
Not applicable
727 Views
1 Reply
Message 1 of 2

Resize cut length of family instance

Anonymous
Not applicable

Hello,

 

I want to resize the cut length of the family Instance. Firstly I get cut length and length of the family instance and I want to make the cut length equal to  length of the family Instance.

 

 

Firstly I get cut length and length of the family instance then I want to substract cut length from length and I get new value.If I add that value in the cut length I will get new cut length which is equal to length of the family instance.This is my target.How I achieve this?

 

what changes should I make in this code?

 

 

 

 

 

Here is the code which I am using:

 

using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace JoinGeometry
{
     [Transaction(TransactionMode.Manual)]
    class WBjoin
    {


           public Result Execute(ExternalCommandData commandData)
           {
                  UIApplication uiApp = commandData.Application;
                  UIDocument uidoc = uiApp.ActiveUIDocument;
                  Document doc = uidoc.Document;


                 try

                 {
                              FilteredElementCollector wallbeam = new FilteredElementCollector(doc, doc.ActiveView.Id);

                              wallbeam.OfClass(typeof(FamilyInstance));
                              wallbeam.OfCategory(BuiltInCategory.OST_StructuralFraming);
                              foreach (FamilyInstance bem in wallbeam)
                              {

                                              using (Transaction t = new Transaction(doc, "Join All Walls/beam"))
                                               {
                                                            t.Start();
                                                           BuiltInParameter paraIndex = BuiltInParameter.STRUCTURAL_FRAME_CUT_LENGTH;
                                                           Parameter parameter =bem.get_Parameter(paraIndex);
                                                            double hypotenuse = parameter.AsDouble();

                                                              TaskDialog.Show("Revit", "cut length=" + hypotenuse);

 

                                                              t.Commit();
                                                 }

                               }


                    }

                    catch
                    {
                                  TaskDialog.Show("Revit", "not join");
                     }


                return Result.Succeeded;
            }
        }
}

 

 

0 Likes
728 Views
1 Reply
Reply (1)
Message 2 of 2

Aaron.Lu
Autodesk
Autodesk
call parameter.Set(1.0) to set cut length to 1.0 feet


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes