gp_Ax1, gp_Dir, gp_Circ, gp_Elips,gp_Trsf,gp_VecfromOCC.Core.TopLocimportTopLoc_LocationfromOCC.Core.GCimportGC_MakeSegment, GC_MakeCircle, GC_MakeArcOfCircle, GC_MakeEllipse
我们将利用gp_Ax2和gp_Trsf来实现。 # 创建Z轴的旋转z_axis=gp_Ax1(gp_Pnt(0,0,0),gp_Dir(0,0,1))rotation_z=gp_Trsf()rotation_z.SetRotation(z_axis,alpha)# 创建Y轴的旋转y_axis=gp_Ax1(gp_Pnt(0,0,0),gp_Dir(0,1,0))rotation_y=gp_Trsf()rotation_y.SetRotation(y_axis,beta)# ...
gp_Ax1,gp_Dir,gp_Circ,gp_Elips,gp_Trsf,gp_VecfromOCC.Core.TopLocimportTopLoc_LocationfromOCC.Core.GCimportGC_MakeSegment,GC_MakeCircle,GC_MakeArcOfCircle,GC_MakeEllipse,GC_Make
几何操作:虽然gp_Pnt本身不直接提供复杂的几何运算,但它经常与其他类如gp_Vec(表示向量)或gp_Dir(表示方向)结合使用,进行距离计算、点乘、叉乘等操作。 变换:当需要对点进行平移、旋转或缩放时,通常使用gp_Trsf类的变换方法,并通过相应的工具类如BRepBuilderAPI_Transform应用到更复杂的几何形状上。 数据交换:gp_...
xAxis = gp_OX() # 定义镜像 aTrsf = gp_Trsf()# 定义一个矩阵变换 aTrsf.SetMirror(xAxis)#矩阵变换内容为 对x轴进行镜像 # 运用矩阵变换:镜像 aBRespTrsf = BRepBuilderAPI_Transform(aWire.Wire(), aTrsf) aMirroredShape = aBRespTrsf.Shape()#得到shape ...
gp_Dir(const gp_XYZ& Coord):通过gp_XYZ对象构造方向向量,并自动归一化为单位向量。 属性访问: Coord():返回方向向量的坐标值,即一个gp_XYZ对象。 X(), Y(), Z():分别获取方向向量在x、y、z轴上的分量。 变换与操作: 常常与其他类如gp_Trsf(变换类)结合使用,以实现对方向向量的变换。 Mirrored(cons...
trsf = gp_Trsf() trsf.SetTranslation(gp_Vec(x, y, z)) loc = TopLoc_Location(trsf) return loc cube = BRepPrimAPI_MakeBox(100, 100, 100).Shape() sphere = BRepPrimAPI_MakeSphere(100).Shape() sphere.Move(location_from_vector(500, 0, 0)) ...
aEdge3=BRepBuilderAPI_MakeEdge(aSegment2.Value())#通过edges 创建 wireaWire =BRepBuilderAPI_MakeWire(aEdge1.Edge(), aEdge2.Edge(), aEdge3.Edge())#得到X轴的便捷方式xAxis =gp_OX()#设置镜像轴aTrsf =gp_Trsf() aTrsf.SetMirror(xAxis)#应用镜像变换aBRespTrsf =BRepBuilderAPI_Transform(a...
xAxis= gp_OX() # 定义镜像 aTrsf = gp_Trsf()# 定义一个矩阵变换 aTrsf.SetMirror(xAxis) #矩阵变换内容为 对x轴进行镜像 # 运用矩阵变换:镜像 aBRespTrsf = BRepBuilderAPI_Transform(aWire.Wire(), aTrsf) aMirroredShape = aBRespTrsf.Shape()#得到shape aMirroredWire = topods.Wire( ...
see <http://www.gnu.org/licenses/>. importmath fromOCC.gpimportgp_Pnt,gp_OX,gp_Vec,gp_Trsf,gp_DZ,gp_Ax2,gp_Ax3,gp_Pnt2d,gp_Dir2d,gp_Ax2d fromOCC.GCimportGC_MakeArcOfCircle,GC_MakeSegment fromOCC.GCE2dimportGCE2d_MakeSegment fromOCC.GeomimportGeom_Plane,Geom_CylindricalSur...