[Revit API] How to add Symbolic lines into shaft openning?

[Revit API] How to add Symbolic lines into shaft openning?

huynguyen96str
Explorer Explorer
796 Views
2 Replies
Message 1 of 3

[Revit API] How to add Symbolic lines into shaft openning?

huynguyen96str
Explorer
Explorer

hello everyone!!

I have the code below to create the shaft opening . but I don't know how to add symbolic lines .

            uiapp = commandData.Application;
            uidoc = uiapp.ActiveUIDocument;
            doc = uidoc.Document;
            var filter = new FilteredElementCollector(doc).OfClass(typeof(Level)).OfCategory(BuiltInCategory.OST_Levels).Cast<Level>().ToList();
            CurveArray curveArray = new CurveArray();
            Line l1 = Line.CreateBound(XYZ.Zero, new XYZ(1,0,0));
            Line l2 = Line.CreateBound(new XYZ(1, 0, 0), new XYZ(1, 1, 0));
            Line l3 = Line.CreateBound(new XYZ(1, 1, 0), new XYZ(0, 1, 0));
            Line l4 = Line.CreateBound(new XYZ(0, 1, 0), XYZ.Zero);
            curveArray.Append(l1);
            curveArray.Append(l2);
            curveArray.Append(l3);
            curveArray.Append(l4);
 
            using (Transaction tr= new Transaction(doc))
            {
                tr.Start("strat");
                Opening opening = doc.Create.NewOpening(filter[0], filter[1], curveArray);
                tr.Commit();
            }

 Picture(description)

huynguyen96str_0-1638669016298.png

 

Hope someone can guide me on this!!
Thanks all!!

0 Likes
797 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

Is a symbolic line a detail line? Can detail lines exist only in detail views, or plan views, or where? Have you researched how to achieve this manually through the end user interface? In general, the best way to approach a Revit API programming task is to determine the optimal workflow and best practices manually in the UI first, before addressing the programming steps. Here are some articles from The Building Coder that will certainly help:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

huynguyen96str
Explorer
Explorer

Thank you very much, I will study them again

0 Likes