<?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: C# get lineweight from xml (so by a variable) in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/c-get-lineweight-from-xml-so-by-a-variable/m-p/9418367#M19930</link>
    <description>&lt;P&gt;Works perfect! Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 02 Apr 2020 18:26:12 GMT</pubDate>
    <dc:creator>stefanveurink68AXD</dc:creator>
    <dc:date>2020-04-02T18:26:12Z</dc:date>
    <item>
      <title>C# get lineweight from xml (so by a variable)</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-get-lineweight-from-xml-so-by-a-variable/m-p/9415536#M19928</link>
      <description>&lt;P&gt;So, I want to create layers, who's info is stored in an XML file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the XML file I can get the color and linetype and apply them to the layer.&amp;nbsp; for your info:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;***&lt;/P&gt;&lt;P&gt;newLayer.Color = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, Convert.ToInt16(getlaagkleur(laagnaam)));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;newLayer.LinetypeObjectId = aclintbl[getlaaglinetype(laagnaam)];&lt;/P&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, for the lineweight I have to do it different. Question is how? Cause I can't input a variable with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;***&lt;BR /&gt;newLayer.LineWeight = LineWeight.LineWeight005;&lt;/P&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there's only some standard values I can pick. U not gonna tell me this ain't possible right????&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 17:42:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-get-lineweight-from-xml-so-by-a-variable/m-p/9415536#M19928</guid>
      <dc:creator>stefanveurink68AXD</dc:creator>
      <dc:date>2020-04-01T17:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: C# get lineweight from xml (so by a variable)</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-get-lineweight-from-xml-so-by-a-variable/m-p/9415822#M19929</link>
      <description>&lt;P&gt;"...&amp;nbsp;&lt;SPAN&gt;Cause I can't input a variable with..."? Of course you can, as long as the value you supply is LineWeight enum type. You did no say what data type in the XML for lineweight is. But let's assume it is an integer. SO, you can simply cast it into LineWeight enum type:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;int xmlLw = 5; // assume the value read from XML is 5!)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;newLayer.LineWeight = (LineWeight)xmlLw;&amp;nbsp; //integer 5 is cast as LineWeight.LineWeight005&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If the xml is anything other than integer, then it would be up to you to translate that odd value to whatever LineWeight value appropreately. For example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;object xmlLw = [read from XML];&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;newLayer.LineWeight = ConvertToLineWeight(xmlLw);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;private LineWeight ConvertToLineWeight(object xmlLw)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; var lw = LineWeight.ByLineWeightDefault;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; try&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lw = [Do whatever conversion as needed]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; catch{}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; return lw;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;HTH&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 19:44:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-get-lineweight-from-xml-so-by-a-variable/m-p/9415822#M19929</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2020-04-01T19:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: C# get lineweight from xml (so by a variable)</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-get-lineweight-from-xml-so-by-a-variable/m-p/9418367#M19930</link>
      <description>&lt;P&gt;Works perfect! Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 18:26:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-get-lineweight-from-xml-so-by-a-variable/m-p/9418367#M19930</guid>
      <dc:creator>stefanveurink68AXD</dc:creator>
      <dc:date>2020-04-02T18:26:12Z</dc:date>
    </item>
  </channel>
</rss>

