Modifying Property Data Format

I’m developing a workflow to assign property data to corridor solids. That part is working :smiley:
I noticed, that if the drawing was created with the Civil 3D metric dwt, after exporting corridor solids, the automatically created “Standard” Property Data Format is set to Cubic Feet instead of Cubic Meters, thus creating wrong Automatic Property Data Value for Solid Volume.
This can be handled if the drawing is created from custom .dwt, (but sadly refencing the dwt not changing it). So as a fail-safe I try to override the units within the script, without success. The script runs successfully and sets the Unit Type, but not the Unit. Any ideas what am I missing here?

# Load the Python Standard and DesignScript Libraries
import sys
import clr

# Add Assemblies for AutoCAD and Civil3D

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

from Autodesk.Aec.DatabaseServices import *
from Autodesk.Aec.PropertyData import *
from Autodesk.Aec.PropertyData.DatabaseServices import *

# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor

bit = IN[0]

with adoc.LockDocument():
    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
            # Place your code below
            dict = DictionaryPropertyDataFormat(db)
            id = dict.GetAt("Standard")
            obj = t.GetObject(id, OpenMode.ForWrite, False, False)
            obj.BuiltinType = bit
            i = 0
            #API not helping with BuiltInUnit Enum, so let's find cubic meter
            while i < 350:
                ut = UnitType(i,10)
                utin = ut.InternalName
                if utin == "cubic_meter":
                i += 1
            #Set unit type
            #fut = UnitType(ut)
            obj.UnitType = ut
            utype = obj.UnitType.GetTypeDisplayName(True)
            utypeunit = obj.UnitType.InternalName
            # Commit before end transaction

# Assign your output to the OUT variable.
OUT = utype, utypeunit, utin

Edit: Also, please help me understand what does Int32 mean in this case:

I wrote 10 in the constructor, and it seems to work, but I have no idea what i’m doing :smiley: