DiscussionsIssue archiveData Exchange and Application Framework

Archived discussion

STL to STEP

Data Exchange and Application FrameworkMon, 04/17/2023 - 14:557 replies

Browse this forum
QuestionAuthor

Hello everyone,

I import stl file with method RWStl::ReadFile because I have a large size STL so old fashion way takes (I mean StlAPI_Reader) too much time. And after import stl file want to convert to STEP file. But I couldn't convert that . In writer.Transfer section status returns fail. For any idea I will be appreciated.

        TCollection_AsciiString theFileName = Utilities::ToAsciiString(inp);
	auto aTris = RWStl::ReadFile(theFileName.ToCString(), 0.1);
	auto face = TopoDS_Face();
	auto aBuilder = BRep_Builder();
	aBuilder.MakeFace(face, aTris);

        STEPControl_Writer writer;

	IFSelect_ReturnStatus status = writer.Transfer(face, STEPControl_ManifoldSolidBrep);
	const TCollection_AsciiString asciiExportPath = Utilities::ToAsciiString(exportPath);
	status = writer.Write(asciiExportPath.ToCString());

	return true;

Discussion

7 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hello,

Can you share OCCT version, that you use?

Support of STEP tessalating was released in 7.7.0.

Best regards, Commenter-1.

02Author

I use 7.6.0 but of course can update the version if there is a solution in 7.7.0

03Author

I just updated the OCCT to 7.7.0. What should I do next?

04Commenter-1

Setting up schema to 242:

Interface_Static::SetCVal("write.step.schema","AP242DIS"); 

And then just export.

Best regards, Commenter-1.

05Commenter-1

Sorry, addionally you need to accept only tess entities:

STEPControl_Controller::Init();

    Interface_Static::SetCVal("write.step.schema","AP242DIS"); 

    Interface_Static::SetCVal("write.step.tessellated", "On");

Best regards, Commenter-1.

06Author

I don't understand how to use these lines in my code? Can you explain more please?

07Commenter-1

Just copy-past before writing. Please read STEP Translator - Open CASCADE Technology Documentation