Skip to content

Commit ad11321

Browse files
author
aninggo
committed
u
1 parent 5d0a03d commit ad11321

File tree

9 files changed

+22
-19
lines changed

9 files changed

+22
-19
lines changed

edge.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@ func (e *Edge) ParamAtPoint(pt Point3) float64 {
349349
return float64(C.topo_edge_param_at_point(e.inner.val, pt.val))
350350
}
351351

352+
func (s *Edge) Reverse() {
353+
C.topo_edge_reverse(s.inner.val)
354+
}
355+
352356
func (e *Edge) Params(pts []Point3, tol float64) []float64 {
353357
count := len(pts)
354358
cPoints := make([]C.pnt3d_t, count)

src/edge.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,8 @@ bool edge::is_closed() const {
795795

796796
bool edge::is_inifinite() const { return value().Infinite(); }
797797

798+
void edge::reverse() { value().Reverse(); }
799+
798800
bool edge::is_curve3d() const { return BRep_Tool::IsGeometric(value()); }
799801

800802
double edge::length() const {

src/edge.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ public:
295295

296296
void convert_to_curve3d();
297297

298+
void reverse();
299+
298300
virtual Handle(Adaptor3d_Curve) get_geom() const override;
299301

300302
virtual geometry_object_type type() const override {

src/primitives.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12916,7 +12916,7 @@ TopoDS_Shape create_cable_tunnel(const cable_tunnel_params &params) {
1291612916
// 创建隧道截面轮廓
1291712917
TopoDS_Wire sectionWire;
1291812918
switch (params.style) {
12919-
case tunnel_section_style::RECTANGULAR: {
12919+
case connection_section_style::RECTANGULAR: {
1292012920
// 矩形截面
1292112921
gp_Pnt p1(0, -params.width / 2, 0);
1292212922
gp_Pnt p2(0, params.width / 2, 0);
@@ -12925,7 +12925,7 @@ TopoDS_Shape create_cable_tunnel(const cable_tunnel_params &params) {
1292512925
sectionWire = BRepBuilderAPI_MakePolygon(p1, p2, p3, p4, true).Wire();
1292612926
break;
1292712927
}
12928-
case tunnel_section_style::HORSESHOE: {
12928+
case connection_section_style::HORSESHOE: {
1292912929
// 马蹄形截面
1293012930
double radius = params.width / 2;
1293112931
gp_Pnt center(0, 0, radius);
@@ -12949,7 +12949,7 @@ TopoDS_Shape create_cable_tunnel(const cable_tunnel_params &params) {
1294912949
sectionWire = wire;
1295012950
break;
1295112951
}
12952-
case tunnel_section_style::CIRCULAR: {
12952+
case connection_section_style::CIRCULAR: {
1295312953
// 圆形截面
1295412954
gp_Pnt center(0, 0, 0);
1295512955
Handle(Geom_Circle) circle =

src/primitives.hh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,16 +1794,9 @@ TopoDS_Shape create_cable_trench(const cable_trench_params &params,
17941794
const gp_Dir &direction = gp::DZ(),
17951795
const gp_Dir &xDir = gp::DX());
17961796

1797-
// 电缆隧道截面样式枚举
1798-
enum class tunnel_section_style {
1799-
RECTANGULAR = 1, // 矩形
1800-
HORSESHOE = 2, // 马蹄形
1801-
CIRCULAR = 3 // 圆形
1802-
};
1803-
18041797
// TD_DLSD
18051798
struct cable_tunnel_params {
1806-
tunnel_section_style style; // 截面样式
1799+
connection_section_style style; // 截面样式
18071800

18081801
// 基本尺寸参数
18091802
double width; // 内净宽/内径 W (mm)

src/primitives_c_api.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2505,7 +2505,7 @@ create_cable_trench_with_place(cable_trench_params_t params, pnt3d_t position,
25052505

25062506
PRIMCAPICALL topo_shape_t *create_cable_tunnel(cable_tunnel_params_t params) {
25072507
cable_tunnel_params cpp_params{
2508-
static_cast<tunnel_section_style>(params.style),
2508+
static_cast<connection_section_style>(params.style),
25092509
params.width,
25102510
params.height,
25112511
params.topThickness,
@@ -2535,7 +2535,7 @@ PRIMCAPICALL topo_shape_t *
25352535
create_cable_tunnel_with_place(cable_tunnel_params_t params, pnt3d_t position,
25362536
dir3d_t direction, dir3d_t xDir) {
25372537
cable_tunnel_params cpp_params{
2538-
static_cast<tunnel_section_style>(params.style),
2538+
static_cast<connection_section_style>(params.style),
25392539
params.width,
25402540
params.height,
25412541
params.topThickness,

src/primitives_c_api.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,12 +1482,6 @@ PRIMCAPICALL topo_shape_t *
14821482
create_four_way_well_with_place(four_way_well_params_t params, pnt3d_t position,
14831483
dir3d_t direction, dir3d_t xDirection);
14841484

1485-
enum {
1486-
TUNNEL_SECTION_RECTANGULAR = 1,
1487-
TUNNEL_SECTION_HORSESHOE = 2,
1488-
TUNNEL_SECTION_CIRCULAR = 3
1489-
};
1490-
14911485
typedef struct {
14921486
pnt3d_t position;
14931487
int ctype;

src/topo_c_api.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,13 @@ void topo_edge_convert_to_curve3d(topo_edge_t e) {
21382138
}
21392139
}
21402140

2141+
void topo_edge_reverse(topo_edge_t e) {
2142+
auto opt = cast_to_topo(e);
2143+
if (opt) {
2144+
return opt->reverse();
2145+
}
2146+
}
2147+
21412148
void topo_edge_bounds(topo_edge_t e, double *min, double *max) {
21422149
try {
21432150
auto bounds = cast_to_topo(e)->bounds();

src/topo_c_api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ TOPOCAPICALL double topo_edge_length(topo_edge_t e);
617617
TOPOCAPICALL float topo_edge_tolerance(topo_edge_t e);
618618
TOPOCAPICALL bool topo_edge_is_curve3d(topo_edge_t e);
619619
TOPOCAPICALL void topo_edge_convert_to_curve3d(topo_edge_t e);
620+
TOPOCAPICALL void topo_edge_reverse(topo_edge_t e);
620621

621622
TOPOCAPICALL void topo_edge_bounds(topo_edge_t e, double *min, double *max);
622623
TOPOCAPICALL double topo_edge_length(topo_edge_t e);

0 commit comments

Comments
 (0)