<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: editableAsset.FindByName(&amp;quot;generic_diffuse&amp;quot;) Showing Null whilst using PBR Assett in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12083412#M11214</link>
    <description>&lt;P&gt;I may need to back up here and read a bit closer. I'm seeing two different aspects to this question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) a "PBR" asset... What exactly do you mean by that? Different material assets (as defined by the schema) store their bitmaps in different properties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) how to get the bitmap, if there is one associated, from a "Generic" asset (which is the only type of asset schema that stores the bitmap in the "Generic Diffuse" property).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attaching an xml file that I just produced using my material asset collector routine on a test file that I created specifically for the purpose of investigating materials and material assets and which has all of the asset types within it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps this will help a bit with the relationships in different asset types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{ I'm editing this to attach another xml file that has one material in it that is specifically a Generic asset and has embedded bitmaps for both the gereric_diffuse and generic_bump_map properties }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-G&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jul 2023 11:59:00 GMT</pubDate>
    <dc:creator>GaryOrrMBI</dc:creator>
    <dc:date>2023-07-06T11:59:00Z</dc:date>
    <item>
      <title>editableAsset.FindByName("generic_diffuse") Showing Null whilst using PBR Assett</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12060222#M11211</link>
      <description>&lt;P&gt;I can get the Assett Property using the older Asset Types but not with the updated Assets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ElementId appearanceAssetId = material.AppearanceAssetId;&lt;BR /&gt;AppearanceAssetElement assetElem = material.Document.GetElement(appearanceAssetId) as AppearanceAssetElement;&lt;/P&gt;&lt;P&gt;using (Transaction t = new Transaction(material.Document, "Change material bumpmap bitmap"))&lt;BR /&gt;{&lt;BR /&gt;t.Start();&lt;/P&gt;&lt;P&gt;using (AppearanceAssetEditScope editScope = new AppearanceAssetEditScope(assetElem.Document))&lt;BR /&gt;{&lt;BR /&gt;Asset editableAsset = editScope.Start(assetElem.Id); // returns an editable copy of the appearance asset&lt;/P&gt;&lt;P&gt;AssetProperty bumpMapProperty = editableAsset.FindByName&lt;STRONG&gt;&lt;EM&gt;("generic_diffuse");&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;string propname1 = bumpMapProperty.Name;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 08:19:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12060222#M11211</guid>
      <dc:creator>sam.robertsRQ4X8</dc:creator>
      <dc:date>2023-06-26T08:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: editableAsset.FindByName("generic_diffuse") Showing Null whilst using PBR Assett</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12063613#M11212</link>
      <description>&lt;P&gt;1) Not all material Appearance Assets have the Generic Diffuse property.&lt;BR /&gt;2) Not all Generic Diffuse properties have an embedded UnifiedBitmap (which is the container for the BitMap properties)&lt;BR /&gt;3) the path is stored within the unifiedbitmap_Bitmap string property of the embedded Asset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a clip from a utility that I just finished that creates a new material, then adds an embedded asset to the appearance Asset if it doesn't already have one, then assigns an image path to the embedded asset...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*Please note that I use text strings for all of the "findByName" calls but this doesn't translate to other languages and will be replaced with calls such as :&amp;nbsp;FindByName(RDV.Generic.GenericDiffuse)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;			Using editScope As New RDV.AppearanceAssetEditScope(thisDoc)
				' returns an editable copy of the new appearance asset
				Dim editableAsset As RDV.Asset = editScope.Start(thisAsset.Id)

				Dim descriptionProperty As RDV.AssetPropertyString = TryCast(editableAsset.FindByName("description"), RDV.AssetPropertyString)
				descriptionProperty.Value = "My First Generic Appearance Asset"

				'let's attach some images
				'create a reusable string for the images
				Dim imagePath As String

				'** add a generic Diffuse image to the Appearance Asset
				Dim diffuseMapProperty As RDV.AssetProperty = editableAsset.FindByName("generic_diffuse")
				Dim connectedDiffAsset As RDV.Asset = diffuseMapProperty.GetSingleConnectedAsset()
				' Add a new connected asset if it doesn't already have one
				If connectedDiffAsset Is Nothing Then
					diffuseMapProperty.AddConnectedAsset("UnifiedBitmap")
					connectedDiffAsset = diffuseMapProperty.GetSingleConnectedAsset()
				End If
				If connectedDiffAsset IsNot Nothing Then
					' Find the target asset path property
					Dim diffuseBitmapProperty As RDV.AssetPropertyString = TryCast(connectedDiffAsset.FindByName("unifiedbitmap_Bitmap"), RDV.AssetPropertyString)
					'build a path to an image
					imagePath = My.Computer.FileSystem.CombinePath(thisPath, "Concrete.Cast-In-Place.Exposed Aggregate.Medium.jpg")
					If diffuseBitmapProperty.IsValidValue(imagePath) Then
						diffuseBitmapProperty.Value = imagePath
					End If
				End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the VB but it's the only language that I can speak fluently at this time &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-G&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 12:58:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12063613#M11212</guid>
      <dc:creator>GaryOrrMBI</dc:creator>
      <dc:date>2023-06-27T12:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: editableAsset.FindByName("generic_diffuse") Showing Null whilst using PBR Assett</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12083088#M11213</link>
      <description>&lt;P&gt;Cheers for explaining this Gary, i was hoping it would be the case that the PBR assett didnt have a diffuse map but i have checked it on multiple assets and still not working. I have tried a few different ways to make sure its not an error in retrieving the diffusemap&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;//ATTEMPT&amp;nbsp; ONE&lt;BR /&gt;AssetPropertyDoubleArray4d &lt;STRONG&gt;genericDiffuseProperty&lt;/STRONG&gt; = editableAsset.FindByName("generic_diffuse") as AssetPropertyDoubleArray4d;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//ATTEMPT TWO&lt;/P&gt;&lt;P&gt;AssetProperty &lt;STRONG&gt;diffusemap&lt;/STRONG&gt;&amp;nbsp;= editableAsset2.FindByName("generic_diffuse");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//ATTEMPT THREE&lt;BR /&gt;AssetProperty &lt;STRONG&gt;genericDiffuseProperty&lt;/STRONG&gt; = editableAsset.FindByName(Generic.GenericDiffuse);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All return null, i have tried it on Assets which definitely have a diffuse map not sure if it is accessed differently for PBR materials&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 09:02:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12083088#M11213</guid>
      <dc:creator>sam.robertsRQ4X8</dc:creator>
      <dc:date>2023-07-06T09:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: editableAsset.FindByName("generic_diffuse") Showing Null whilst using PBR Assett</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12083412#M11214</link>
      <description>&lt;P&gt;I may need to back up here and read a bit closer. I'm seeing two different aspects to this question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) a "PBR" asset... What exactly do you mean by that? Different material assets (as defined by the schema) store their bitmaps in different properties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) how to get the bitmap, if there is one associated, from a "Generic" asset (which is the only type of asset schema that stores the bitmap in the "Generic Diffuse" property).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attaching an xml file that I just produced using my material asset collector routine on a test file that I created specifically for the purpose of investigating materials and material assets and which has all of the asset types within it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps this will help a bit with the relationships in different asset types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{ I'm editing this to attach another xml file that has one material in it that is specifically a Generic asset and has embedded bitmaps for both the gereric_diffuse and generic_bump_map properties }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-G&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 11:59:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12083412#M11214</guid>
      <dc:creator>GaryOrrMBI</dc:creator>
      <dc:date>2023-07-06T11:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: editableAsset.FindByName("generic_diffuse") Showing Null whilst using PBR Assett</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12083548#M11215</link>
      <description>&lt;P&gt;Thanks for Sendin gthese Gary,,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) might not be using the right terminology but essentially the updated images PBR, hoopefully the screen grab helps clear this up&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) ive attached the code snippet to show how im getting and using the Diffuse Map&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 12:46:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12083548#M11215</guid>
      <dc:creator>sam.robertsRQ4X8</dc:creator>
      <dc:date>2023-07-06T12:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: editableAsset.FindByName("generic_diffuse") Showing Null whilst using PBR Assett</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12083676#M11216</link>
      <description>&lt;P&gt;That highlighted material is not a "Generic" asset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a generic Asset (like your upper group of materials that are working properly):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GaryOrrMBI_0-1688649012555.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1237324iE3B4D5F2977AF158/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GaryOrrMBI_0-1688649012555.png" alt="GaryOrrMBI_0-1688649012555.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;this is one of the advanced materials (like the ones that are posting as failures):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GaryOrrMBI_1-1688649119525.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1237326i31716223BAF6B6F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GaryOrrMBI_1-1688649119525.png" alt="GaryOrrMBI_1-1688649119525.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the difference in code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GaryOrrMBI_2-1688649317760.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1237330i374336F5F1713132/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GaryOrrMBI_2-1688649317760.png" alt="GaryOrrMBI_2-1688649317760.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;here is the location of one of the bitmaps that the PrismOpaqueSchema uses:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GaryOrrMBI_3-1688649559733.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1237332i22D8C27965D67813/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GaryOrrMBI_3-1688649559733.png" alt="GaryOrrMBI_3-1688649559733.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Notice that the property holding the bitmap is not "generic_diffuse", it is stored in the "opaque_albedo" property instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here are a couple new xml files that have those two materials in them for comparison.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-G&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 13:25:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/editableasset-findbyname-quot-generic-diffuse-quot-showing-null/m-p/12083676#M11216</guid>
      <dc:creator>GaryOrrMBI</dc:creator>
      <dc:date>2023-07-06T13:25:05Z</dc:date>
    </item>
  </channel>
</rss>

