<?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: Getting PropertySetDefinition Value of an object in Civil 3D Customization Forum</title>
    <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/11495926#M4786</link>
    <description>&lt;P&gt;HI &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3452687"&gt;@lumoric&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because he gives a&amp;nbsp; NULL&amp;nbsp; when he REEGING OBJECTID&lt;/P&gt;&lt;P&gt;&amp;nbsp;as in Image&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TRY :&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; [CommandMethod("TESTPropSets")]
        public void PropSets()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            CivilDocument doc = CivilApplication.ActiveDocument;


            // select a  TIN surface
            PromptEntityOptions opSelSurface = new PromptEntityOptions("\nSelect a TIN Surface: ");
            opSelSurface.SetRejectMessage("\nOnly TIN Surface is allowed");
            opSelSurface.AddAllowedClass(typeof(TinSurface), true);
            opSelSurface.AppendKeywordsToMessage = true;
            PromptEntityResult resSelSurface = ed.GetEntity(opSelSurface);
            ObjectId surfaceId = resSelSurface.ObjectId;
            Database db = Application.DocumentManager.MdiActiveDocument.Database;

            using (Transaction transsrc=db.TransactionManager.StartTransaction())
            {
                TinSurface surface = transsrc.GetObject(surfaceId, OpenMode.ForWrite) as TinSurface;
                ObjectIdCollection plinePropSetDefs = PropertyDataServices.GetPropertySetDefinitionsUsed(surface);
                foreach (ObjectId plinePropSetDef in plinePropSetDefs)
                {
                    var prop = transsrc.GetObject(plinePropSetDef, OpenMode.ForWrite) as PropertySetDefinition;
                    foreach (PropertyDefinition propDef in prop.Definitions)
                    {
                        ObjectIdCollection idsDummy = new ObjectIdCollection();
                        string val = propDef.Description;
                        try
                        {
                            var propsetdef = prop.GetValue(propDef.Id, surfaceId, plinePropSetDefs);
                          
                            //Application.ShowAlertDialog("Surface property set def: " + propDef.Name.ToString());

                        }
                        catch (System.Exception ex)
                        {
                            Application.ShowAlertDialog(ex.Message);
                        }
                    }
                }
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2022-10-05 151622.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1129781i894C8A3841B34C7C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2022-10-05 151622.png" alt="Annotation 2022-10-05 151622.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2022 11:34:45 GMT</pubDate>
    <dc:creator>hosneyalaa</dc:creator>
    <dc:date>2022-10-20T11:34:45Z</dc:date>
    <item>
      <title>Getting PropertySetDefinition Value of an object</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/11495262#M4785</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;How to get an actual Value of a object's PropertySetDefinition?&lt;/P&gt;&lt;P&gt;I thought it is this method:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;GetValue(int propertyId, Autodesk.AutoCAD.DatabaseServices.ObjectId id, Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection blockRefPath)&lt;/LI-CODE&gt;&lt;P&gt;but it is causing Civil3d to crash with fatal error "unhandled access violation reading 0x0000 exception at autocad"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code so far:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("PropSets")]
        public void PropSets()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            CivilDocument doc = CivilApplication.ActiveDocument;


            // select a  TIN surface
            PromptEntityOptions opSelSurface = new PromptEntityOptions("\nSelect a TIN Surface: ");
            opSelSurface.SetRejectMessage("\nOnly TIN Surface is allowed");
            opSelSurface.AddAllowedClass(typeof(TinSurface), true);
            opSelSurface.AppendKeywordsToMessage = true;
            PromptEntityResult resSelSurface = ed.GetEntity(opSelSurface);
            ObjectId surfaceId = resSelSurface.ObjectId;
            Database db = Application.DocumentManager.MdiActiveDocument.Database;

            using (Transaction transsrc=db.TransactionManager.StartTransaction())
            {
                TinSurface surface = transSrc.GetObject(surfaceId, OpenMode.ForWrite) as TinSurface;
                ObjectIdCollection plinePropSetDefs = PropertyDataServices.GetPropertySetDefinitionsUsed(surface);
                foreach (ObjectId plinePropSetDef in plinePropSetDefs)
                {
                    var prop = transSrc.GetObject(plinePropSetDef, OpenMode.ForWrite) as PropertySetDefinition;
                    foreach(PropertyDefinition propDef in prop.Definitions)
                    {
                        ObjectIdCollection idsDummy = new ObjectIdCollection();
                        string val = propDef.Description;
                        try
                        {
                            string propsetdef = prop.GetValue(propDef.Id, surfaceId, plinePropSetDefs).ToString();
                            Application.ShowAlertDialog("Surface property set def: " + propDef.Name.ToString() + propsetdef);

                        }
                        catch (Exception ex)
                        {
                            Application.ShowAlertDialog(ex.Message);
                        }
                    }
                }
            }
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 20 Oct 2022 06:22:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/11495262#M4785</guid>
      <dc:creator>lumoric</dc:creator>
      <dc:date>2022-10-20T06:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Getting PropertySetDefinition Value of an object</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/11495926#M4786</link>
      <description>&lt;P&gt;HI &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3452687"&gt;@lumoric&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because he gives a&amp;nbsp; NULL&amp;nbsp; when he REEGING OBJECTID&lt;/P&gt;&lt;P&gt;&amp;nbsp;as in Image&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TRY :&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; [CommandMethod("TESTPropSets")]
        public void PropSets()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            CivilDocument doc = CivilApplication.ActiveDocument;


            // select a  TIN surface
            PromptEntityOptions opSelSurface = new PromptEntityOptions("\nSelect a TIN Surface: ");
            opSelSurface.SetRejectMessage("\nOnly TIN Surface is allowed");
            opSelSurface.AddAllowedClass(typeof(TinSurface), true);
            opSelSurface.AppendKeywordsToMessage = true;
            PromptEntityResult resSelSurface = ed.GetEntity(opSelSurface);
            ObjectId surfaceId = resSelSurface.ObjectId;
            Database db = Application.DocumentManager.MdiActiveDocument.Database;

            using (Transaction transsrc=db.TransactionManager.StartTransaction())
            {
                TinSurface surface = transsrc.GetObject(surfaceId, OpenMode.ForWrite) as TinSurface;
                ObjectIdCollection plinePropSetDefs = PropertyDataServices.GetPropertySetDefinitionsUsed(surface);
                foreach (ObjectId plinePropSetDef in plinePropSetDefs)
                {
                    var prop = transsrc.GetObject(plinePropSetDef, OpenMode.ForWrite) as PropertySetDefinition;
                    foreach (PropertyDefinition propDef in prop.Definitions)
                    {
                        ObjectIdCollection idsDummy = new ObjectIdCollection();
                        string val = propDef.Description;
                        try
                        {
                            var propsetdef = prop.GetValue(propDef.Id, surfaceId, plinePropSetDefs);
                          
                            //Application.ShowAlertDialog("Surface property set def: " + propDef.Name.ToString());

                        }
                        catch (System.Exception ex)
                        {
                            Application.ShowAlertDialog(ex.Message);
                        }
                    }
                }
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2022-10-05 151622.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1129781i894C8A3841B34C7C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2022-10-05 151622.png" alt="Annotation 2022-10-05 151622.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 11:34:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/11495926#M4786</guid>
      <dc:creator>hosneyalaa</dc:creator>
      <dc:date>2022-10-20T11:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Getting PropertySetDefinition Value of an object</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/11496286#M4787</link>
      <description>&lt;P&gt;The following is an example as to how to get the value of the PropertySet&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim propSetId As ObjectId = PropertyDataServices.GetPropertySet(dbObject, _propertySetDefinitionId)
Dim propSet As PropertySet = tr.GetObject(propSetId, OpenMode.ForRead)
Dim val As Object = propSet.GetAt(propSet.PropertyNameToId(propertyName))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope that this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 13:51:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/11496286#M4787</guid>
      <dc:creator>hippe013</dc:creator>
      <dc:date>2022-10-20T13:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Getting PropertySetDefinition Value of an object</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/12297908#M4788</link>
      <description>&lt;P&gt;Just verifying that this can only be done by python?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 04:47:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/12297908#M4788</guid>
      <dc:creator>james_fisher1</dc:creator>
      <dc:date>2023-10-11T04:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Getting PropertySetDefinition Value of an object</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/12299740#M4789</link>
      <description>&lt;P&gt;The OP is writing in C# on the .NET framework. In Hosneyalaa's post they are using Dynamo. And in my example I am writing in VB on the .NET framework. Are you referring to using Python in Dynamo?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 18:40:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/12299740#M4789</guid>
      <dc:creator>hippe013</dc:creator>
      <dc:date>2023-10-11T18:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Getting PropertySetDefinition Value of an object</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/12300031#M4790</link>
      <description>Sorry, I meant to ask if it requires code to be written, or if it can be done with modules?</description>
      <pubDate>Wed, 11 Oct 2023 20:34:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/12300031#M4790</guid>
      <dc:creator>james_fisher1</dc:creator>
      <dc:date>2023-10-11T20:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Getting PropertySetDefinition Value of an object</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/12300106#M4791</link>
      <description>&lt;P&gt;I guess I am not sure what you mean when you say modules. In terms of VB a module is a Static Class, as in a module cannot create instances on an object. I am assuming you are referring to using Python? The code posted in this thread is for creating a DLL file that can be imported through the use of the NETLOAD command. Feel free to start a new thread with your question about Modules and the use of Python. That will help engage others in answering your question.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 21:03:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/getting-propertysetdefinition-value-of-an-object/m-p/12300106#M4791</guid>
      <dc:creator>hippe013</dc:creator>
      <dc:date>2023-10-11T21:03:00Z</dc:date>
    </item>
  </channel>
</rss>

