Describe the bug
When inserting a new SpatialCategory
priCategoryId = SpatialCategory.insert(iModelDb, IModelDb.dictionaryId, "FieldWeld", new SubCategoryAppearance({ material: material.materialId, priority: 100 }));
To Reproduce
Steps to reproduce the behavior:
insert new RenderMaterialElement
use that id in a new SubcategoryAppearance
Expected behavior
The subcategory appearance can reference
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the applicable information):
const subCatId = iModel.elements.queryElementIdByCode(SubCategory.createCode(iModel, priCategoryId, "FieldWeld"));
if (subCatId) {
const subCat = iModel.elements.getElement(subCatId)
console.log(SubCategory Appearance: ${JSON.stringify(subCat)});
}
`
the resulting console logs are as follows: (in the last line you will see the appearance had material and transp dropped)
Describe the bug When inserting a new SpatialCategory
priCategoryId = SpatialCategory.insert(iModelDb, IModelDb.dictionaryId, "FieldWeld", new SubCategoryAppearance({ material: material.materialId, priority: 100 }));
To Reproduce Steps to reproduce the behavior:
Expected behavior The subcategory appearance can reference
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the applicable information):
Additional context Here's some sudo code to debug
`const params: RenderMaterialElement.Params = { description: "Field Weld", color: [0.9058, 0.298, 0.2352], diffuse: 0.5, finish: 0.15, paletteName: "MyPalette", reflectColor: [0.9, 0.3, 0.25], specularColor: [0.2, 0.2, 0.2], }; const fieldWeldId = RenderMaterialElement.insert(iModelDb, IModelDb.dictionaryId, "FieldWeldMaterial", params); const codeValue = RenderMaterialElement.createCode(iModelDb, IModelDb.dictionaryId, "FieldWeldMaterial");
const materialId = iModel.elements.queryElementIdByCode(RenderMaterialElement.createCode(iModel,IModelDb.dictionaryId, "FieldWeldMaterial")); if (materialId) { const material = iModel.elements.getElement(materialId);
console.log(
render material: ${JSON.stringify(material)}
); }const appearance = new SubCategoryAppearance({material: materialId, priority: 100, transp: 0.75}); console.log (
generating subcategory with SubCategoryAppearance.Props ${JSON.stringify(appearance)}
); priCategoryId = SpatialCategory.insert(iModel, IModelDb.dictionaryId, "FieldWeld", appearance); console.log(New CategegoryId: ${priCategoryId}
);const subCatId = iModel.elements.queryElementIdByCode(SubCategory.createCode(iModel, priCategoryId, "FieldWeld")); if (subCatId) { const subCat = iModel.elements.getElement(subCatId)
console.log(
SubCategory Appearance: ${JSON.stringify(subCat)}
); } ` the resulting console logs are as follows: (in the last line you will see the appearance had material and transp dropped)`render material: { "classFullName":"BisCore:RenderMaterial", "id":"0x20000000005", "paletteName":"MyPallette", "description":"Field Weld", "code":{"spec":"0x1b","scope":"0x10","value":"schemaName:FieldWeldMaterial"}, "model":"0x10", "jsonProperties":{ "materialAssets":{ "renderMaterial":{ "HasBaseColor":true, "color":[0.9058, 0.298, 0.2352], "HasSpecularColor":true, "specular_color":[0.2,0.2,0.2], "HasFinish":true, "finish":0.15, "HasTransmit":false, "HasDiffuse":true, "diffuse":0.5, "HasSpecular":false, "HasReflect":false, "HasReflectColor":true, "reflect_color":[0.9, 0.3, 0.25] } } }, "isPrivate":false }
generating subcategory with SubCategoryAppearance.Props {"color":0,"priority":100,"material":"0x20000000005","transp":0.75}
New CategegoryId: 0x20000000014 SubCategory Appearance: { "classFullName":"BisCore:SubCategory", "id":"0x20000000015", "code":{"spec":"0x1e","scope":"0x20000000014","value":"schemaName:FieldWeld"}, "model":"0x10", "parent":{"id":"0x20000000014","relClassName":"BisCore:CategoryOwnsSubCategories"}, "isPrivate":false, "appearance":{"color":0,"priority":100}}`