ModelObjectGetAllUserProperties Method

Retrieves all properties for the model object in one hashtable. Type for the returned value must be checked using type casting.

Namespace:  Tekla.Structures.Model
Assembly:  Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2025.0.0-alpha00045580+dc02c3918546f1e94eb2d3b13ea99057fb3313e0
Syntax
public bool GetAllUserProperties(
	ref Hashtable values
)

Parameters

values
Type: System.CollectionsHashtable
The return value, a hash table that contains all the values that were retrieved successfully.

Return Value

Type: Boolean
True if at least one single property was retrieved successfully.
Examples
using Tekla.Structures.Model;
using Tekla.Structures.Geometry3d;
using System;
using System.Collections;

namespace ExampleUserProperties
{
    internal class Program
    {
        static void Main()
        {
            Beam Beam1 = new Beam(new Point(0, 0, 0), new Point(1000, 0, 0));
            Beam1.Profile.ProfileString = "HEA300";
            Beam1.Insert();
            Beam1.SetUserProperty("PROJECT_COMMENT", "MyProjectComment");
            Beam1.SetUserProperty("COMMENT", "MyComment");
            Beam1.SetUserProperty("PROJECT_INT", 1);
            Beam1.SetUserProperty("PROJECT_DOUBLE", 3.25);

            Hashtable values = new Hashtable();
            Beam1.GetAllUserProperties(ref values);
            bool resultstring1 = typeof(string) == values["PROJECT_COMMENT"].GetType();
            bool resultstring2 = typeof(string) == values["COMMENT"].GetType();
            bool resultint = typeof(int) == values["PROJECT_INT"].GetType();
            bool resultdouble = typeof(double) == values["PROJECT_DOUBLE"].GetType();
            bool result1 = "MyProjectComment".Equals(values["PROJECT_COMMENT"]);
            bool result2 = "MyComment".Equals(values["COMMENT"]);
            bool result3 = 1 == (int)values["PROJECT_INT"];
            bool result4 = 3.25 == (double)values["PROJECT_DOUBLE"];
            bool result5 = 4 == values.Count;

            foreach (DictionaryEntry de in values)
            {
                Console.WriteLine(de.Key + ": " + de.Value.ToString());
            }

            Console.ReadKey();        
        }
    }
}
See Also
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.
Previous
Next