remove unneeded orig files

This commit is contained in:
Stefan Tröger
2016-04-12 19:10:19 +02:00
parent 4119bb7adc
commit 483e64f368
37 changed files with 0 additions and 20826 deletions

View File

@@ -1,118 +0,0 @@
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Python.h>
#endif
#include <Base/Console.h>
#include <Base/Interpreter.h>
#include "FeaturePad.h"
#include "FeatureSolid.h"
#include "FeaturePocket.h"
#include "FeatureFillet.h"
#include "FeatureSketchBased.h"
#include "FeatureRevolution.h"
#include "FeatureGroove.h"
#include "Body.h"
#include "FeatureDressUp.h"
#include "FeatureChamfer.h"
#include "FeatureDraft.h"
<<<<<<< c3c1399b7e8f8ceea8f3c1288ebfe0b6575f4d90
#include "FeatureSubtractive.h"
#include "FeatureAdditive.h"
=======
#include "FeatureFace.h"
>>>>>>> allow non-sketch based additive and subtractive features
#include "FeatureTransformed.h"
#include "FeatureMirrored.h"
#include "FeatureLinearPattern.h"
#include "FeaturePolarPattern.h"
#include "FeatureScaled.h"
#include "FeatureMultiTransform.h"
#include "FeatureHole.h"
#include "DatumPlane.h"
#include "DatumLine.h"
#include "DatumPoint.h"
#include "FeatureBoolean.h"
extern struct PyMethodDef PartDesign_methods[];
PyDoc_STRVAR(module_PartDesign_doc,
"This module is the PartDesign module.");
/* Python entry */
extern "C" {
void PartDesignExport init_PartDesign()
{
// load dependent module
try {
Base::Interpreter().runString("import Part");
Base::Interpreter().runString("import Sketcher");
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
return;
}
Py_InitModule3("_PartDesign", PartDesign_methods, module_PartDesign_doc); /* mod name, table ptr */
Base::Console().Log("Loading PartDesign module... done\n");
// NOTE: To finish the initialization of our own type objects we must
// call PyType_Ready, otherwise we run into a segmentation fault, later on.
// This function is responsible for adding inherited slots from a type's base class.
PartDesign::Feature ::init();
PartDesign::Solid ::init();
PartDesign::DressUp ::init();
PartDesign::FeatureAddSub ::init();
PartDesign::SketchBased ::init();
PartDesign::Transformed ::init();
PartDesign::Mirrored ::init();
PartDesign::LinearPattern ::init();
PartDesign::PolarPattern ::init();
PartDesign::Scaled ::init();
PartDesign::MultiTransform ::init();
PartDesign::Hole ::init();
PartDesign::Body ::init();
PartDesign::Pad ::init();
PartDesign::Pocket ::init();
PartDesign::Fillet ::init();
PartDesign::Revolution ::init();
PartDesign::Groove ::init();
PartDesign::Chamfer ::init();
PartDesign::Draft ::init();
PartDesign::Plane ::init();
PartDesign::Line ::init();
PartDesign::Point ::init();
PartDesign::Boolean ::init();
PartDesign::Point::initHints();
PartDesign::Line ::initHints();
PartDesign::Plane::initHints();
}
} // extern "C"

View File

