How to set a color and/or transparency in 3D object (STEP)
Posted: 21 Feb 2022, 14:44
Hello everyone!
I have a problem in Tsg3DDrawingNavigator.
I know how to display 3D object (STEP) and how to add there:
- additional lines (TsgDXFLine)
- additional 3D solid based on triangles (TsgDXF3dFace)
Having a possibility to add lines and triangles I'm able to add any 3D figure with contours.
An this is done, and works perfect!
You can see it on the following picture:

As you can see - there is possible to set a color of the line (TsgDXFLine), but there is no possible to set a color of the triangles (TsgDXF3dFace) and there is no possible to set their transparency (as in OpenGL - for example).
Of course "no possible" means not possible by me. I don't know how to set a color and/or transparency of this object.
A part of code (a function where I create double-triangle):
Thank you for any help!
Mariusz
I have a problem in Tsg3DDrawingNavigator.
I know how to display 3D object (STEP) and how to add there:
- additional lines (TsgDXFLine)
- additional 3D solid based on triangles (TsgDXF3dFace)
Having a possibility to add lines and triangles I'm able to add any 3D figure with contours.
An this is done, and works perfect!
You can see it on the following picture:
As you can see - there is possible to set a color of the line (TsgDXFLine), but there is no possible to set a color of the triangles (TsgDXF3dFace) and there is no possible to set their transparency (as in OpenGL - for example).
Of course "no possible" means not possible by me. I don't know how to set a color and/or transparency of this object.
A part of code (a function where I create double-triangle):
Code: Select all
TsgDXFEntity* __fastcall TCadSoftOperation::GetDoubleTriangle(TFPoint p0, TFPoint p1, TFPoint p2, TFPoint p3, TColor color)
{
//p0 is common to the triangle <p0, p1, p2> and <p0, p2, p3>
TsgDXFEntity *ent3dFace = new TsgDXF3dFace();
TsgDXF3dFace *face3D;
face3D = dynamic_cast<TsgDXF3dFace *>(ent3dFace);
//TsgColorCAD cadColor;
//cadColor.Color = color;
//TO DO (to solve):
//Problem with colors!
if(face3D)
{
face3D->Point = p0;
face3D->Point1 = p1;
face3D->Point2 = p2;
face3D->Point3 = p3;
//face3D->ColorCAD = cadColor; //doesn't work
//face3D->SetColor(color); //doesn't work
}
return ent3dFace;
}
//---------------------------------------------------------------------------
Mariusz