Skip to content

Commit 69e9514

Browse files
authored
Fix the function call errors for gp_Ax2() and size() (#1977)
* Fix the function call errors for gp_Ax2() and size() * rename box to box1
1 parent fe53ca0 commit 69e9514

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

doc/extending.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,24 @@ any valid OCP script will execute just fine. For example, this simple CadQuery s
2222

2323
is 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

3134
As long as you return a valid OCP Shape, you can use any OCP methods you like. You can even mix and match the
3235
two. 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

4245
Extending CadQuery: Plugins

0 commit comments

Comments
 (0)