Message 1 of 3
Uncut beam and column by api?

Not applicable
12-25-2016
01:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am new in Revit develop.
I want to uncut the beam and column as shown in the picture.
I can do it manually, by "modify > geometry > uncut".
I want to do it by api.
I try to use SolidSolidCutUtils.RemoveCutBetweenSolids(doc, e1, e2); where e1 is the beam and e2 is the column but nothing happened.
Does anyone know the correct way to do it?
My code is something like this:
using Autodesk.Revit.DB; using Autodesk.Revit.UI; using Autodesk.Revit.Attributes; [TransactionAttribute(TransactionMode.Manual)] [RegenerationAttribute(RegenerationOption.Manual)] public class Unjoin : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiApp = commandData.Application; Document doc = uiApp.ActiveUIDocument.Document; Transaction trans = new Transaction(doc); trans.Start("Unjoin"); unjoin(doc, BuiltInCategory.OST_Columns); unjoin(doc, BuiltInCategory.OST_Walls); unjoin(doc, BuiltInCategory.OST_StructuralFraming); trans.Commit(); return Result.Succeeded; } void unjoin(Document doc, BuiltInCategory cat) { foreach (Element e1 in new FilteredElementCollector(doc).OfCategory(cat)) { foreach (ElementId id in SolidSolidCutUtils.GetCuttingSolids(e1)) { Element e2 = doc.GetElement(id); SolidSolidCutUtils.RemoveCutBetweenSolids(doc, e1, e2); } foreach (ElementId id in SolidSolidCutUtils.GetSolidsBeingCut(e1)) { Element e2 = doc.GetElement(id); SolidSolidCutUtils.RemoveCutBetweenSolids(doc, e2, e1); } foreach (ElementId id in JoinGeometryUtils.GetJoinedElements(doc, e1)) { Element e2 = doc.GetElement(id); JoinGeometryUtils.UnjoinGeometry(doc, e1, e2); SolidSolidCutUtils.RemoveCutBetweenSolids(doc, e1, e2); } } } }