@@ -22,21 +22,24 @@ any valid OCP script will execute just fine. For example, this simple CadQuery s
2222
2323is actually equivalent to::
2424
25+ from OCP.BRepPrimAPI import BRepPrimAPI_MakeBox
26+ from OCP.gp import gp_Ax2, gp_Dir, gp_Pnt
27+
2528 return cq.Shape.cast(
2629 BRepPrimAPI_MakeBox(
27- gp_Ax2(Vector (-0.1 , -1.0, -1.5), Vector (0, 0, 1)), 1.0, 2.0, 3.0
30+ gp_Ax2(gp_Pnt (-0.5 , -1.0, -1.5), gp_Dir (0, 0, 1)), 1.0, 2.0, 3.0
2831 ).Shape()
2932 )
3033
3134As long as you return a valid OCP Shape, you can use any OCP methods you like. You can even mix and match the
3235two. For example, consider this script, which creates a OCP box, but then uses CadQuery to select its faces::
3336
34- box = cq.Shape.cast(
37+ box1 = cq.Shape.cast(
3538 BRepPrimAPI_MakeBox(
36- gp_Ax2(Vector (-0.1 , -1.0, -1.5), Vector (0, 0, 1)), 1.0, 2.0, 3.0
39+ gp_Ax2(gp_Pnt (-0.5 , -1.0, -1.5), gp_Dir (0, 0, 1)), 1.0, 2.0, 3.0
3740 ).Shape()
3841 )
39- cq = Workplane(box) .faces(">Z ").size () # returns 6
42+ return box1 .faces(">X ").Area () # return 6.0
4043
4144
4245Extending CadQuery: Plugins
0 commit comments