Message 1 of 1
How to assign textures to materials?
Not applicable
08-27-2018
11:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi. I can create materials through the following code:
using (var transaction = new Transaction(doc))
{
transaction.Start("CreateMaterial");
// Create new material
var newMaterial = Material.Create(doc, "Marmol");
var material = doc.GetElement(newMaterial) as Material;
var thAsset = new ThermalAsset("Thermal1", ThermalMaterialType.Solid);
thAsset.Name = "yourname";
thAsset.Behavior = StructuralBehavior.Isotropic;
thAsset.ThermalConductivity = 0.00;
thAsset.SpecificHeatOfVaporization = 0.0;
thAsset.Porosity = 0.0;
thAsset.Density = 0.0;
thAsset.Emissivity = 0.0;
thAsset.Reflectivity = 0.0;
thAsset.Permeability = 0.0;
thAsset.ElectricalResistivity = 0.0;
thAsset.Compressibility = 0.0;
var pse = PropertySetElement.Create(doc, thAsset);
material.SetMaterialAspectByPropertySet(MaterialAspect.Thermal, pse.Id);
var strAsset = new StructuralAsset("Thermal1", StructuralAssetClass.Generic);
strAsset.Name = "yourname";
strAsset.Behavior = StructuralBehavior.Isotropic;
strAsset.Density = 0.0;
var pses = PropertySetElement.Create(doc, strAsset);
material.SetMaterialAspectByPropertySet(MaterialAspect.Structural, pses.Id);
// Add attach to class
transaction.Commit();
}I was wondering if there is a way to assign a texture to a material through code? I hope you can help me. Thank you.