Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Uncut beam and column by api?

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
766 Views, 2 Replies

Uncut beam and column by api?

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

 

 

Tags (4)
2 REPLIES 2
Message 2 of 3
jeremytammik
in reply to: Anonymous

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

Message 3 of 3
Anonymous
in reply to: jeremytammik

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?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community