Show / Hide Table of Contents

    Custom properties

    Every object that has custom properties will have a CustomPropertyMapHandle property which can be passed to CustomPropertyMap.Get() to access the properties for the handle.

    Members, materials, holes, bolts, welds, group members, and jobs have custom properties. The following examples show how to read and write the Notes property for a job.

    Reading custom properties:

    var properties_handle = job.CustomPropertyMapHandle;
    var properties = CustomPropertyMap.Get(properties_handle);
    string notes = "";
    properties.Get("Notes", ref notes);
    

    Writing custom properties:

    using(var xaction = new Transaction(job, new ImmediateLockHandler()))
    {
        var properties_handle = job.CustomPropertyMapHandle;
        xaction.Add(properties_handle);
        xaction.Lock();
        var properties = CustomPropertyMap.Get(properties_handle);
        properties.Set("Notes", "hello world");
        xaction.Commit();
    }
    
    Back to top