1

I have a .step File and i need to make images from the sides for a project. Now i have the problem that the sides are all white.

To get the side i change viewpoint and for now i change it a bit to show the colors but that does often not work and the object is still white. I also tried to ad a PositionalLight and a DirectionalLight, they give at best a slightly more gray white. But i might overlook something simple.

The Code to change the View

            localView = new View3D();
            localView.Dock = DockStyle.Fill;
            Visualizer = new ObjectVisualizer();
            localView.AddVisualizer(Visualizer);
            stepImport = new StepImport();
            Import = stepImport.Import(_currentFile);
            localView.BeginUpdate();
            localView.ViewBottom();
            localView.EndUpdate();

Examplelightsources i tried

            localView.View.SetLightOn(new OCV3d_DirectionalLight(localView.View.Viewer(), OCV3d_TypeOfOrientation.V3d_Zneg, OCQuantity_NameOfColor.Quantity_NOC_RED));
            localView.View.SetLightOn(new OCV3d_PositionalLight(localView.View.Viewer(), -10, -10, -10, OCQuantity_NameOfColor.Quantity_NOC_BLACK));

I trie to get a sideview like in the FreeCad software, where the colors of the Object are shown.

Flo
  • 51
  • 8
  • 1
    I do not fully get what you mean. Would you like to add screenshots to explain your problem? Consider that in Open CASCADE both, the color and the material of an object, have an influence on how it appears. An object may appear just white because its material is too shiny. In that case setting a dull, neutral material might help. I for example set the material by default to plastic. In C++ it looks like that: `presentation->SetMaterial(Graphic3d_NameOfMaterial::Graphic3d_NOM_PLASTIC);`. – Benjamin Bihler Oct 21 '19 at 08:09
  • Thank you for the answer, I think that might be the problem. Unfortunatly i am not allowed to post images (to few Points). [Example](https://imgur.com/a/KXYkLzc) that would be the view with the white side. What is your presentation? Unfortunatly i am using a lot of Code which is not written by me, so I am not quite in the material. – Flo Oct 21 '19 at 09:19
  • Here I use presentation attributes to store settings in an OCAF document. Probably this is not the way you want to do it, but I don't know how to set materials in C#... – Benjamin Bihler Oct 21 '19 at 09:25

1 Answers1

1

Thanks to the Comment of Benjamin Bihler I was able to resolve my problem as it was indeed the material that made the Object shine white from the side. To change the material i had to access the AisShapes from my VisualNode Object that i am using to show the Object.

VisualNode visualNode = new VisualNode(item.Name, new ObjectVisualizer(localView));
visualNode.AddShape(item.Shape, c, (double)c.A / 255);
foreach(var x in visualNode.AisShapes)
{
    x.SetMaterial(OCGraphic3d_NameOfMaterial.Graphic3d_NOM_PLASTIC);
}
Visualizer.RootNode.Children.Add(visualNode);
visualNode.Show();
Flo
  • 51
  • 8