Invisible lines Style

Invisible lines Style

Anonymous
Not applicable
1,807 Views
3 Replies
Message 1 of 4

Invisible lines Style

Anonymous
Not applicable

Im starter in working with revit API and i have a question about the invisible lines style. I want to draw a detail line with this style using API. Is this possible to do that?

0 Likes
Accepted solutions (1)
1,808 Views
3 Replies
Replies (3)
Message 2 of 4

matthew_taylor
Advisor
Advisor
Hi,
If you are referring to the style '<invisible lines>' (or something like that), then yes. Just use a filter (filteredelementcollector that looks for a style of that name. I'm unaware of a language independent way of doing that.

Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks for your reply 

this is my code but it doesn't work

 


public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements)
{

Document doc = revit.Application.ActiveUIDocument.Document;
Application app = revit.Application.Application;
XYZ st = new XYZ(0, 0, 0);
XYZ end = new XYZ(1000, 1000, 0);
Line geomline = Line.CreateBound(st, end);
View v = doc.ActiveView;
Autodesk.Revit.Creation.Document doc1 = doc.Create;
DetailCurve l1 = doc1.NewDetailCurve(v, geomline);

Categories categories = doc.Settings.Categories;
FilteredElementCollector col = new FilteredElementCollector(doc);
col.OfCategory(BuiltInCategory.OST_InvisibleLines);

l1.LineStyle = (GraphicsStyle)col;

0 Likes
Message 4 of 4

FAIR59
Advisor
Advisor
Accepted solution
            List<GraphicsStyle> _styles = new FilteredElementCollector(doc)
            .OfClass(typeof(GraphicsStyle))
            .Cast<GraphicsStyle>()
            .ToList();

            GraphicsStyle invisibleLineStyle = null;
            foreach (GraphicsStyle g in _styles)
            {
                if (g.Name == "<Invisible lines>")
                {
                    invisibleLineStyle = g;
                    break;
                }
            }
0 Likes