Line Style and a Line Pattern

Line Style and a Line Pattern

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

Line Style and a Line Pattern

Anonymous
Not applicable

How to get the relationship between a Line Style and a Line Pattern in Ravit API version 2014/15/16

0 Likes
1,242 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

As you can see here a Line Style has a SetLinePatternId so there is your relationship.

 

http://thebuildingcoder.typepad.com/blog/2016/10/how-to-create-a-new-line-style.html

 

0 Likes
Message 3 of 4

solvedplus
Enthusiast
Enthusiast

this is good article for set line pattern

what about retrieving line pattern associated with line style?

there is no GetLinePattern method

what do i miss here?

thanks

 

 

0 Likes
Message 4 of 4

solvedplus
Enthusiast
Enthusiast

i'm very sorry

I figure out where the problem is
I'm using revit 2016
i tried newer version 
its working but not all line styles return line pattern

 

public void GetLineStyleAndPattern()
        {
            UIDocument uidoc = this.ActiveUIDocument;
            Document doc = uidoc.Document;
            Categories categories = doc.Settings.Categories;
            string s = "";
            Element e;
            Category lineCat = categories.get_Item(BuiltInCategory.OST_Lines );
            foreach (Category lp in lineCat.SubCategories.Cast<Category>())
            {
                e = doc.GetElement(lp.GetLinePatternId(GraphicsStyleType.Projection)) as Element;
                if (e != null)
                    s += "Style : " + lp.Name + " pattern : " + e.Name + "\n";
                else
                    s += "Style : " + lp.Name + "\n";
            }
            TaskDialog.Show("test", s);
        }

 

Forum_LineStyles.png

0 Likes