AnsweredAssumed Answered

Unable to delete/modify appearances in SW

Question asked by Prashanth Neelakantan on Sep 1, 2020
Latest reply on Sep 21, 2020 by Prashanth Neelakantan

I can use the GetRenderMaterials2 method of the model doc extension to get the number of appearances that are present in a model. I also get the actual colors associated with it.

 

However, I'm unable to modify/delete or add new appearances using this interface. I'm using C+/CLI. This is the code that I use. Note that modext is the extension property of IModelDoc2. 

 

String^ tname="";
array<Object^>^ allRend = (array<Object^>^)modext->GetRenderMaterials2(1, tname);

if (allRend)
for (int i = 0; i < allRend->Length; ++i)
{
   RenderMaterial^ rend = (RenderMaterial^)allRend[i];

   std::cout << "\n" << rend->PrimaryColor;


   int id1, id2;
   rend->GetMaterialIds(id1, id2);

   

   bool chk = modext->DeleteDisplayStateSpecificRenderMaterial(id1, id2);
   std::cout << "\tdeleted " << chk;
}

 

1. The API examples simply delete using the material id but that does not work here. Am I doing something wrong in the deletion?

 

2. I tried to change the color property of the appearance as- rend->PrimaryColor = 100  (some shade of red). But this has no effect on the model. Are there other operations that need to be done prior to this?

Outcomes