Uncut beam and column by api?

Uncut beam and column by api?

Anonymous
Not applicable
953 Views
2 Replies
Message 1 of 3

Uncut beam and column by api?

Anonymous
Not applicable

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?

beamAndColumn.png

 

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);
            }
        }
    }
}

 

 

954 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk

Have you tried using the GeometryInstance class GetSymbolGeometry method?

 

http://www.revitapidocs.com/2017/7daa0e66-9921-3214-91f4-028e8cfd2618.htm

 

"Computes the geometric representation of the symbol which generates this instance."

 

Merry Xmas!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thank you for your reply.

 

Could you please provide more information about that?

 

I want to export the revit model into ifc file without cut between columns and beams. Can I achieve this by using GetSymbolGeometry?

0 Likes