Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66683

Create or modify a rendering asset?

$
0
0

Hi,

 

AppearanceAssetElement.Create takes a rendering asset as an input. Is there any way to create or modify this rendering asset?

 

This code works to create a new material and new AppearanceAssetElement. But it relies on getting an existing asset with

app.get_Assets(AssetType.Appearance).Cast<Asset>().FirstOrDefault()

 

It is possible to modify this asset or create a new one? I want to be able to change the Description, Keywords, Color, and Finish.

 

Thanks

Harry

 

public void material()
{
    Application app = this.Application;
    UIApplication uiapp = new UIApplication(app);
    Document doc = this.ActiveUIDocument.Document;
    Asset a = app.get_Assets(AssetType.Appearance).Cast<Asset>().FirstOrDefault();
    using (Transaction t = new Transaction(doc,"as"))
    {
        t.Start();
        AppearanceAssetElement aa = AppearanceAssetElement.Create(doc, "My new appearance asset", a);
        Material mat = doc.GetElement(Material.Create(doc, "My new material")) as Material;
        mat.AppearanceAssetId = aa.Id;
        t.Commit();
    }
}


Viewing all articles
Browse latest Browse all 66683

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>