Resize cut length of family instance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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;
}
}
}