-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling OCP for Apple M1 Max (arm64) #68
Comments
Could you share |
|
And now that I think of it, I do have an "OCP" folder with cpp files in the OCP repo, but I actually don't remember/know where it came from. Is this something the process build creates? |
To answer my own question, the OCP folder gets created by the process. Just repeated the steps in a fresh clone. |
btw. I tried it on OCP master branch - if that info helps |
To be able to continue, I commented out the section of $ ls -lh ../OCP/OCP.cpython-38-darwin.so
-rwxr-xr-x 1 bernhard staff 268M Nov 28 17:31 ../OCP/OCP.cpython-38-darwin.so
$ file ../OCP/OCP.cpython-38-darwin.so
../OCP/OCP.cpython-38-darwin.so: Mach-O 64-bit bundle arm64 I then did the following to create a cadquery environment:
SUCCESS! |
You can provide just the part related to |
So the only remaining problem is the Gltf Writer. I did some more research and now think the pywrap error (which seems to come from a missing |
This is the section I commented out: // Class RWGltf_GltfOStreamWriter from ./opencascade/RWGltf_GltfOStreamWriter.hxx
klass = m.attr("RWGltf_GltfOStreamWriter");
// nested enums
static_cast<py::class_<RWGltf_GltfOStreamWriter , shared_ptr<RWGltf_GltfOStreamWriter> >>(klass)
// constructors
.def(py::init< int & >() , py::arg("theOStream") )
// custom constructors
// methods
// methods using call by reference i.s.o. return
// static methods
// static methods using call by reference i.s.o. return
// operators
// additional methods and static methods
// properties
// methods returning by ref wrapped as properties
; The // Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _RWGltf_GltfOStreamWriter_HeaderFile
#define _RWGltf_GltfOStreamWriter_HeaderFile
#include <rapidjson/prettywriter.h>
#include <rapidjson/ostreamwrapper.h>
//! rapidjson::Writer wrapper for forward declaration.
class RWGltf_GltfOStreamWriter : public rapidjson::Writer<rapidjson::OStreamWrapper>
{
public:
//! Main constructor.
RWGltf_GltfOStreamWriter (rapidjson::OStreamWrapper& theOStream)
: rapidjson::Writer<rapidjson::OStreamWrapper> (theOStream) {}
};
#endif // _RWGltf_GltfOStreamWriter_HeaderFile |
Thanks, I was referring to the parts of |
I compared a linux build with my setup and turns out that I had
I installed Now both pywrap and cmake are successful and the OCP package works. The final build steps were: brew install cmake ninja
# Install Mambaforge https://github.com/conda-forge/miniforge
# https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-MacOSX-x86_64.sh
mamba create -n cq python=3.8
mamba activate cq
mamba install pybind11=2.6 occt=7.5.2 pandas rapidjson
git clone https://github.com/CadQuery/OCP.git
cd OCP/
git submodule update --init
cd pywrap/
pip install .
cd ..
PREFIX=/Library/Developer/CommandLineTools
SDK=SDKs/MacOSX12.sdk
C_INC=$PREFIX/$SDK/usr/include/
CPP_INC=$PREFIX/$SDK/usr/include/c++/v1/
GL_INC=$PREFIX/$SDK/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/
VTK_INC=$CONDA_PREFIX/include/vtk-9.0/
MAMBA_INC=$CONDA_PREFIX/include
LIBCLANG=$PREFIX/usr/lib/libclang.dylib
mkdir -p include
rm -f ./include/OpenGL
ln -s $GL_INC ./include/OpenGL
pywrap -i $CPP_INC -i $C_INC -i ./include -i $VTK_INC -i $MAMBA_INC -l $LIBCLANG all ocp.toml
cmake -B build -S ./OCP -G Ninja -DCMAKE_BUILD_TYPE=Release -DPython3_FIND_STRATEGY=LOCATION -DPython3_ROOT_DIR=$CONDA_PREFIX
cmake --build build -j 8 -- -k 0 |
Interesting, rapidjson should be a dep of OCCT. Didn't you have it in the original env? |
Yes, maybe it was, I didn't pay too much attention when I (re-) installed ... However, I don't think the pywrap error message around rapidjson appeared with pybind11 2.8. Anyways, switching to pybind11 2.6 solved the problem for me. And it is the same version that you use for Linux. |
Are you planning to build both libs for MacOS in the future? And maybe for the intel library, would it be possible to switch to RELEASE (as I did above). The current DEBUG version has 1.3GB unpacked. Finally, will you support the latest occt 7.6.0 soon or do you maybe prefer to wait for 7.6.1 |
Pywrap parsing does not use pybind11 at all - sounds unlikely that the version has impact. Which intel library? OCP on mac is built with DEBUG - need to fix that. Yes, I'm working on 7.6. |
OK, then I don't know why it suddenly worked. Anyways, it works :-)
yes, I meant OCP on Mac.
cool, thanks! |
@adam-urbanczyk Don't want to open a separate thread now, just a question: Would it be possible to build a Universal library for the Mac for 7.6.x (that works for ARM and Intel)? A universal library looks like that: $ file /usr/lib/zsh/5.8/zsh/termcap.so
/usr/lib/zsh/5.8/zsh/termcap.so: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64] [arm64e:Mach-O 64-bit bundle arm64e]
/usr/lib/zsh/5.8/zsh/termcap.so (for architecture x86_64): Mach-O 64-bit bundle x86_64
/usr/lib/zsh/5.8/zsh/termcap.so (for architecture arm64e): Mach-O 64-bit bundle arm64e I made a test and as soon as I add |
I am reopening the issue to further investigate into CadQuery and OCP on Apple M1. I did not expect it to work, but thought to share the result of running CadQuery tests against an Apple M1. It actually does look promising to me, the only ugly thing is the segmentation fault. I hope that helps you to get in idea about the state of CadQuery on Apple M1 Compiling OCP 7.6.0
Tests on the M1Using the Fatal errors:The two methods
tests/test_cadquery.py::TestCadQuery::testBrepImportExport Fatal Python error: Segmentation fault
Current thread 0x00000001032d8580 (most recent call first):
File "/Users/bernhard/Development/cadquery/cadquery/cadquery/occ_impl/shapes.py", line 467 in exportBrep
File "/Users/bernhard/Development/cadquery/cadquery/tests/test_cadquery.py", line 5057 in testBrepImportExport Non fatal errorsRunning tests/test_assembly.py::test_vtkjs_export FAILED [ 1%]
tests/test_assembly.py::test_vrml_export FAILED [ 1%]
tests/test_assembly.py::test_toJSON FAILED [ 1%]
tests/test_assembly.py::test_save[wrl-args4] FAILED [ 2%]
tests/test_assembly.py::test_save_vtkjs FAILED [ 3%]
tests/test_cadquery.py::TestCadQuery::testLocationAt FAILED [ 31%]
tests/test_examples.py::test_example[87] FAILED [ 78%]
tests/test_exporters.py::TestExporters::testAMF FAILED [ 79%]
tests/test_exporters.py::TestExporters::testTJS FAILED [ 80%]
tests/test_exporters.py::TestExporters::testVTP FAILED [ 81%]
tests/test_jupyter.py::TestJupyter::test_repr_javascript FAILED [ 83%]
tests/test_sketch.py::test_distribute FAILED [ 93%] Details of pytest: FAILED tests/test_assembly.py::test_vtkjs_export - TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
FAILED tests/test_assembly.py::test_vrml_export - TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
FAILED tests/test_assembly.py::test_toJSON - TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
FAILED tests/test_assembly.py::test_save[wrl-args4] - TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
FAILED tests/test_assembly.py::test_save_vtkjs - TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
FAILED tests/test_cadquery.py::TestCadQuery::testLocationAt - AttributeError: 'Edge' object has no attribute '_geomAdaptorH'
FAILED tests/test_examples.py::test_example[87] - assert AttributeError("'Wire' object has no attribute '_geomAdaptorH'") is None
FAILED tests/test_exporters.py::TestExporters::testAMF - AttributeError: 'OCP.Poly.Poly_Triangulation' object has no attribute 'Nodes'
FAILED tests/test_exporters.py::TestExporters::testTJS - AttributeError: 'OCP.Poly.Poly_Triangulation' object has no attribute 'Nodes'
FAILED tests/test_exporters.py::TestExporters::testVTP - TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
FAILED tests/test_jupyter.py::TestJupyter::test_repr_javascript - TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
FAILED tests/test_sketch.py::test_distribute - AttributeError: 'Edge' object has no attribute '_geomAdaptorH' Three errors are a consequence of removing all occurences of
That leaves ______________________________________________________________________________ test_vtkjs_export ______________________________________________________________________________
nested_assy = <cadquery.assembly.Assembly object at 0x1580124c0>
def test_vtkjs_export(nested_assy):
> exportVTKJS(nested_assy, "assy")
tests/test_assembly.py:204:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cadquery/occ_impl/exporters/assembly.py:103: in exportVTKJS
renderWindow = _vtkRenderWindow(assy)
cadquery/occ_impl/exporters/assembly.py:90: in _vtkRenderWindow
toVTK(assy, renderer)
cadquery/occ_impl/assembly.py:191: in toVTK
data = Compound.makeCompound(assy.shapes).toVtkPolyData(tolerance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cadquery.occ_impl.shapes.Compound object at 0x158013610>, tolerance = 0.001, angularTolerance = 0.1, normals = True
def toVtkPolyData(
self, tolerance: float, angularTolerance: float = 0.1, normals: bool = True
) -> vtkPolyData:
"""
Convert shape to vtkPolyData
"""
vtk_shape = IVtkOCC_Shape(self.wrapped)
shape_data = IVtkVTK_ShapeData()
> shape_mesher = IVtkOCC_ShapeMesher(
tolerance, angularTolerance, theNbUIsos=0, theNbVIsos=0
)
E TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
E 1. OCP.IVtkOCC.IVtkOCC_ShapeMesher()
E
E Invoked with: 0.001, 0.1; kwargs: theNbUIsos=0, theNbVIsos=0
cadquery/occ_impl/shapes.py:1193: TypeError
______________________________________________________________________________ test_vrml_export _______________________________________________________________________________
simple_assy = <cadquery.assembly.Assembly object at 0x1463e6370>
def test_vrml_export(simple_assy):
> exportVRML(simple_assy, "assy.wrl")
tests/test_assembly.py:212:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cadquery/occ_impl/exporters/assembly.py:121: in exportVRML
exporter.SetRenderWindow(_vtkRenderWindow(assy))
cadquery/occ_impl/exporters/assembly.py:90: in _vtkRenderWindow
toVTK(assy, renderer)
cadquery/occ_impl/assembly.py:191: in toVTK
data = Compound.makeCompound(assy.shapes).toVtkPolyData(tolerance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cadquery.occ_impl.shapes.Compound object at 0x1463e6b50>, tolerance = 0.001, angularTolerance = 0.1, normals = True
def toVtkPolyData(
self, tolerance: float, angularTolerance: float = 0.1, normals: bool = True
) -> vtkPolyData:
"""
Convert shape to vtkPolyData
"""
vtk_shape = IVtkOCC_Shape(self.wrapped)
shape_data = IVtkVTK_ShapeData()
> shape_mesher = IVtkOCC_ShapeMesher(
tolerance, angularTolerance, theNbUIsos=0, theNbVIsos=0
)
E TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
E 1. OCP.IVtkOCC.IVtkOCC_ShapeMesher()
E
E Invoked with: 0.001, 0.1; kwargs: theNbUIsos=0, theNbVIsos=0
cadquery/occ_impl/shapes.py:1193: TypeError
_________________________________________________________________________________ test_toJSON _________________________________________________________________________________
simple_assy = <cadquery.assembly.Assembly object at 0x145979b80>, nested_assy = <cadquery.assembly.Assembly object at 0x145a744f0>
empty_top_assy = <cadquery.assembly.Assembly object at 0x158012ac0>
def test_toJSON(simple_assy, nested_assy, empty_top_assy):
> r1 = toJSON(simple_assy)
tests/test_assembly.py:220:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cadquery/occ_impl/assembly.py:229: in toJSON
data = toString(Compound.makeCompound(assy.shapes), tolerance)
cadquery/occ_impl/exporters/vtk.py:21: in toString
writer.SetInputData(shape.toVtkPolyData(tolerance, angularTolerance))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cadquery.occ_impl.shapes.Compound object at 0x1460d9250>, tolerance = 0.001, angularTolerance = 0.1, normals = True
def toVtkPolyData(
self, tolerance: float, angularTolerance: float = 0.1, normals: bool = True
) -> vtkPolyData:
"""
Convert shape to vtkPolyData
"""
vtk_shape = IVtkOCC_Shape(self.wrapped)
shape_data = IVtkVTK_ShapeData()
> shape_mesher = IVtkOCC_ShapeMesher(
tolerance, angularTolerance, theNbUIsos=0, theNbVIsos=0
)
E TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
E 1. OCP.IVtkOCC.IVtkOCC_ShapeMesher()
E
E Invoked with: 0.001, 0.1; kwargs: theNbUIsos=0, theNbVIsos=0
cadquery/occ_impl/shapes.py:1193: TypeError
____________________________________________________________________________ test_save[wrl-args4] _____________________________________________________________________________
extension = 'wrl', args = ('VRML',), nested_assy = <cadquery.assembly.Assembly object at 0x145e257c0>, nested_assy_sphere = <cadquery.assembly.Assembly object at 0x145940490>
@pytest.mark.parametrize(
"extension, args",
[
("step", ()),
("xml", ()),
("stp", ("STEP",)),
("caf", ("XML",)),
("wrl", ("VRML",)),
],
)
def test_save(extension, args, nested_assy, nested_assy_sphere):
filename = "nested." + extension
> nested_assy.save(filename, *args)
tests/test_assembly.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cadquery/assembly.py:445: in save
exportVRML(self, path)
cadquery/occ_impl/exporters/assembly.py:121: in exportVRML
exporter.SetRenderWindow(_vtkRenderWindow(assy))
cadquery/occ_impl/exporters/assembly.py:90: in _vtkRenderWindow
toVTK(assy, renderer)
cadquery/occ_impl/assembly.py:191: in toVTK
data = Compound.makeCompound(assy.shapes).toVtkPolyData(tolerance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cadquery.occ_impl.shapes.Compound object at 0x142568250>, tolerance = 0.001, angularTolerance = 0.1, normals = True
def toVtkPolyData(
self, tolerance: float, angularTolerance: float = 0.1, normals: bool = True
) -> vtkPolyData:
"""
Convert shape to vtkPolyData
"""
vtk_shape = IVtkOCC_Shape(self.wrapped)
shape_data = IVtkVTK_ShapeData()
> shape_mesher = IVtkOCC_ShapeMesher(
tolerance, angularTolerance, theNbUIsos=0, theNbVIsos=0
)
E TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
E 1. OCP.IVtkOCC.IVtkOCC_ShapeMesher()
E
E Invoked with: 0.001, 0.1; kwargs: theNbUIsos=0, theNbVIsos=0
cadquery/occ_impl/shapes.py:1193: TypeError
_______________________________________________________________________________ test_save_vtkjs _______________________________________________________________________________
nested_assy = <cadquery.assembly.Assembly object at 0x158059a30>
def test_save_vtkjs(nested_assy):
> nested_assy.save("nested", "VTKJS")
tests/test_assembly.py:255:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cadquery/assembly.py:449: in save
exportVTKJS(self, path)
cadquery/occ_impl/exporters/assembly.py:103: in exportVTKJS
renderWindow = _vtkRenderWindow(assy)
cadquery/occ_impl/exporters/assembly.py:90: in _vtkRenderWindow
toVTK(assy, renderer)
cadquery/occ_impl/assembly.py:191: in toVTK
data = Compound.makeCompound(assy.shapes).toVtkPolyData(tolerance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cadquery.occ_impl.shapes.Compound object at 0x1580ce760>, tolerance = 0.001, angularTolerance = 0.1, normals = True
def toVtkPolyData(
self, tolerance: float, angularTolerance: float = 0.1, normals: bool = True
) -> vtkPolyData:
"""
Convert shape to vtkPolyData
"""
vtk_shape = IVtkOCC_Shape(self.wrapped)
shape_data = IVtkVTK_ShapeData()
> shape_mesher = IVtkOCC_ShapeMesher(
tolerance, angularTolerance, theNbUIsos=0, theNbVIsos=0
)
E TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
E 1. OCP.IVtkOCC.IVtkOCC_ShapeMesher()
E
E Invoked with: 0.001, 0.1; kwargs: theNbUIsos=0, theNbVIsos=0
cadquery/occ_impl/shapes.py:1193: TypeError
____________________________________________________________________________ TestExporters.testAMF ____________________________________________________________________________
self = <tests.test_exporters.TestExporters testMethod=testAMF>
def testAMF(self):
> self._exportBox(exporters.ExportTypes.AMF, ["<amf units", "</object>"])
tests/test_exporters.py:75:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_exporters.py:30: in _exportBox
exporters.exportShape(
cadquery/utils.py:38: in wrapped
return f(*args, **kwargs)
cadquery/occ_impl/exporters/__init__.py:172: in exportShape
tess = tessellate(shape, angularTolerance)
cadquery/occ_impl/exporters/__init__.py:147: in tessellate
return shape.tessellate(tolerance, angularTolerance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cadquery.occ_impl.shapes.Compound object at 0x1425f0220>, tolerance = 0.1, angularTolerance = 0.1
def tessellate(
self, tolerance: float, angularTolerance: float = 0.1
) -> Tuple[List[Vector], List[Tuple[int, int, int]]]:
self.mesh(tolerance, angularTolerance)
vertices: List[Vector] = []
triangles: List[Tuple[int, int, int]] = []
offset = 0
for f in self.Faces():
loc = TopLoc_Location()
poly = BRep_Tool.Triangulation_s(f.wrapped, loc)
Trsf = loc.Transformation()
reverse = (
True
if f.wrapped.Orientation() == TopAbs_Orientation.TopAbs_REVERSED
else False
)
# add vertices
vertices += [
Vector(v.X(), v.Y(), v.Z())
> for v in (v.Transformed(Trsf) for v in poly.Nodes())
]
E AttributeError: 'OCP.Poly.Poly_Triangulation' object has no attribute 'Nodes'
cadquery/occ_impl/shapes.py:1161: AttributeError
____________________________________________________________________________ TestExporters.testTJS ____________________________________________________________________________
self = <tests.test_exporters.TestExporters testMethod=testTJS>
def testTJS(self):
> self._exportBox(
exporters.ExportTypes.TJS, ["vertices", "formatVersion", "faces"]
)
tests/test_exporters.py:85:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_exporters.py:30: in _exportBox
exporters.exportShape(
cadquery/utils.py:38: in wrapped
return f(*args, **kwargs)
cadquery/occ_impl/exporters/__init__.py:156: in exportShape
tess = tessellate(shape, angularTolerance)
cadquery/occ_impl/exporters/__init__.py:147: in tessellate
return shape.tessellate(tolerance, angularTolerance)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cadquery.occ_impl.shapes.Compound object at 0x1582ba310>, tolerance = 0.1, angularTolerance = 0.1
def tessellate(
self, tolerance: float, angularTolerance: float = 0.1
) -> Tuple[List[Vector], List[Tuple[int, int, int]]]:
self.mesh(tolerance, angularTolerance)
vertices: List[Vector] = []
triangles: List[Tuple[int, int, int]] = []
offset = 0
for f in self.Faces():
loc = TopLoc_Location()
poly = BRep_Tool.Triangulation_s(f.wrapped, loc)
Trsf = loc.Transformation()
reverse = (
True
if f.wrapped.Orientation() == TopAbs_Orientation.TopAbs_REVERSED
else False
)
# add vertices
vertices += [
Vector(v.X(), v.Y(), v.Z())
> for v in (v.Transformed(Trsf) for v in poly.Nodes())
]
E AttributeError: 'OCP.Poly.Poly_Triangulation' object has no attribute 'Nodes'
cadquery/occ_impl/shapes.py:1161: AttributeError
____________________________________________________________________________ TestExporters.testVTP ____________________________________________________________________________
self = <tests.test_exporters.TestExporters testMethod=testVTP>
def testVTP(self):
> exporters.export(self._box(), "out.vtp")
tests/test_exporters.py:105:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cadquery/occ_impl/exporters/__init__.py:113: in export
exportVTP(shape, fname, tolerance, angularTolerance)
cadquery/occ_impl/exporters/vtk.py:11: in exportVTP
writer.SetInputData(shape.toVtkPolyData(tolerance, angularTolerance))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cadquery.occ_impl.shapes.Compound object at 0x1425897c0>, tolerance = 0.1, angularTolerance = 0.1, normals = True
def toVtkPolyData(
self, tolerance: float, angularTolerance: float = 0.1, normals: bool = True
) -> vtkPolyData:
"""
Convert shape to vtkPolyData
"""
vtk_shape = IVtkOCC_Shape(self.wrapped)
shape_data = IVtkVTK_ShapeData()
> shape_mesher = IVtkOCC_ShapeMesher(
tolerance, angularTolerance, theNbUIsos=0, theNbVIsos=0
)
E TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
E 1. OCP.IVtkOCC.IVtkOCC_ShapeMesher()
E
E Invoked with: 0.1, 0.1; kwargs: theNbUIsos=0, theNbVIsos=0
cadquery/occ_impl/shapes.py:1193: TypeError
______________________________________________________________________ TestJupyter.test_repr_javascript _______________________________________________________________________
self = <tests.test_jupyter.TestJupyter testMethod=test_repr_javascript>
def test_repr_javascript(self):
cube = cq.Workplane("XY").box(1, 1, 1)
assy = cq.Assembly().add(cube)
shape = cube.val()
self.assertIsInstance(shape, cq.occ_impl.shapes.Solid)
# Test no exception on rendering to js
> js1 = shape._repr_javascript_()
tests/test_jupyter.py:16:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cadquery/occ_impl/shapes.py:1228: in _repr_javascript_
return display(self)._repr_javascript_()
cadquery/occ_impl/jupyter_tools.py:167: in display
shape=toString(shape),
cadquery/occ_impl/exporters/vtk.py:21: in toString
writer.SetInputData(shape.toVtkPolyData(tolerance, angularTolerance))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cadquery.occ_impl.shapes.Solid object at 0x1461b1460>, tolerance = 0.001, angularTolerance = 0.1, normals = True
def toVtkPolyData(
self, tolerance: float, angularTolerance: float = 0.1, normals: bool = True
) -> vtkPolyData:
"""
Convert shape to vtkPolyData
"""
vtk_shape = IVtkOCC_Shape(self.wrapped)
shape_data = IVtkVTK_ShapeData()
> shape_mesher = IVtkOCC_ShapeMesher(
tolerance, angularTolerance, theNbUIsos=0, theNbVIsos=0
)
E TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
E 1. OCP.IVtkOCC.IVtkOCC_ShapeMesher()
E
E Invoked with: 0.001, 0.1; kwargs: theNbUIsos=0, theNbVIsos=0
cadquery/occ_impl/shapes.py:1193: TypeError |
CQ is on 7.5.3. No point in trying 7.6 yet. |
Got it. I now ran pytest against OCP 7.5.3. Again a segmentation fault for
The rest is working (fine with some warnings) |
conda-forge cross-compiles for osx-arm64 now |
Trying to get CadQuery running on an arm64 CPU based Macbook Pro (M1 Max):
I have set up conda via MambaForge which provides Python and conda packages for Mac arm64 CPU (installer):
Issue
I came pretty far, however stuck with one final compilation error (the single
pywrap
warning, see below, seems to be unrelated):The steps I used to get there:
pywrap issue
The pywrap run only had one issue:
Since this error appeared in a dump JSON routine, I thought to ignore and compile nevertheless.
The text was updated successfully, but these errors were encountered: