For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

BRep->OCAF

Shawn Chang's picture
Forums: 

Hi: //Import Brep file
Handle(TDocStd_Document) D = GetStarsDoc();

D->NewCommand();
TStars_Commands TSC(D->Main());//tag = 1

Handle(TopTools_HSequenceOfShape) aSequence

= CImportExport::ReadBREP();
if (aSequence->IsEmpty())
return;
TopoDS_Shape S = aSequence->Value(1);
TFunction_Logbook log;
TDF_Label L = TSC.Create(S,"Name");
TStars_SpaceObject TSO(L);
TSO.Body(S);

Handle(TPrsStd_AISPresentation) prs

= TPrsStd_AISPresentation::

Set(TSO.Body()->Label(),TNaming_NamedShape::GetID());

prs->Display(1);
myAISContext->SetSelected(prs->GetAIS());

Fit3DViews();

TDataStd_Integer::Set(L,1);
myAISContext->UpdateCurrentViewer();

D->CommitCommand;

In TStars_Commands.cpp

TDF_Label TStars_Commands::Create(TopoDS_Shape& aShape,

const CString& Name)
{

AccName = AccName + 1;
CString message;
message.Format("%d",AccName);
CString Acc = message + Name;
Standard_CString Ac = (Standard_CString)(LPCTSTR)Acc;
TCollection_AsciiString name((Standard_CString)(LPCTSTR)Ac);

TDF_Label L = TDF_TagSource::NewChild(myStars);

TDataStd_Integer::Set(L.FindChild(1),1);
TDataStd_Integer::Set(L.FindChild(2),1);
TDataStd_Real::Set(L.FindChild(3),0.8);
TDataStd_Integer::Set(L.FindChild(4),1);
TDataStd_Integer::Set(L.FindChild(5),2);
TDataStd_Integer::Set(L.FindChild(6),1);
TDataStd_Integer::Set(L.FindChild(7),1);
TDataStd_Integer::Set(L.FindChild(8),1);
TDataStd_Name::Set(L,name);

Handle(TStarsFunction_Driver) myDriver = new TStarsFunction_Driver();
TFunction_DriverTable::Get()->AddDriver(Standard_GUID("Driver"), myDriver);

Handle(TFunction_Function) myFunction = TFunction_Function::Set(L,Standard_GUID("Driver"));

TFunction_Logbook log;
myDriver->Init(L);
if (myDriver->Execute(log,aShape))
MessageBox(0,"DFunction_Execute : failed", "xxx", MB_ICONERROR);

return L;
}

I save the file. Unfortunately, I couldn't make it. I even couldn't find the file.. Does anyone know what wrong is? Thanks a lot.

sincerely shawn

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.