gp_Trsf)atranslation=gp_Trsf() atranslation.SetTranslation(gp_Vec(1, 1, 1)) arotate=gp_Trsf() arotate.SetRotation(gp_OZ(), math.pi) atransform= atranslation *arotatedeftest1():print('测试1, 平移 -> 旋转') pt= gp_Pnt(-1, -1, -1)print(pt.Coord()) pt2=pt.Transform(atransla...
像在gp模块,还有gp_Mat ,gp_Trsf,gp_GTrsf,gp_Quanternion(四元组,和gp_XYZ类似),双曲线和抛物线,但平时实在用的少就先补了解了。 像Mat模块,其实之前在做深度学习人脸识别时也了解过一些,在pytorch的模块里面,mat是核心功能。以后有机会再看看occ是怎么做的mat。 gp_Trsf 和gp_GTrsf模块应该是基于gp_Mat...
gp_Ax1 xAxis = gp::OX(); gp_Trsf aTrsf; aTrsf.SetMirror(xAxis); BRepBuilderAPI_Transform aBRepTrsf(aWire, aTrsf); TopoDS_Shape aMirroredShape = aBRepTrsf.Shape(); TopoDS_Wire aMirroredWire = TopoDS::Wire(aMirroredShape); BRepBuilderAPI_MakeWire mkWire; mkWire.Add(aWire); mkWire...
axis=gp_Ax1(gp_Pnt(0,0,0),gp_Dir(0,0,1))transformation=gp_Trsf()transformation.SetRotation(axis,math.pi/4)# 旋转角度为45度brep_shape=brep_shape.Moved(transformation) 1. 2. 3. 4. 5. 6. 7. 平移操作: fromOCC.gpimportgp_Vec,gp_Trsf translation_vector=gp_Vec(1,2,3)transformation=...
OCC复制Shape voidoccQt::makeBox() {//新建BOXTopoDS_Shape aTopoBoxA = BRepPrimAPI_MakeBox(3.0,4.0,5.0).Shape();//复制shapeBRepBuilderAPI_Copy aShapeCopy; aShapeCopy.Perform(aTopoBoxA); TopoDS_Shape aTopoBoxB=aShapeCopy.Shape();//平移,防止2个BOX重叠gp_Trsf aTrsf;...
We create a `gp_Trsf` object `translation` that represents a translation transformation with a 5.0 unitdisplacement in the X direction. We then use the `BRepBuilderAPI_Transform` class to apply the translation to the `box` shape. Finally, calling the `Shape()` function on the transformed ...
gp_Trsf translation; translation.SetTranslation(gp_Vec(10,0,0));// 平移向量为(10, 0, 0) // 修改形状的几何信息 BRepBuilderAPI_Transform transform(selectedObject,translation); TopoDS_Shape translatedShape=transform.Shape(); 在上述示例中,我们首先创建了一个平移变换矩阵,并将其应用于选中的形状对象...
It isn't as difficult as you might think, operator overloading is not used that much and there is some messing with pointers in gp_Trsf for example but nothing that cannot be handled, I have made a java application that translates most of the C++ code into java source code, it takes ...
gp_Trsf aTrsf; aTrsf.SetTranslation(gp_Vec(8.0, 0.0, 0.0)); BRepBuilderAPI_Transform aTransform(aFusedShape, aTrsf); Handle(AIS_Shape) anAisBox = new AIS_Shape(aTopoBox); Handle(AIS_Shape) anAisSphere = new AIS_Shape(aTopoSphere); ...
( GeomAPI_Interpolate, GeomAPI_PointsToBSpline, GeomAPI_ProjectPointOnCurve, ) from OCC.Core.gp import gp_Pnt, gp_Vec, gp_Trsf from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_Transform from OCC.Core.TopoDS import TopoDS_Edge, TopoDS_Shape, TopoDS_Wire, TopoDS_Vertex from OCC.Core.Quantity...