1 Star 0 Fork 2

张业军/cadviewer

forked from wwzggz/cadviewer 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
waysToMoveShape.txt 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
Ways to move a TopoDS_shape:
# TopLoc_Location
# as shown in
tFace = BRepBuilderAPI_MakeFace(mFace).Face()
faceNormal = Construct.face_normal(mFace)
vctr = gp_Vec(faceNormal).Multiplied(value)
trsf = gp_Trsf()
trsf.SetTranslation(vctr)
tFace.Move(TopLoc_Location(trsf))
# BRepBuilderAPI_Transform
# as shown in core_topology_boolean.py
def translate_topods_from_vector(brep_or_iterable, vec, copy=False):
'''
translate a brep over a vector
@param brep: the Topo_DS to translate
@param vec: the vector defining the translation
@param copy: copies to brep if True
'''
trns = gp_Trsf()
trns.SetTranslation(vec)
brep_trns = BRepBuilderAPI_Transform(brep_or_iterable, trns, copy)
brep_trns.Build()
return brep_trns.Shape()
# as shown in core_classic_occ_bottle.py
# Create a wire out of the edges
aWire = BRepBuilderAPI_MakeWire(aEdge1.Edge(), aEdge2.Edge(), aEdge3.Edge())
# Quick way to specify the X axis
xAxis = gp_OX()
# Set up the mirror
aTrsf = gp_Trsf()
aTrsf.SetMirror(xAxis)
# Apply the mirror transformation
aBRespTrsf = BRepBuilderAPI_Transform(aWire.Wire(), aTrsf)
# Get the mirrored shape back out of the transformation and convert back to a wire
aMirroredShape = aBRespTrsf.Shape()
# A wire instead of a generic shape now
aMirroredWire = topods.Wire(aMirroredShape)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhang-yejun/cadviewer.git
git@gitee.com:zhang-yejun/cadviewer.git
zhang-yejun
cadviewer
cadviewer
master

搜索帮助