<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Assign line pattern to model line in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-assign-line-pattern-to-model-line/m-p/6384141#M64958</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in Revit 2017, you can use Category.SetLinePatternId:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/revit-api/how-to-set-line-pattern-in-line-style/td-p/3731078" target="_blank"&gt;http://forums.autodesk.com/t5/revit-api/how-to-set-line-pattern-in-line-style/td-p/3731078&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Revitalizer&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jun 2016 07:59:29 GMT</pubDate>
    <dc:creator>Revitalizer</dc:creator>
    <dc:date>2016-06-15T07:59:29Z</dc:date>
    <item>
      <title>How to Assign line pattern to model line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-assign-line-pattern-to-model-line/m-p/6379176#M64957</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to create my linePattern. I can create the model line. I can assign a color to the line. How do I assign my LinePatternElement to my model line so it shows up dashed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public void createGraphicsStyle()
		{
			
			
			Autodesk.Revit.DB.Document doc = this.ActiveUIDocument.Document;
			
			 //create an arc first
			 XYZ end0 = new Autodesk.Revit.DB.XYZ(0, 1, 0);
                XYZ end1 = new Autodesk.Revit.DB.XYZ(0, 2, 0);
                XYZ pointOnArc = new XYZ(.2,.5,0);
                
                 Transaction trans = new Transaction(doc,"create model arc");
                trans.Start();
                
                //try to get existing line style
                string nameOfCategory = "AuditoriumMaker Row Layout Lines";
                string nameOfLinePattern = "AuditoriumMaker Row Layout Line Pattern";
                Color auditoriumMakerRowLayoutLineColor = new Color(238, 132, 63);
                Category myCategory = doc.Settings.Categories.get_Item(BuiltInCategory.OST_Lines);
                if(myCategory.SubCategories != null)
                {
                	foreach (var element in myCategory.SubCategories)
                	{
                		Category cat = element as Category;
                		if(cat.Name == nameOfCategory)
                		{
                			trans.Commit();
                			return;
                		}
                	}
                }
                
                
                //Make the custom line pattern
                LinePattern myLinePattern = new LinePattern(nameOfLinePattern);
                IList&amp;lt;LinePatternSegment&amp;gt; rowLayoutLinePatternSegmentList = new List&amp;lt;LinePatternSegment&amp;gt;();
                LinePatternSegment lineSeg1 = new LinePatternSegment(LinePatternSegmentType.Dash, .010);
                LinePatternSegment lineSeg2 = new LinePatternSegment(LinePatternSegmentType.Space, .010);
                rowLayoutLinePatternSegmentList.Add(lineSeg1);
                rowLayoutLinePatternSegmentList.Add(lineSeg2);
                rowLayoutLinePatternSegmentList.Add(lineSeg1);
                rowLayoutLinePatternSegmentList.Add(lineSeg2);
                myLinePattern.SetSegments(rowLayoutLinePatternSegmentList);
                LinePatternElement myNewLinePatternElement = LinePatternElement.Create(doc, myLinePattern);
                
                //assign the line pattern to the element
                myNewLinePatternElement.SetLinePattern(myLinePattern);
               
                //create line style
                Category parentCategory = doc.Settings.Categories.get_Item(BuiltInCategory.OST_Lines);
                myCategory = doc.Settings.Categories.NewSubcategory(parentCategory, nameOfCategory);
                myCategory.LineColor = auditoriumMakerRowLayoutLineColor;
                
                //myCategory.LinePatternElement??????????
                
                
                Plane myPlane = new Plane(new XYZ(0,0,1), new XYZ(0,0,0));
                SketchPlane mySketchPlane = SketchPlane.Create(doc, myPlane);

                Arc arc = Arc.Create(end0, end1, pointOnArc);
                
               
                ModelArc modelArc = doc.Create.NewModelCurve(arc, mySketchPlane) as ModelArc;
                
                //assign the LineStyle to the modelArc
                GraphicsStyle gs = myCategory.GetGraphicsStyle(GraphicsStyleType.Projection);
                modelArc.LineStyle = gs;
                
                
                trans.Commit();&lt;/PRE&gt;</description>
      <pubDate>Sun, 12 Jun 2016 15:16:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-assign-line-pattern-to-model-line/m-p/6379176#M64957</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-12T15:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign line pattern to model line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-assign-line-pattern-to-model-line/m-p/6384141#M64958</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in Revit 2017, you can use Category.SetLinePatternId:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/revit-api/how-to-set-line-pattern-in-line-style/td-p/3731078" target="_blank"&gt;http://forums.autodesk.com/t5/revit-api/how-to-set-line-pattern-in-line-style/td-p/3731078&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Revitalizer&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 07:59:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-assign-line-pattern-to-model-line/m-p/6384141#M64958</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2016-06-15T07:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign line pattern to model line</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-assign-line-pattern-to-model-line/m-p/6430869#M64959</link>
      <description>Yes, Category.SetLinePatternId is the solution, however, prior to 2017, Revit doesn't support LinePattern modification for category yet.</description>
      <pubDate>Tue, 12 Jul 2016 09:04:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-assign-line-pattern-to-model-line/m-p/6430869#M64959</guid>
      <dc:creator>JimJia</dc:creator>
      <dc:date>2016-07-12T09:04:56Z</dc:date>
    </item>
  </channel>
</rss>

