DiscussionsIssue archiveVisualization and 3D Viewer

Archived discussion

HOW TO SHOW A BOUND BOX OF A SHAPE?

Visualization and 3D ViewerTue, 11/19/2019 - 05:204 replies

Browse this forum
QuestionAuthor

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

谢谢。

Discussion

4 archived replies

Posts are displayed in their archived order.

01Commenter-1

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

02Author

谢谢。 

03Commenter-2

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
04Author

Thank you.