def test_cone_beam(self): s_o = [(375.0, 375.0, 375.0), (375.0, -375.0, 375.0), (-375.0, -375.0, 375.0), (-375.0, 375.0, 375.0)] s_i = [(325.0, 325.0, 325.0), (-325.0, 325.0, 325.0), (-325.0, -325.0, 325.0), (325.0, -325.0, 325.0)] e_o = [(525.0, 525.0, 525.0), (525.0, -525.0, 525.0), (-525.0, -525.0, 525.0), (-525.0, 525.0, 525.0)] e_i = [(475.0, 475.0, 475.0), (-475.0, 475.0, 475.0), (-475.0, -475.0, 475.0), (475.0, -475.0, 475.0)] poly_s_o = CurvePoly(s_o, (0, 0, 0), (0, 0, 1), (1, 0, 0)) poly_s_i = CurvePoly(s_i, (0, 0, 0), (0, 0, 1), (1, 0, 0)) section_s = Section('MyStartCrossSection', "poly", outer_poly=poly_s_o, inner_poly=poly_s_i, units="mm") poly_e_o = CurvePoly(e_o, (0, 0, 0), (0, 0, 1), (1, 0, 0)) poly_e_i = CurvePoly(e_i, (0, 0, 0), (0, 0, 1), (1, 0, 0)) section_e = Section('MyEndCrossSection', "poly", outer_poly=poly_e_o, inner_poly=poly_e_i, units="mm") bm = Beam('MyCone', (2, 2, 2), (4, 4, 4), sec=section_s, tap=section_e) a = Assembly( 'Level1', project='Project0', creator='krande', units='mm') / (Part('Level2') / bm) a.to_ifc(test_folder / 'cone_ex.ifc')
def test_cone_beam(): s_o = [(375.0, 375.0, 375.0), (375.0, -375.0, 375.0), (-375.0, -375.0, 375.0), (-375.0, 375.0, 375.0)] s_i = [(325.0, 325.0, 325.0), (-325.0, 325.0, 325.0), (-325.0, -325.0, 325.0), (325.0, -325.0, 325.0)] e_o = [(525.0, 525.0, 525.0), (525.0, -525.0, 525.0), (-525.0, -525.0, 525.0), (-525.0, 525.0, 525.0)] e_i = [(475.0, 475.0, 475.0), (-475.0, 475.0, 475.0), (-475.0, -475.0, 475.0), (475.0, -475.0, 475.0)] poly_s_o = CurvePoly(s_o, (0, 0, 0), (0, 0, 1), (1, 0, 0)) poly_s_i = CurvePoly(s_i, (0, 0, 0), (0, 0, 1), (1, 0, 0)) section_s = Section("MyStartCrossSection", "poly", outer_poly=poly_s_o, inner_poly=poly_s_i, units="mm") poly_e_o = CurvePoly(e_o, (0, 0, 0), (0, 0, 1), (1, 0, 0)) poly_e_i = CurvePoly(e_i, (0, 0, 0), (0, 0, 1), (1, 0, 0)) section_e = Section("MyEndCrossSection", "poly", outer_poly=poly_e_o, inner_poly=poly_e_i, units="mm") bm = Beam("MyCone", (2, 2, 2), (4, 4, 4), sec=section_s, tap=section_e) a = Assembly("Level1", project="Project0", units="mm") / (Part("Level2") / bm) _ = a.to_ifc(test_dir / "cone_ex.ifc", return_file_obj=True)
def build_geom(self): normal = self._lz origin = self.origin - self._lz * self.depth points = [(0, 0), (self.width, 0), (self.width, self.height), (0, self.height)] poly = CurvePoly(points2d=points, origin=origin, normal=normal, xdir=self._lx, parent=self) geom = poly.make_extruded_solid(self.depth) self.add_shape(Shape(self.name, geom, metadata=self.metadata))
def get_bm_section_curve(bm: "Beam", origin=None) -> CurvePoly: origin = origin if origin is not None else bm.n1.p section_profile = bm.section.get_section_profile(True) points2d = section_profile.outer_curve.points2d return CurvePoly(points2d=points2d, origin=origin, xdir=bm.yvec, normal=bm.xvec, parent=bm.parent)
def test_advanced_beam(self): poly = CurvePoly([(0, 0), (0.1, 0, 0.01), (0.1, 0.1, 0.01), (0, 0.1)], (0, 0, 0), (1, 0, 0), (0, 1, 0)) bm = Beam("MyBeam", (0, 0, 0), (1, 0, 0), Section("MySec", outer_poly=poly)) bm.to_stp(test_folder / "MySimpleBeamPoly.stp")
def test_sweep_curve(): sweep_curve = [(1, 1, 0), (5, 5.0, 0.0, 1), (10, 1, 0)] curve = CurvePoly(points3d=sweep_curve, is_closed=False) my_renderer = x3dom_renderer.X3DomRenderer() my_renderer.DisplayShape(curve.wire, export_edges=True)
def test_sweep_curve(self): curve = CurvePoly(points3d=sweep_curve, is_closed=False) my_renderer = x3dom_renderer.X3DomRenderer() my_renderer.DisplayShape(curve.wire, export_edges=True)