Skip to content

Commit

Permalink
Merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davesrocketshop committed Mar 16, 2024
1 parent e950dea commit 73161b2
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 81 deletions.
2 changes: 1 addition & 1 deletion src/App/GeoFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ class AppExport GeoFeature: public App::DocumentObject
* @return Base::Placement The transformation from the global reference coordinate system
*/
Base::Placement globalPlacement() const;
const Data::MappedElement& mapped) const;
/**
* @brief Virtual function to get an App::Material object describing the appearance
*
Expand Down Expand Up @@ -168,6 +167,7 @@ class AppExport GeoFeature: public App::DocumentObject

protected:
std::pair<std::string, std::string> _getElementName(const char* name,
const Data::MappedElement& mapped) const;
};

} // namespace App
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Material/App/Materials.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class MaterialsExport MaterialProperty: public ModelProperty
std::shared_ptr<MaterialValue> getMaterialValue() const;
QString getString() const;
QString getYAMLString() const;
QString getDictionaryString() const; // Non-localized string
bool getBoolean() const
{
return getValue().toBool();
Expand Down
137 changes: 57 additions & 80 deletions src/Mod/Part/Gui/DlgProjectionOnSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,19 +935,18 @@ void PartGui::DlgProjectionOnSurface::create_face_extrude(std::vector<SShapeStor

auto height = ui->doubleSpinBoxExtrudeHeight->value();

for (auto& itCurrentShape : iCurrentShape) {
if (itCurrentShape.aProjectedFace.IsNull()) {
continue;
};
if (itCurrentShape.extrudeValue == height) {
continue;
};
for ( auto &itCurrentShape : iCurrentShape )
{
if (itCurrentShape.aProjectedFace.IsNull()) continue;;
if (itCurrentShape.extrudeValue == height) continue;;

itCurrentShape.extrudeValue = height;
if (height == 0) {
if (height == 0)
{
itCurrentShape.aProjectedSolid.Nullify();
}
else {
else
{
gp_Vec directionToExtrude(itCurrentShape.aProjectionDir.XYZ());
directionToExtrude.Reverse();
directionToExtrude.Multiply(height);
Expand All @@ -968,78 +967,56 @@ void PartGui::DlgProjectionOnSurface::store_wire_in_vector(const SShapeStore& iC
std::vector<SShapeStore>& iStoreVec,
const unsigned int iColor)
{
if (m_currentSelection != "add_wire") {
return;
}
if (iParentShape.IsNull()) {
return;
}
if (iCurrentShape.inputShape.IsNull()) {
return;
}
auto currentType = iCurrentShape.inputShape.ShapeType();
if (currentType != TopAbs_EDGE) {
return;
}
}

std::vector<TopoDS_Wire> aWireVec;
for (TopExp_Explorer aExplorer(iParentShape, TopAbs_WIRE); aExplorer.More(); aExplorer.Next()) {
aWireVec.push_back(TopoDS::Wire(aExplorer.Current()));
}
else {
m_currentSelection = "";
enable_ui_elements(m_guiObjectVec, nullptr);
Gui::Selection().rmvSelectionGate();
filterFace = nullptr;
}
}
void PartGui::DlgProjectionOnSurface::onRadioButtonShowAllClicked()
{
m_currentShowType = "all";
show_projected_shapes(m_shapeVec);
}

std::vector<TopoDS_Edge> edgeVec;
for (const auto& it : aWireVec) {
bool edgeExists = false;
for (TopExp_Explorer aExplorer(it, TopAbs_EDGE); aExplorer.More(); aExplorer.Next()) {
auto currentEdge = TopoDS::Edge(aExplorer.Current());
edgeVec.push_back(currentEdge);
if (currentEdge.IsSame(iCurrentShape.inputShape)) {
edgeExists = true;
}
}
if (edgeExists) {
break;
}
edgeVec.clear();
}

if (edgeVec.empty()) {
return;
}
TopTools_IndexedMapOfShape indexMap;
TopExp::MapShapes(iParentShape, TopAbs_EDGE, indexMap);
if (indexMap.IsEmpty()) {
if (m_currentSelection != "add_wire")
return;
if (iParentShape.IsNull())
return;
if (iCurrentShape.inputShape.IsNull())
return;
auto currentType = iCurrentShape.inputShape.ShapeType();
if (currentType != TopAbs_EDGE)
return;

std::vector<TopoDS_Wire> aWireVec;
for (TopExp_Explorer aExplorer(iParentShape, TopAbs_WIRE); aExplorer.More(); aExplorer.Next())
{
aWireVec.push_back(TopoDS::Wire(aExplorer.Current()));
}

std::vector<TopoDS_Edge> edgeVec;
for (const auto& it : aWireVec )
{
bool edgeExists = false;
for (TopExp_Explorer aExplorer(it, TopAbs_EDGE); aExplorer.More(); aExplorer.Next())
{
auto currentEdge = TopoDS::Edge(aExplorer.Current());
edgeVec.push_back(currentEdge);
if (currentEdge.IsSame(iCurrentShape.inputShape)) edgeExists = true;
}
if (edgeExists) break;
edgeVec.clear();
}

if (edgeVec.empty())
return;
TopTools_IndexedMapOfShape indexMap;
TopExp::MapShapes(iParentShape, TopAbs_EDGE, indexMap);
if (indexMap.IsEmpty())
return;

for (const auto& it : edgeVec )
{
if ( it.IsSame(iCurrentShape.inputShape)) continue;
if (!indexMap.Contains(it))
return;
}

for (const auto& it : edgeVec) {
if (it.IsSame(iCurrentShape.inputShape)) {
continue;
}
if (!indexMap.Contains(it)) {
return;
}
auto index = indexMap.FindIndex(it);
auto newEdgeObject = iCurrentShape;
newEdgeObject.inputShape = it;
newEdgeObject.partName = "Edge" + std::to_string(index);

auto store = store_part_in_vector(newEdgeObject, iStoreVec);
higlight_object(newEdgeObject.partFeature, newEdgeObject.partName, store, iColor);
}
auto index = indexMap.FindIndex(it);
auto newEdgeObject = iCurrentShape;
newEdgeObject.inputShape = it;
newEdgeObject.partName = "Edge" + std::to_string(index);

auto store = store_part_in_vector(newEdgeObject, iStoreVec);
higlight_object(newEdgeObject.partFeature, newEdgeObject.partName, store, iColor);
}
}

void PartGui::DlgProjectionOnSurface::set_xyz_dir_spinbox(QDoubleSpinBox* icurrentSpinBox)
Expand Down

0 comments on commit 73161b2

Please sign in to comment.