Fix STEP AP203/214 flaws
This commit is contained in:
parent
9316de659d
commit
2e2873362b
|
@ -55,6 +55,7 @@
|
|||
# include <TopTools_MapOfShape.hxx>
|
||||
# include <TopExp_Explorer.hxx>
|
||||
# include <TopoDS_Iterator.hxx>
|
||||
# include <APIHeaderSection_MakeHeader.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x060500
|
||||
# include <TDataXtd_Shape.hxx>
|
||||
# else
|
||||
|
@ -664,8 +665,17 @@ static PyObject * exporter(PyObject *self, PyObject *args)
|
|||
|
||||
Base::FileInfo file(filename);
|
||||
if (file.hasExtension("stp") || file.hasExtension("step")) {
|
||||
//Interface_Static::SetCVal("write.step.schema", "AP214IS");
|
||||
STEPCAFControl_Writer writer;
|
||||
writer.Transfer(hDoc, STEPControl_AsIs);
|
||||
|
||||
// edit STEP header
|
||||
APIHeaderSection_MakeHeader makeHeader(writer.Writer().Model());
|
||||
makeHeader.SetName(new TCollection_HAsciiString((const Standard_CString)filename));
|
||||
makeHeader.SetAuthorValue (1, new TCollection_HAsciiString("FreeCAD"));
|
||||
makeHeader.SetOrganizationValue (1, new TCollection_HAsciiString("FreeCAD"));
|
||||
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString("FreeCAD"));
|
||||
makeHeader.SetDescriptionValue(1, new TCollection_HAsciiString("FreeCAD Model"));
|
||||
writer.Write(filename);
|
||||
}
|
||||
else if (file.hasExtension("igs") || file.hasExtension("iges")) {
|
||||
|
|
|
@ -95,11 +95,11 @@ void PartExport initPart()
|
|||
// see Init.py
|
||||
#if defined (_OCC64)
|
||||
#if OCC_VERSION_HEX < 0x060503
|
||||
App::GetApplication().addImportType("STEP AP203 format (*.step *.stp)","Part");
|
||||
App::GetApplication().addExportType("STEP AP203 format (*.step *.stp)","Part");
|
||||
App::GetApplication().addImportType("STEP (*.step *.stp)","Part");
|
||||
App::GetApplication().addExportType("STEP (*.step *.stp)","Part");
|
||||
#else
|
||||
App::GetApplication().addImportType("STEP AP214 format (*.step *.stp)","ImportGui");
|
||||
App::GetApplication().addExportType("STEP AP214 format (*.step *.stp)","ImportGui");
|
||||
App::GetApplication().addImportType("STEP with colors (*.step *.stp)","ImportGui");
|
||||
App::GetApplication().addExportType("STEP with colors (*.step *.stp)","ImportGui");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -446,9 +446,10 @@ CmdPartImport::CmdPartImport()
|
|||
void CmdPartImport::activated(int iMsg)
|
||||
{
|
||||
QStringList filter;
|
||||
filter << QString::fromAscii("STEP AP203 (*.stp *.step)");
|
||||
filter << QString::fromAscii("STEP AP214 (*.stp *.step)");
|
||||
filter << QString::fromAscii("STEP (*.stp *.step)");
|
||||
filter << QString::fromAscii("STEP with colors (*.stp *.step)");
|
||||
filter << QString::fromAscii("IGES (*.igs *.iges)");
|
||||
filter << QString::fromAscii("IGES with colors (*.igs *.iges)");
|
||||
filter << QString::fromAscii("BREP (*.brp *.brep)");
|
||||
|
||||
QString select;
|
||||
|
@ -459,7 +460,7 @@ void CmdPartImport::activated(int iMsg)
|
|||
if (!pDoc) return; // no document
|
||||
openCommand("Import Part");
|
||||
if (select == filter[1] ||
|
||||
select == filter[2]) {
|
||||
select == filter[3]) {
|
||||
doCommand(Doc, "import ImportGui");
|
||||
doCommand(Doc, "ImportGui.insert(\"%s\",\"%s\")", (const char*)fn.toUtf8(), pDoc->getName());
|
||||
}
|
||||
|
@ -504,9 +505,10 @@ CmdPartExport::CmdPartExport()
|
|||
void CmdPartExport::activated(int iMsg)
|
||||
{
|
||||
QStringList filter;
|
||||
filter << QString::fromAscii("STEP AP203 (*.stp *.step)");
|
||||
filter << QString::fromAscii("STEP AP214 (*.stp *.step)");
|
||||
filter << QString::fromAscii("STEP (*.stp *.step)");
|
||||
filter << QString::fromAscii("STEP with colors (*.stp *.step)");
|
||||
filter << QString::fromAscii("IGES (*.igs *.iges)");
|
||||
filter << QString::fromAscii("IGES with colors (*.igs *.iges)");
|
||||
filter << QString::fromAscii("BREP (*.brp *.brep)");
|
||||
|
||||
QString select;
|
||||
|
@ -515,7 +517,7 @@ void CmdPartExport::activated(int iMsg)
|
|||
App::Document* pDoc = getDocument();
|
||||
if (!pDoc) return; // no document
|
||||
if (select == filter[1] ||
|
||||
select == filter[2]) {
|
||||
select == filter[3]) {
|
||||
Gui::Application::Instance->exportTo((const char*)fn.toUtf8(),pDoc->getName(),"ImportGui");
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -54,9 +54,9 @@ FreeCAD.addExportType("IGES format (*.iges *.igs)","Part")
|
|||
# The registration of the STEP filetype for 64-bit is handled in initPart()
|
||||
import platform
|
||||
if platform.architecture()[0]=='32bit':
|
||||
FreeCAD.addImportType("STEP AP214 format (*.step *.stp)","ImportGui")
|
||||
FreeCAD.addExportType("STEP AP214 format (*.step *.stp)","ImportGui")
|
||||
FreeCAD.addImportType("STEP with colors (*.step *.stp)","ImportGui")
|
||||
FreeCAD.addExportType("STEP with colors (*.step *.stp)","ImportGui")
|
||||
#else:
|
||||
# FreeCAD.addImportType("STEP AP203 format (*.step *.stp)","Part")
|
||||
# FreeCAD.addExportType("STEP AP203 format (*.step *.stp)","Part")
|
||||
# FreeCAD.addImportType("STEP (*.step *.stp)","Part")
|
||||
# FreeCAD.addExportType("STEP (*.step *.stp)","Part")
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user