@@ -1,153 +0,0 @@
/***************************************************************************
* Copyright (c) 2010 Juergen Riegel <FreeCAD@juergen-riegel.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <BRepFilletAPI_MakeChamfer.hxx>
# include <TopExp.hxx>
# include <TopExp_Explorer.hxx>
# include <TopoDS.hxx>
# include <TopoDS_Edge.hxx>
# include <TopTools_IndexedMapOfShape.hxx>
# include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#endif
<<<<<<< 50287516b47694e57429cc98f6d5596a06a635d6
#include <Base/Console.h>
#include <Base/Reader.h>
=======
#include <Base/Exception.h>
>>>>>>> Some code unification for DressUp features
#include <Mod/Part/App/TopoShape.h>
#include "FeatureChamfer.h"
using namespace PartDesign;
PROPERTY_SOURCE(PartDesign::Chamfer, PartDesign::DressUp)
const App::PropertyQuantityConstraint::Constraints floatSize = {0.0,FLT_MAX,0.1};
Chamfer::Chamfer()
{
ADD_PROPERTY(Size,(1.0));
Size.setUnit(Base::Unit::Length);
Size.setConstraints(&floatSize);
}
short Chamfer::mustExecute() const
{
if (Placement.isTouched() || Size.isTouched())
return 1;
return DressUp::mustExecute();
}
App::DocumentObjectExecReturn *Chamfer::execute(void)
{
// NOTE: Normally the Base property and the BaseFeature property should point to the same object.
// The only difference is that the Base property also stores the edges that are to be chamfered
Part::TopoShape TopShape;
try {
TopShape = getBaseShape();
} catch (Base::Exception& e) {
return new App::DocumentObjectExecReturn(e.what());
}
const std::vector<std::string>& SubVals = Base.getSubValuesStartsWith("Edge");
if (SubVals.size() == 0)
return new App::DocumentObjectExecReturn("No edges specified");
double size = Size.getValue();
this->positionByBaseFeature();
// create an untransformed copy of the basefeature shape
Part::TopoShape baseShape(TopShape);
baseShape.setTransform(Base::Matrix4D());
try {
BRepFilletAPI_MakeChamfer mkChamfer(baseShape._Shape);
TopTools_IndexedMapOfShape mapOfEdges;
TopTools_IndexedDataMapOfShapeListOfShape mapEdgeFace;
TopExp::MapShapesAndAncestors(baseShape._Shape, TopAbs_EDGE, TopAbs_FACE, mapEdgeFace);
TopExp::MapShapes(baseShape._Shape, TopAbs_EDGE, mapOfEdges);
for (std::vector<std::string>::const_iterator it=SubVals.begin(); it != SubVals.end(); ++it) {
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
const TopoDS_Face& face = TopoDS::Face(mapEdgeFace.FindFromKey(edge).First());
mkChamfer.Add(size, edge, face);
}
mkChamfer.Build();
if (!mkChamfer.IsDone())
return new App::DocumentObjectExecReturn("Failed to create chamfer");
TopoDS_Shape shape = mkChamfer.Shape();
if (shape.IsNull())
return new App::DocumentObjectExecReturn("Resulting shape is null");
this->Shape.setValue(shape);
return App::DocumentObject::StdReturn;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
return new App::DocumentObjectExecReturn(e->GetMessageString());
}
}
void Chamfer::Restore(Base::XMLReader &reader)
{
reader.readElement("Properties");
int Cnt = reader.getAttributeAsInteger("Count");
for (int i=0 ;i<Cnt ;i++) {
reader.readElement("Property");
const char* PropName = reader.getAttribute("name");
const char* TypeName = reader.getAttribute("type");
App::Property* prop = getPropertyByName(PropName);
try {
if (prop && strcmp(prop->getTypeId().getName(), TypeName) == 0) {
prop->Restore(reader);
}
else if (prop && strcmp(TypeName,"App::PropertyFloatConstraint") == 0 &&
strcmp(prop->getTypeId().getName(), "App::PropertyQuantityConstraint") == 0) {
App::PropertyFloatConstraint p;
p.Restore(reader);
static_cast<App::PropertyQuantityConstraint*>(prop)->setValue(p.getValue());
}
}
catch (const Base::XMLParseException&) {
throw; // re-throw
}
catch (const Base::Exception &e) {
Base::Console().Error("%s\n", e.what());
}
catch (const std::exception &e) {
Base::Console().Error("%s\n", e.what());
}
reader.readEndElement("Property");
}
reader.readEndElement("Properties");
}

View File

@@ -1,171 +0,0 @@
/***************************************************************************
* Copyright (c) 2010 Juergen Riegel <FreeCAD@juergen-riegel.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include "FeatureDressUp.h"
#include <Base/Exception.h>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS_Edge.hxx>
using namespace PartDesign;
namespace PartDesign {
PROPERTY_SOURCE(PartDesign::DressUp, PartDesign::Feature)
DressUp::DressUp()
{
ADD_PROPERTY(Base,(0));
Placement.StatusBits.set(2, true);
}
short DressUp::mustExecute() const
{
if (Base.getValue() && Base.getValue()->isTouched())
return 1;
return PartDesign::Feature::mustExecute();
}
void DressUp::positionByBaseFeature(void)
{
Part::Feature *base = static_cast<Part::Feature*>(BaseFeature.getValue());
if (base && base->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
this->Placement.setValue(base->Placement.getValue());
}
Part::TopoShape DressUp::getBaseShape()
{
App::DocumentObject* link = BaseFeature.getValue();
if (!link)
link = this->Base.getValue(); // For legacy features
if (!link)
throw Base::Exception("No object linked");
if (!link->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
throw Base::Exception("Linked object is not a Part object");
Part::Feature* base = static_cast<Part::Feature*>(link);
const Part::TopoShape& shape = base->Shape.getShape();
if (shape._Shape.IsNull())
throw Base::Exception("Cannot draft invalid shape");
return shape;
}
void DressUp::getContiniusEdges(Part::TopoShape TopShape, std::vector< std::string >& SubNames) {
TopTools_IndexedMapOfShape mapOfEdges;
TopTools_IndexedDataMapOfShapeListOfShape mapEdgeFace;
TopExp::MapShapesAndAncestors(TopShape._Shape, TopAbs_EDGE, TopAbs_FACE, mapEdgeFace);
TopExp::MapShapes(TopShape._Shape, TopAbs_EDGE, mapOfEdges);
unsigned int i = 0;
while(i < SubNames.size())
{
std::string aSubName = static_cast<std::string>(SubNames.at(i));
if (aSubName.size() > 4 && aSubName.substr(0,4) == "Edge") {
TopoDS_Edge edge = TopoDS::Edge(TopShape.getSubShape(aSubName.c_str()));
const TopTools_ListOfShape& los = mapEdgeFace.FindFromKey(edge);
if(los.Extent() != 2)
{
SubNames.erase(SubNames.begin()+i);
continue;
}
const TopoDS_Shape& face1 = los.First();
const TopoDS_Shape& face2 = los.Last();
GeomAbs_Shape cont = BRep_Tool::Continuity(TopoDS::Edge(edge),
TopoDS::Face(face1),
TopoDS::Face(face2));
if (cont != GeomAbs_C0) {
SubNames.erase(SubNames.begin()+i);
continue;
}
i++;
}
else if(aSubName.size() > 4 && aSubName.substr(0,4) == "Face") {
TopoDS_Face face = TopoDS::Face(TopShape.getSubShape(aSubName.c_str()));
TopTools_IndexedMapOfShape mapOfFaces;
TopExp::MapShapes(face, TopAbs_EDGE, mapOfFaces);
for(int j = 1; j <= mapOfFaces.Extent(); ++j) {
TopoDS_Edge edge = TopoDS::Edge(mapOfFaces.FindKey(j));
int id = mapOfEdges.FindIndex(edge);
std::stringstream buf;
buf << "Edge";
buf << id;
if(std::find(SubNames.begin(),SubNames.end(),buf.str()) == SubNames.end())
{
SubNames.push_back(buf.str());
}
}
SubNames.erase(SubNames.begin()+i);
}
// empty name or any other sub-element
else {
SubNames.erase(SubNames.begin()+i);
}
}
}
void DressUp::onChanged(const App::Property* prop)
{
// the BaseFeature property should always link to the same feature as the Base
if (prop == &BaseFeature) {
<<<<<<< 3108a1b6d1b9743ebed7c154a07a695bb7207a5d
// if attached to a sketch then mark it as read-only
this->Placement.setStatus(App::Property::ReadOnly, BaseFeature.getValue() != 0);
=======
if (Base.getValue() != BaseFeature.getValue()) {
Base.setValue (BaseFeature.getValue());
}
} else if (prop == &Base) {
// track the vice-versa changes
if (Base.getValue() != BaseFeature.getValue()) {
BaseFeature.setValue (Base.getValue());
}
>>>>>>> PartDesign/FeatureDressUp: make Base and BaseFeature properties track the same feature
}
Feature::onChanged(prop);
}
}

View File

@@ -1,155 +0,0 @@
/***************************************************************************
* Copyright (c) 2008 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <BRepAlgo.hxx>
# include <BRepFilletAPI_MakeFillet.hxx>
# include <TopExp_Explorer.hxx>
# include <TopoDS.hxx>
# include <TopoDS_Edge.hxx>
<<<<<<< 2c7cc8276bd6dd4ccc4aa28daa809a688bd493c5
# include <TopTools_ListOfShape.hxx>
=======
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
>>>>>>> allow to add faces to fillet and chamfer
#endif
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Base/Reader.h>
#include <Mod/Part/App/TopoShape.h>
#include "FeatureFillet.h"
using namespace PartDesign;
PROPERTY_SOURCE(PartDesign::Fillet, PartDesign::DressUp)
const App::PropertyQuantityConstraint::Constraints floatRadius = {0.0,FLT_MAX,0.1};
Fillet::Fillet()
{
ADD_PROPERTY(Radius,(1.0));
Radius.setUnit(Base::Unit::Length);
Radius.setConstraints(&floatRadius);
}
short Fillet::mustExecute() const
{
if (Placement.isTouched() || Radius.isTouched())
return 1;
return DressUp::mustExecute();
}
App::DocumentObjectExecReturn *Fillet::execute(void)
{
Part::TopoShape TopShape;
try {
TopShape = getBaseShape();
} catch (Base::Exception& e) {
return new App::DocumentObjectExecReturn(e.what());
}
std::vector<std::string> SubNames = std::vector<std::string>(Base.getSubValues());
getContiniusEdges(TopShape, SubNames);
if (SubNames.size() == 0)
return new App::DocumentObjectExecReturn("Fillet not possible on selected shapes");
double radius = Radius.getValue();
this->positionByBaseFeature();
// create an untransformed copy of the base shape
Part::TopoShape baseShape(TopShape);
baseShape.setTransform(Base::Matrix4D());
try {
BRepFilletAPI_MakeFillet mkFillet(baseShape._Shape);
for (std::vector<std::string>::const_iterator it=SubNames.begin(); it != SubNames.end(); ++it) {
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
mkFillet.Add(radius, edge);
}
mkFillet.Build();
if (!mkFillet.IsDone())
return new App::DocumentObjectExecReturn("Failed to create fillet");
TopoDS_Shape shape = mkFillet.Shape();
if (shape.IsNull())
return new App::DocumentObjectExecReturn("Resulting shape is null");
TopTools_ListOfShape aLarg;
aLarg.Append(baseShape._Shape);
if (!BRepAlgo::IsValid(aLarg, shape, Standard_False, Standard_False)) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
}
this->Shape.setValue(shape);
return App::DocumentObject::StdReturn;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
return new App::DocumentObjectExecReturn(e->GetMessageString());
}
}
void Fillet::Restore(Base::XMLReader &reader)
{
reader.readElement("Properties");
int Cnt = reader.getAttributeAsInteger("Count");
for (int i=0 ;i<Cnt ;i++) {
reader.readElement("Property");
const char* PropName = reader.getAttribute("name");
const char* TypeName = reader.getAttribute("type");
App::Property* prop = getPropertyByName(PropName);
try {
if (prop && strcmp(prop->getTypeId().getName(), TypeName) == 0) {
prop->Restore(reader);
}
else if (prop && strcmp(TypeName,"App::PropertyFloatConstraint") == 0 &&
strcmp(prop->getTypeId().getName(), "App::PropertyQuantityConstraint") == 0) {
App::PropertyFloatConstraint p;
p.Restore(reader);
static_cast<App::PropertyQuantityConstraint*>(prop)->setValue(p.getValue());
}
}
catch (const Base::XMLParseException&) {
throw; // re-throw
}
catch (const Base::Exception &e) {
Base::Console().Error("%s\n", e.what());
}
catch (const std::exception &e) {
Base::Console().Error("%s\n", e.what());
}
reader.readEndElement("Property");
}
reader.readEndElement("Properties");
}