How to get a single entity from 3D object (STEP)
Posted: 28 Jan 2022, 15:48
Hello everyone!
I have a question:
How to get a single entity like line, arc, b-spline, or cylindrical surface, conical surface etc. from the 3D object (STEP).
I have 3D (STEP) file on the screen and it is displayed properly.
Code in C++ (Builder 2009).
Thank you for any help!
Greetings,
Mariusz
I have a question:
How to get a single entity like line, arc, b-spline, or cylindrical surface, conical surface etc. from the 3D object (STEP).
I have 3D (STEP) file on the screen and it is displayed properly.
Code in C++ (Builder 2009).
Code: Select all
void __fastcall TformMain::mOpenSTEPClick(TObject *Sender)
{
OpenDialog1->Filter = "STEP Files(*.stp, *.step)|*.stp;*.step";
if(OpenDialog1->Execute())
{
CloseNavigators();
//Loading TsgDrawingNavigator *FsgPaintBox;
FsgPaintBox->Picture->LoadFromFile(OpenDialog1->FileName);
FsgPaintBox->BeginUpdate();
try
{
((TsgCADImage *)(FsgPaintBox->Picture->Graphic))->CustomDraw = false;
FsgPaintBox->FitToSize();
}
__finally
{
FsgPaintBox->EndUpdate();
}
//Loading Tsg3DDrawingNavigator *stepDrawingNavigator;
if(LoadedCADImage)
{
if(stepDrawingNavigator->Empty() && (stepDrawingNavigator->LoadFromImage == NULL))
{
//first time loaded
try
{
Screen->Cursor = crHourGlass;
stepDrawingNavigator->LoadFromConverter(LoadedCADImage->Converter, LoadedCADImage);
}
__finally
{
Screen->Cursor = crDefault;
}
}
else
{
//next time loaded
if(stepDrawingNavigator->LoadFromImage != NULL)
{
LoadViewFromCADImage(LoadedCADImage,stepDrawingNavigator);
}
}
Tsg3DShowingStyles style;
style << ssSmoothShading << ssLighting;
stepDrawingNavigator->ShowingStyle = style;
stepDrawingNavigator->FitToSize();
FsgPaintBox->Visible = false;
stepDrawingNavigator->Visible = true; //only 3D visible
//TESTS:
int entitiesCount;
String entityName;
TsgDXFEntity *entity;
entitiesCount = LoadedCADImage->Converter->Counts[csEntities];
//entitiesCount in case of very big STEP file = 1 (why?)
for(int i=0; i<entitiesCount; i++)
{
entity = LoadedCADImage->Entities[i]; //this is siome general entity (some single block) (why?)
if(entity)
{
entityName = entity->Name;
entityName = entity->EntName();
}
}
}
}
}
//---------------------------------------------------------------------------
Thank you for any help!
Greetings,
Mariusz