<?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: To add new attribute in CADMep+ window in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/to-add-new-attribute-in-cadmep-window/m-p/11129640#M13104</link>
    <description>&lt;P&gt;I could be wrong but I don't think that there are any api's for such specialized palettes and dialogs. However, which properties show up in the QUICKPROPERTIES dialog can be customized in the CUI. Perhaps your custom properties will be recognized there.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Apr 2022 14:40:55 GMT</pubDate>
    <dc:creator>Ed__Jobe</dc:creator>
    <dc:date>2022-04-26T14:40:55Z</dc:date>
    <item>
      <title>To add new attribute in CADMep+ window</title>
      <link>https://forums.autodesk.com/t5/net-forum/to-add-new-attribute-in-cadmep-window/m-p/11128478#M13102</link>
      <description>&lt;P&gt;Hello forum,&lt;BR /&gt;I can fetch and modify the attributed from the CADMEP+ window where I am using AutoCAD CADMep.&lt;BR /&gt;I want to add new attributes to the same window. I can add it using code but can't see it in the property window under CADMep+ section. Please refere image below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SaddamShaikh77_0-1650949504125.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1059361iAB94E3CE6D0B0499/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SaddamShaikh77_0-1650949504125.png" alt="SaddamShaikh77_0-1650949504125.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I can add modify the existing attributes shown in the image above.&lt;/P&gt;&lt;P&gt;I want to add new attributes say ("Test" and Value "123") below Spool or anywhere. The sequence doesn't matter.&lt;BR /&gt;Below is the code sample which I have tried.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public void GetSelectedObjProp()&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;Dictionary&amp;lt;string, Dictionary&amp;lt;string, string&amp;gt;&amp;gt; PropDetails = new Dictionary&amp;lt;string, Dictionary&amp;lt;string, string&amp;gt;&amp;gt;();&lt;BR /&gt;Dictionary&amp;lt;string, string&amp;gt; propVal = new Dictionary&amp;lt;string, string&amp;gt;();&lt;BR /&gt;Document acDoc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;Database acCurDb = acDoc.Database;&lt;BR /&gt;Editor ed = acDoc.Editor;&lt;BR /&gt;using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;PromptSelectionOptions Options = new PromptSelectionOptions();&lt;BR /&gt;Options.SingleOnly = true;&lt;BR /&gt;Options.SinglePickInSpace = true;&lt;BR /&gt;PromptSelectionResult acSSPrompt = acDoc.Editor.GetSelection(Options);&lt;BR /&gt;if (acSSPrompt.Status == PromptStatus.OK)&lt;BR /&gt;{&lt;BR /&gt;SelectionSet acSSet = acSSPrompt.Value;&lt;BR /&gt;foreach (SelectedObject acSSObj in acSSet)&lt;BR /&gt;{&lt;BR /&gt;if (acSSObj != null)&lt;BR /&gt;{&lt;BR /&gt;acDoc.LockDocument();&lt;BR /&gt;Entity acEnt = acTrans.GetObject(acSSObj.ObjectId,OpenMode.ForWrite) as Entity;&lt;BR /&gt;propVal = new Dictionary&amp;lt;string, string&amp;gt;();&lt;BR /&gt;object acadObj = acEnt.AcadObject;&lt;BR /&gt;var props = TypeDescriptor.GetProperties(acadObj);&lt;/P&gt;&lt;P&gt;foreach (PropertyDescriptor prop in props)&lt;BR /&gt;{&lt;BR /&gt;object value = prop.GetValue(acadObj);&lt;BR /&gt;if(prop.DisplayName == "Notes")&lt;BR /&gt;{&lt;BR /&gt;System.ComponentModel.AttributeCollection acol = prop.Attributes;&lt;/P&gt;&lt;P&gt;Attribute attr = new CategoryAttribute("Model123");&lt;BR /&gt;Attribute attr1 = new DescriptionAttribute("Note1234");&lt;BR /&gt;Attribute attr2 = new DesignTimeVisibleAttribute(true);&lt;BR /&gt;Attribute attr3 = new BrowsableAttribute(true);&lt;BR /&gt;Attribute[] attributes = new Attribute[4];&lt;BR /&gt;attributes[0] = attr;&lt;BR /&gt;attributes[1] = attr1;&lt;BR /&gt;attributes[2] = attr2;&lt;BR /&gt;attributes[3] = attr3;&lt;/P&gt;&lt;P&gt;PropertyDescriptor newProp = TypeDescriptor.CreateProperty(prop.ComponentType, prop, attributes);&lt;/P&gt;&lt;P&gt;PropertyDescriptor newProp1 = TypeDescriptor.CreateProperty(typeof(object), "WXYZ1234", typeof(string),&lt;BR /&gt;new BrowsableAttribute(true));&lt;/P&gt;&lt;P&gt;System.ComponentModel.AttributeCollection attrCol = newProp.Attributes;&lt;BR /&gt;int i = attrCol.Count;&lt;/P&gt;&lt;P&gt;TypeDescriptionProvider tdp = TypeDescriptor.AddAttributes(acadObj ,attrCol);&lt;BR /&gt;props.Add(newProp);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (value != null)&lt;BR /&gt;{&lt;BR /&gt;ed.WriteMessage("\n{0} = {1}", prop.DisplayName, value.ToString());&lt;BR /&gt;propVal.Add(prop.DisplayName, value.ToString());&lt;BR /&gt;_attributeValues.Add(new AttributeParams { Name = prop.DisplayName, Value = value.ToString() });&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;string name = "";&lt;BR /&gt;propVal.TryGetValue("Name", out name);&lt;/P&gt;&lt;P&gt;string category = "";&lt;BR /&gt;category = GetCategoryAttribute(name, "Category", acCurDb);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;acTrans.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Please let me know if I am missing something or if there is another way to achieve this.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 05:08:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/to-add-new-attribute-in-cadmep-window/m-p/11128478#M13102</guid>
      <dc:creator>SaddamShaikh77</dc:creator>
      <dc:date>2022-04-26T05:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: To add new attribute in CADMep+ window</title>
      <link>https://forums.autodesk.com/t5/net-forum/to-add-new-attribute-in-cadmep-window/m-p/11128496#M13103</link>
      <description>&lt;P&gt;Also can I modify "CADMep+" to "My Properties" or if I can add new section for "My Properties" and add attributes under it for CADMep?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 05:21:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/to-add-new-attribute-in-cadmep-window/m-p/11128496#M13103</guid>
      <dc:creator>SaddamShaikh77</dc:creator>
      <dc:date>2022-04-26T05:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: To add new attribute in CADMep+ window</title>
      <link>https://forums.autodesk.com/t5/net-forum/to-add-new-attribute-in-cadmep-window/m-p/11129640#M13104</link>
      <description>&lt;P&gt;I could be wrong but I don't think that there are any api's for such specialized palettes and dialogs. However, which properties show up in the QUICKPROPERTIES dialog can be customized in the CUI. Perhaps your custom properties will be recognized there.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 14:40:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/to-add-new-attribute-in-cadmep-window/m-p/11129640#M13104</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2022-04-26T14:40:55Z</dc:date>
    </item>
  </channel>
</rss>

