Page 1 of 1

How to get a single entity from 3D object (STEP)

Posted: 28 Jan 2022, 15:48
by Mariusz_Unilink
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).

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

Re: How to get a single entity from 3D object (STEP)

Posted: 28 Jan 2022, 17:10
by support
Hi Mariusz,

Unfortunately it is not possible at the moment. We are working on 3D improvement at the moment. Stay tuned to get the news about CAD VCL.

Maria.

Re: How to get a single entity from 3D object (STEP)

Posted: 31 Jan 2022, 17:14
by Mariusz_Unilink
Thank you Maria for the reply!

Im wondering - if there is a possibility to get some STEP entities not directly from the TsgDrawingNavigator or Tsg3DDrawingNavigator...
If you know some - please let me know.

Kind regards,

Mariusz

Re: How to get a single entity from 3D object (STEP)

Posted: 01 Feb 2022, 11:31
by support
Unfortunately, there is no such possibility for now. But 3D formats are one of our priorities at the moment, so I passed the info to our r&d team.

Maria