Hi All
In the concrete material I created, I can’t set the “concrete compression” property to be equal to (20 MPa); it remains unchanged at (0.1 MPa) as shown in the image below
As far as I know, the internal unit for pressure in Revit is N/ft²
. I used a formula to convert the unit to MPa
, but I don’t know what’s wrong with my code
import clr
import sys
import System
import math
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import specify namespace
from Autodesk.Revit.DB.Structure import *
#import net library
from System import Array
from System.Collections.Generic import List, IList, Dictionary
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.GeometryReferences)
#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("System.Core")
clr.ImportExtensions(System.Linq)
materials = FilteredElementCollector(doc).WherePasses(ElementCategoryFilter(BuiltInCategory.OST_Materials))
material = [i for i in materials if i.Name == "Béton - Coulé sur place - Béton20"]
# converting unit from **`N/ft²`** to MPA
c = 1/92903.04
if len(material) > 0:
mat = m
m_Id = mat.Id
else:
t = Transaction(doc, 'Get/create concrete material')
t.Start()
m_Id = Material.Create(doc, "Béton - Coulé sur place - Béton20")
mat = doc.GetElement(m_Id)
mat.MaterialClass = "Concrete"
asset = StructuralAsset("b", StructuralAssetClass.Concrete)
asset.ConcreteCompression = 20*c
struc = PropertySetElement.Create(doc, asset)
mat.SetMaterialAspectByPropertySet(MaterialAspect.Structural, struc.Id)
t.Commit()
Any help would be appreciated.
Thanks.