fix: Correct coordinate system for sketch plane geometry and rendering
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -65,14 +65,14 @@ void SketchFeature::buildShape()
|
||||
gp_Pnt other_corner1, other_corner2;
|
||||
|
||||
if (m_plane == SketchPlane::XY) {
|
||||
other_corner1.SetCoord(c1.X(), c2.Y(), c1.Z());
|
||||
other_corner2.SetCoord(c2.X(), c1.Y(), c1.Z());
|
||||
other_corner1.SetCoord(c2.X(), c1.Y(), c1.Z());
|
||||
other_corner2.SetCoord(c1.X(), c1.Y(), c2.Z());
|
||||
} else if (m_plane == SketchPlane::XZ) {
|
||||
other_corner1.SetCoord(c1.X(), c1.Y(), c2.Z());
|
||||
other_corner2.SetCoord(c2.X(), c1.Y(), c1.Z());
|
||||
} else { // YZ
|
||||
other_corner1.SetCoord(c1.X(), c1.Y(), c2.Z());
|
||||
other_corner1.SetCoord(c2.X(), c1.Y(), c1.Z());
|
||||
other_corner2.SetCoord(c1.X(), c2.Y(), c1.Z());
|
||||
} else { // YZ
|
||||
other_corner1.SetCoord(c1.X(), c2.Y(), c1.Z());
|
||||
other_corner2.SetCoord(c1.X(), c1.Y(), c2.Z());
|
||||
}
|
||||
|
||||
BRepBuilderAPI_MakeEdge me1(c1, other_corner1);
|
||||
@@ -93,8 +93,8 @@ void SketchFeature::buildShape()
|
||||
double radius = circle->radius();
|
||||
gp_Dir normal;
|
||||
switch (m_plane) {
|
||||
case SketchPlane::XY: normal = gp::DZ(); break;
|
||||
case SketchPlane::XZ: normal = gp::DY(); break;
|
||||
case SketchPlane::XY: normal = gp::DY(); break;
|
||||
case SketchPlane::XZ: normal = gp::DZ(); break;
|
||||
case SketchPlane::YZ: normal = gp::DX(); break;
|
||||
}
|
||||
gp_Ax2 axis(center, normal);
|
||||
|
||||
@@ -544,11 +544,11 @@ void ViewportWidget::drawSketch(const SketchFeature* sketch)
|
||||
switch (sketch->plane()) {
|
||||
case SketchFeature::SketchPlane::XY:
|
||||
u_axis = QVector3D(1, 0, 0);
|
||||
v_axis = QVector3D(0, 1, 0);
|
||||
v_axis = QVector3D(0, 0, 1);
|
||||
break;
|
||||
case SketchFeature::SketchPlane::XZ:
|
||||
u_axis = QVector3D(1, 0, 0);
|
||||
v_axis = QVector3D(0, 0, 1);
|
||||
v_axis = QVector3D(0, 1, 0);
|
||||
break;
|
||||
case SketchFeature::SketchPlane::YZ:
|
||||
u_axis = QVector3D(0, 1, 0);
|
||||
@@ -574,10 +574,10 @@ void ViewportWidget::drawSketch(const SketchFeature* sketch)
|
||||
gp_Pnt p2, p4;
|
||||
if (sketch->plane() == SketchFeature::SketchPlane::XY) {
|
||||
p2.SetCoord(p3.X(), p1.Y(), p1.Z());
|
||||
p4.SetCoord(p1.X(), p3.Y(), p1.Z());
|
||||
p4.SetCoord(p1.X(), p1.Y(), p3.Z());
|
||||
} else if (sketch->plane() == SketchFeature::SketchPlane::XZ) {
|
||||
p2.SetCoord(p3.X(), p1.Y(), p1.Z());
|
||||
p4.SetCoord(p1.X(), p1.Y(), p3.Z());
|
||||
p4.SetCoord(p1.X(), p3.Y(), p1.Z());
|
||||
} else if (sketch->plane() == SketchFeature::SketchPlane::YZ) {
|
||||
p2.SetCoord(p1.X(), p3.Y(), p1.Z());
|
||||
p4.SetCoord(p1.X(), p1.Y(), p3.Z());
|
||||
|
||||
Reference in New Issue
Block a user