Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set OCCT_VER = "8.0.1" %}
{% set OCP_TWEAK = "0" %}
{% set OCP_TWEAK = "1" %}

package:
name: ocp
Expand Down
94 changes: 34 additions & 60 deletions ocp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ class Adaptor3d_Surface;

[Attributes]

__version__ = "8.0.1.0"
__version__ = "8.0.1.1"

[Modules]

Expand Down Expand Up @@ -1534,10 +1534,6 @@ void register_template_NCollection_Vector(py::object &m, const char *name){
exclude_functions = ["OSD","OSD_OpenStream"]
exclude_classes = ["OSD","OSD_FileSystem","OSD_CachedFileSystem","OSD_FileSystemSelector","OSD_LocalFileSystem"]
exclude_methods = ["OSD_SharedLibrary::DlSymb"]
#"OSD_FileSystem::IsOpenIStream","OSD_FileSystem::IsOpenOStream","OSD_FileSystem::OpenOStream","OSD_FileSystem::OpenIStream",
#"OSD_CachedFileSystem::IsOpenIStream","OSD_CachedFileSystem::IsOpenOStream","OSD_CachedFileSystem::OpenOStream","OSD_CachedFileSystem::OpenIStream",
#"OSD_FileSystemSelector::IsOpenIStream","OSD_FileSystemSelector::IsOpenOStream","OSD_FileSystemSelector::OpenOStream","OSD_FileSystemSelector::OpenIStream",
#"OSD_LocalFileSystem::IsOpenIStream","OSD_LocalFileSystem::IsOpenOStream","OSD_LocalFileSystem::OpenOStream","OSD_LocalFileSystem::OpenIStream"]

include_body_pre = 'py::class_<OSD_FileSystem, opencascade::handle<OSD_FileSystem>>(m, "OSD_FileSystem");'

Expand All @@ -1561,11 +1557,25 @@ void register_template_NCollection_Vector(py::object &m, const char *name){
"TCollection_ExtendedString::operator\\+=",
"TCollection_ExtendedString::AssignCat",
]
include_body_post = """py::implicitly_convertible<std::string, TCollection_HAsciiString>();
py::implicitly_convertible<std::string, TCollection_AsciiString>();"""

[Modules.TCollection.Classes.TCollection_ExtendedString]

exclude_constructors = ["string_view"]

[[Modules.TCollection.Classes.TCollection_HAsciiString.additional_constructors]]

body = "[](const std::string &s){ return TCollection_HAsciiString(s.c_str()); }"
help = "std::strings based constructor"
arguments = ["aString"]

[[Modules.TCollection.Classes.TCollection_AsciiString.additional_constructors]]

body = "[](const std::string &s){ return TCollection_AsciiString(s.c_str()); }"
help = "std::strings based constructor"
arguments = ["aString"]

[Modules.TColStd]

exclude_typedefs = ["TColStd_DataMapOfIntegerTransient","TColStd","TColStd_DataMapOfTransientTransient","TColStd_IndexedDataMapOfTransientTransient"]
Expand Down Expand Up @@ -1873,8 +1883,6 @@ auto OptionsForAttach = [](){return AIS_Manipulator::OptionsForAttach();};"""

exclude_typedefs = ["Select3D_IndexedMapOfEntity","Graphic3d_Vec3d","Select3D_BndBox3d"] #couldn't deduce template parameter ‘Hasher’

# exclude_methods = ["Select3D_SensitiveFace::GetPoints","Select3D_SensitivePoly::Points3D", "Select3D_InteriorSensitivePointSet::GetPoints"]

[Modules.Select3D.Classes.Select3D_SensitiveCircle]

exclude_constructors = [0,1] #missing vftable
Expand Down Expand Up @@ -2168,6 +2176,12 @@ struct __GLXFBConfigRec {};"""

exclude_classes = ["StepData_EnumTool"]

[Modules.StepData.Classes.StepData_SelectType.additional_methods.SetValue]

body = "[](StepData_SelectType &self , py::object& ent){self.SetValue(cast_pyobject<Standard_Transient>(ent));}"
help = "SetValue supporting python objects"
arguments = ["ent"]

[Modules.LDOM]

exclude_classes = ["LDOMString","LDOM_MemManager","LDOM_BasicText"]
Expand All @@ -2185,7 +2199,6 @@ struct __GLXFBConfigRec {};"""
[Modules.ShapeAnalysis]

exclude_classes = ["ShapeAnalysis_BoxBndTreeSelector"]
# exlcude_methods = ["ShapeAnalysis_FreeBounds::ConnectEdgesToWires", "ShapeAnalysis_FreeBounds::ConnectWiresToWires","ShapeAnalysis_FreeBounds::SplitWires"]

[Modules.V3d]

Expand Down Expand Up @@ -2346,12 +2359,22 @@ using rapidjson::BasicOStreamWrapper;"""

[Modules.Interface]

# exclude_methods = ["Interface_IntList::Internals", "Interface_STAT::Internals"]

[Modules.Interface.parsing_headers]

"Interface_ValueInterpret.hxx" = "#include <Interface_TypedValue.hxx>"

[Modules.Interface.Classes.Interface_InterfaceModel.additional_methods.AddEntity]

body = "[](Interface_InterfaceModel &self , py::object& ent){self.AddEntity(cast_pyobject<Standard_Transient>(ent));}"
help = "AddEntity supporting python objects"
arguments = ["anEnt"]

[Modules.Interface.Classes.Interface_InterfaceModel.additional_methods.AddWithRefs]

body = "[](Interface_InterfaceModel &self , py::object& ent){self.AddWithRefs(cast_pyobject<Standard_Transient>(ent));}"
help = "AddWithRefs supporting python objects"
arguments = ["anEnt"]

[Modules.IVtkVTK]

include_header_pre = """#include <vtkRenderer.h>
Expand Down Expand Up @@ -2449,8 +2472,6 @@ using rapidjson::BasicOStreamWrapper;"""

[Modules.IGESGeom]

# exclude_methods = ["IGESGeom_SplineSurface::Polynomials"]

module_parsing_header = "#include <Standard_OStream.hxx>"

[Modules.IGESGraph]
Expand All @@ -2463,8 +2484,6 @@ using rapidjson::BasicOStreamWrapper;"""

[Modules.GeomConvert]

# exclude_methods = ["GeomConvert::ConcatG1","GeomConvert::ConcatC1","GeomConvert::C0BSplineToC1BSplineCurve","GeomConvert::C0BSplineToArrayOfC1BSplineCurve",]

[Modules.GeomConvert.parsing_headers]

"GeomConvert_SurfToAnaSurf.hxx" = "class Geom_Curve; class gp_Ax3;"
Expand Down Expand Up @@ -2568,52 +2587,7 @@ using rapidjson::BasicOStreamWrapper;"""
[Modules.StepAP214]

include_header_pre = "#include <Interface_InterfaceModel.hxx>"
#
# [Modules.AppDef]
#
# exclude_methods = ["AppDef_SmoothCriterion::GetCurve","AppDef_LinearCriteria::GetCurve"]
#
# [Modules.BRepGProp]
#
# exclude_methods = ["BRepGProp_Face::GetUKnots", "BRepGProp_Face::GetTKnots", "BRepG_MeshCinert::PreparePolygon"]
#
# # [Modules.BSplCLib]
# #
# # exclude_methods =["BSplCLib::MergeBSplineKnots"]
#
# [Modules.Convert]
#
# exclude_methods = [
# "Convert_CompPolynomialToPoles::Poles","Convert_CompPolynomialToPoles::Knots","Convert_CompPolynomialToPoles::Multiplicities",
# "Convert_ConicToBSplineCurve::BuildCosAndSin"
# ]
#
# [Modules.FEmTool]
#
# exclude_methods = ["FEmTool_Assembly::GetAssemblyTable"]
#
# [Modules.Geom2dConvert]
#
# exclude_methods = ["Geom2dConvert::ConcatG1","Geom2dConvert::ConcatC1","Geom2dConvert::C0BSplineToC1BSplineCurve","Geom2dConvert::C0BSplineToArrayOfC1BSplineCurve",]
#
# [Modules.GeomLib]
#
# exclude_methods = ["GeomLib::RemovePointsFromArray", "GeomLib::DensifyArray1OfReal"]
#
# [Modules.IntCurveSurface]
#
# exclude_methods = ["IntCurveSurface_TheHCurveTool::SamplePars"]
#
# [Modules.Plate]
#
# exclude_methods = ["Plate_Plate::CoefPol"]
#
#
# [Modules.ShapeExtend]
#
# exclude_methods = ["ShapeExtend::DispatchList"]
#
#

[Modules.math]

exclude_methods = ["math_Matrix::operator="] # move assignemnt operator...
Expand Down
87 changes: 87 additions & 0 deletions tests/test_step.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
from OCP import Interface
from OCP.collections import (
HArray1_StepRepr_RepresentationItem as StepRepr_HArray1OfRepresentationItem,
)
from OCP.GeomToStep import GeomToStep_MakeAxis2Placement3d
from OCP.gp import gp_Ax2, gp_Pnt
from OCP.IFSelect import IFSelect_ReturnStatus
from OCP.STEPCAFControl import STEPCAFControl_Writer
from OCP.STEPConstruct import STEPConstruct
from OCP.STEPControl import STEPControl_StepModelType
from OCP.StepData import StepData_Factors

from OCP.StepRepr import (
StepRepr_ConstructiveGeometryRepresentation,
StepRepr_ConstructiveGeometryRepresentationRelationship,
)
from OCP.StepShape import StepShape_ShapeDefinitionRepresentation
from OCP.TCollection import (
TCollection_ExtendedString,
TCollection_HAsciiString,
)
from OCP.TDocStd import TDocStd_Document
from OCP.XCAFApp import XCAFApp_Application
from OCP.XCAFDoc import XCAFDoc_DocumentTool
from OCP.XmlXCAFDrivers import XmlXCAFDrivers
from OCP.XSControl import XSControl_WorkSession

from OCP.BRepBuilderAPI import BRepBuilderAPI_MakeVertex


def _step_with_supplemental_geom(path: str, loc_name: str,) -> None:

# create a doc and add a dummy vertex shape
app = XCAFApp_Application.GetApplication_s()
XmlXCAFDrivers.DefineFormat_s(app)
doc = TDocStd_Document(TCollection_ExtendedString("XmlXCAF"))
app.InitDocument(doc)

tool = XCAFDoc_DocumentTool.ShapeTool_s(doc.Main())
tool.AddShape(BRepBuilderAPI_MakeVertex(gp_Pnt(0, 0, 0)).Vertex(), False, True)

# transfer the model to a STEP model
session = XSControl_WorkSession()
writer = STEPCAFControl_Writer(session, False)
writer.Transfer(doc, STEPControl_StepModelType.STEPControl_AsIs)

model = session.Model()

# add a extra named location
for i in range(model.NbEntities()):
ent = model.Value(i + 1)

if isinstance(ent, StepShape_ShapeDefinitionRepresentation):
sdr = ent
break

rep = sdr.UsedRepresentation()

cs_array = StepRepr_HArray1OfRepresentationItem(1, 1)

step_loc = GeomToStep_MakeAxis2Placement3d(gp_Ax2(), StepData_Factors()).Value()
step_loc.SetName(TCollection_HAsciiString(loc_name))

cs_array.SetValue(1, step_loc)

cgr = StepRepr_ConstructiveGeometryRepresentation()
cgr.Init(
"Additional coordinate system", cs_array, rep.ContextOfItems(),
)

cgrr = StepRepr_ConstructiveGeometryRepresentationRelationship()
cgrr.Init("", "", rep, cgr)

model.AddWithRefs(cgrr)

status = writer.Write(path)
assert status == IFSelect_ReturnStatus.IFSelect_RetDone


def test_supplemental_geom():

_step_with_supplemental_geom("supplemental.step", "supplemental location")

with open("supplemental.step") as f:
step = f.read()

assert "supplemental location" in step