Пример #1
0
 def test_write_step_ap203(self):
     write_step_file(A_TOPODS_SHAPE,
                     get_test_fullname("sample_ap_203.stp"),
                     application_protocol="AP203")
Пример #2
0
 def export_stp(self, shp):
     stpname = create_tempnum(self.rootname, self.tmpdir, ".stp")
     write_step_file(shp, stpname)
Пример #3
0
 def export_file(self):
     write_step_file(self.compound, self.tempname + ".stp")
Пример #4
0
    az = gp_XYZ(aZDir.X(), aZDir.Y(), aZDir.Z())
    p = gp_Pnt(aBaryCenter.X(), aBaryCenter.Y(), aBaryCenter.Z())
    anAxes = gp_Ax2(p, gp_Dir(aZDir), gp_Dir(aXDir))
    anAxes.SetLocation(
        gp_Pnt(p.XYZ() - ax * aHalfX - ay * aHalfY - az * aHalfZ))
    aBox = BRepPrimAPI_MakeBox(anAxes, 2.0 * aHalfX, 2.0 * aHalfY,
                               2.0 * aHalfZ).Shape()
    return aBox


obb = Bnd_OBB()

# choose n random vertices
n = 10
for _ in range(n):
    x = random.uniform(100, 1000)
    y = random.uniform(100, 1000)
    z = random.uniform(100, 1000)
    p = BRepBuilderAPI_MakeVertex(gp_Pnt(x, y, z)).Shape()
    display.DisplayShape(p)
    brepbndlib_AddOBB(p, obb)
obb_shape = ConvertBndToShape(obb)
display.DisplayShape(obb_shape)

# a ref box
b = BRepPrimAPI_MakeBox(10, 10, 10).Shape()
display.DisplayShape(b, update=True)
write_step_file(b, "./tmp/S_Bois.stp")

start_display()
 def test_write_step_ap242(self):
     write_step_file(A_TOPODS_SHAPE,
                     get_test_fullname("sample_242.stp"),
                     application_protocol="AP242DIS")
Пример #6
0
 def export_file(self):
     write_step_file(self.compound, "./tmp/ODE1.stp")
Пример #7
0
from OCC.Core.BOPAlgo import BOPAlgo_Splitter, BOPAlgo_MakerVolume, BOPAlgo_Builder
from OCC.Core.TopAbs import TopAbs_EDGE, TopAbs_SHAPE, TopAbs_SOLID
from OCC.Core.TopTools import TopTools_ListOfShape
from OCC.Core.TopExp import TopExp_Explorer
from OCC.Core.GProp import GProp_GProps
from OCC.Extend.DataExchange import write_step_file, write_stl_file
from OCCUtils.Topology import Topo
from OCCUtils.Construct import make_box, make_face
from OCCUtils.Construct import vec_to_dir

if __name__ == "__main__":
    num = 0
    box = make_box(100, 100, 100)

    stpname = "{}/shp_{:04d}.stp".format("./shp/", num)
    write_step_file(box, stpname)

    splitter = BOPAlgo_Splitter()
    splitter.AddArgument(box)

    for i in range(7):
        pnt = gp_Pnt(*np.random.rand(3) * 100)
        vec = gp_Vec(*np.random.randn(3))
        pln = gp_Pln(pnt, vec_to_dir(vec))
        fce = make_face(pln, -1000, 1000, -1000, 1000)
        splitter.AddTool(fce)

    splitter.Perform()
    #shp_list = splitter.Generated()

    exp = TopExp_Explorer(splitter.Shape(), TopAbs_SOLID)
Пример #8
0
 def __init__(self):
     plotocc.__init__(self)
     self.build_surf()
     write_step_file(self.bspl_face, self.tmpdir + "SurfUV.stp")
 def test_write_step_ap242(self):
     ap242_filename = get_test_fullname("sample_242.stp")
     write_step_file(A_TOPODS_SHAPE,
                     ap242_filename,
                     application_protocol="AP242DIS")
     self.assertTrue(os.path.isfile(ap242_filename))
Пример #10
0
 def export_file(self):
     builder = BRep_Builder()
     compound = TopoDS_Compound()
     builder.MakeCompound(compound)
     write_step_file(compound, "./tmp/ThruSurf.stp")