HOW TO SHOW A BOUND BOX OF A SHAPE?

您好,我想问一下Bnd _Box 的边界框是否可以显示在视图中?如何显示?

谢谢。

liuhuiwei's picture

the code from my app's lua interface,first build the bndbox wire shape,the add the shape two your shape renderer

function MakeBndShape(xmin,ymin,zmin,xmax,ymax,zmax)

P1=OCC.gp_Pnt(xmin,ymin,zmin)
P2=OCC.gp_Pnt(xmax,ymin,zmin)
P3=OCC.gp_Pnt(xmax,ymax,zmin)
P4=OCC.gp_Pnt(xmin,ymax,zmin)
P5=OCC.gp_Pnt(xmin,ymin,zmax)
P6=OCC.gp_Pnt(xmax,ymin,zmax)
P7=OCC.gp_Pnt(xmax,ymax,zmax)
P8=OCC.gp_Pnt(xmin,ymax,zmax)

bottom=OCC.BRepBuilderAPI_MakePolygon(P1,P2,P3,P4,true):Shape()
top=OCC.BRepBuilderAPI_MakePolygon(P5,P6,P7,P8,true):Shape()
e1=OCC.BRepBuilderAPI_MakeEdge(P1,P5):Shape()
e2=OCC.BRepBuilderAPI_MakeEdge(P2,P6):Shape()
e3=OCC.BRepBuilderAPI_MakeEdge(P3,P7):Shape()
e4=OCC.BRepBuilderAPI_MakeEdge(P4,P8):Shape()

wire=OCC.TopoDS_Compound()
builder=OCC.TopoDS_Builder()
builder:MakeCompound(wire)
builder:Add(wire,bottom)
builder:Add(wire,top)
builder:Add(wire,e1)
builder:Add(wire,e2)
builder:Add(wire,e3)
builder:Add(wire,e4)
return wire

end

179108731_135316's picture

谢谢。 

Kirill Gavrilov's picture

In Draw Harness, commands bounding and vbounding are intended to display bounding box of shape or presentation.
bounding command can also print AABB and OBB values.

pload MODELING VISUALIZATION
psphere s 1

# 3D Viewer
vclear
vinit View1
vdisplay -dispMode 1 s
vfit
vbounding s

# axo viewer
axo
bounding s
fit
179108731_135316's picture

Thank you.