Hello.
Obj writer work only with Mesh. That is why you need to create mesh for imported document. Step format work with BRep and Mesh. I think only BRep exists in your file.
For more detailed help, tell me which version or branch of OCCT you are using. Additionally, please attach the STEP file.
To update a document to create a mesh you can use:
TDF_LabelSequence aRootLabels;
myDoc.ShapeTool()->GetFreeShapes (aRootLabels);
TopoDS_Compound aCompound;
BRep_Builder aBuildTool;
aBuildTool.MakeCompound (aCompound);
for (TDF_LabelSequence::Iterator aLabIter (aRootLabels); aLabIter.More(); aLabIter.Next())
{
TopoDS_Shape aShape;
const TDF_Label& aLabel = aLabIter.Value();
if (XCAFDoc_ShapeTool::GetShape (aLabel, aShape))
{
aBuildTool.Add (aCompound, aShape);
}
}
Bnd_Box aBndBox;
BRepBndLib::Add (aCompound, aBndBox, Standard_False);
if (aBndBox.IsVoid())
{
return false;
}
NCollection_Vec3<double> aMin, aMax;
aBndBox.Get (aMin.x(), aMin.y(), aMin.z(), aMax.x(), aMax.y(), aMax.z());
const NCollection_Vec3<double> aBndDelta = aMax - aMin;
BRepMesh_IncrementalMesh anAlgo;
anAlgo.ChangeParameters().Deflection = aBndDelta.maxComp() * myLinearDeflection * 4.0;
anAlgo.ChangeParameters().Angle = myAngularDeflection;
anAlgo.ChangeParameters().InParallel = Standard_True;
anAlgo.SetShape (aCompound);
anAlgo.Perform();Best regards,
Commenter-1.