add basic part design pipe infrastructure

This commit is contained in:
Stefan Tröger
2015-05-27 08:08:26 +02:00
parent 0f30096cec
commit e7803eca61
16 changed files with 1328 additions and 4 deletions

View File

@@ -54,6 +54,7 @@
#include "FeaturePrimitive.h"
#include "DatumCS.h"
#include "FeatureThickness.h"
#include "FeaturePipe.h"
namespace PartDesign {
extern PyObject* initModule();
@@ -101,6 +102,9 @@ PyMODINIT_FUNC init_PartDesign()
PartDesign::Chamfer ::init();
PartDesign::Draft ::init();
PartDesign::Thickness ::init();
PartDesign::Pipe ::init();
PartDesign::AdditivePipe ::init();
PartDesign::SubtractivePipe ::init();
PartDesign::Plane ::init();
PartDesign::Line ::init();
PartDesign::Point ::init();

View File

@@ -100,6 +100,8 @@ SET(FeaturesSketchBased_SRCS
FeatureBoolean.cpp
FeaturePrimitive.h
FeaturePrimitive.cpp
FeaturePipe.h
FeaturePipe.cpp
)
SOURCE_GROUP("SketchBasedFeatures" FILES ${FeaturesSketchBased_SRCS})

View File

@@ -0,0 +1,104 @@
/***************************************************************************
* Copyright (c) 2015 Stefan Tröger <stefantroeger@gmx.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 <BRep_Builder.hxx>
# include <BRep_Tool.hxx>
# include <BRepBndLib.hxx>
# include <BRepFeat_MakePrism.hxx>
# include <BRepBuilderAPI_MakeFace.hxx>
# include <Handle_Geom_Surface.hxx>
# include <TopoDS.hxx>
# include <TopoDS_Solid.hxx>
# include <TopoDS_Face.hxx>
# include <TopoDS_Wire.hxx>
# include <TopExp_Explorer.hxx>
# include <BRepAlgoAPI_Fuse.hxx>
# include <Precision.hxx>
# include <BRepPrimAPI_MakeHalfSpace.hxx>
# include <BRepAlgoAPI_Common.hxx>
# include <BRepAdaptor_Surface.hxx>
# include <gp_Pln.hxx>
# include <GeomAPI_ProjectPointOnSurf.hxx>
#endif
#include <Base/Exception.h>
#include <Base/Placement.h>
#include <Base/Console.h>
#include <Base/Reader.h>
#include <App/Document.h>
//#include "Body.h"
#include "FeaturePipe.h"
using namespace PartDesign;
const char* Pipe::TypeEnums[] = {"FullPath","UpToFace",NULL};
const char* Pipe::TransitionEnums[] = {"Transformed","Right corner", "Round corner",NULL};
const char* Pipe::ModeEnums[] = {"Standart", "Fixed", "Binormal", "Frenet", NULL};
PROPERTY_SOURCE(PartDesign::Pipe, PartDesign::SketchBased)
Pipe::Pipe()
{
ADD_PROPERTY_TYPE(Sections,(0),"Sweep",App::Prop_None,"List of sections");
Sections.setSize(0);
ADD_PROPERTY_TYPE(Spine,(0,0),"Sweep",App::Prop_None,"Path to sweep along");
ADD_PROPERTY_TYPE(Mode,(long(1)),"Sweep",App::Prop_None,"Profile mode");
ADD_PROPERTY_TYPE(Transition,(long(1)),"Sweep",App::Prop_None,"Transition mode");
Transition.setEnums(TransitionEnums);
}
short Pipe::mustExecute() const
{
if (Sections.isTouched())
return 1;
if (Spine.isTouched())
return 1;
if (Mode.isTouched())
return 1;
if (Transition.isTouched())
return 1;
return SketchBased::mustExecute();
}
App::DocumentObjectExecReturn *Pipe::execute(void)
{
return SketchBased::execute();
}
PROPERTY_SOURCE(PartDesign::AdditivePipe, PartDesign::Pipe)
AdditivePipe::AdditivePipe() {
addSubType = Additive;
}
PROPERTY_SOURCE(PartDesign::SubtractivePipe, PartDesign::Pipe)
SubtractivePipe::SubtractivePipe() {
addSubType = Subtractive;
}

View File

@@ -0,0 +1,76 @@
/***************************************************************************
* Copyright (c) 2015 Stefan Tröger <stefantroeger@gmx.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 *
* *
***************************************************************************/
#ifndef PARTDESIGN_Pipe_H
#define PARTDESIGN_Pipe_H
#include <App/PropertyStandard.h>
#include "FeatureSketchBased.h"
namespace PartDesign
{
class PartDesignExport Pipe : public SketchBased
{
PROPERTY_HEADER(PartDesign::Pad);
public:
Pipe();
App::PropertyLinkList Sections;
App::PropertyLinkSubList Spine;
App::PropertyEnumeration Mode;
App::PropertyEnumeration Transition;
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
const char* getViewProviderName(void) const {
return "PartDesignGui::ViewProviderPipe";
}
//@}
private:
static const char* TypeEnums[];
static const char* TransitionEnums[];
static const char* ModeEnums[];
};
class PartDesignExport AdditivePipe : public Pipe {
PROPERTY_HEADER(PartDesign::AdditivePipe);
public:
AdditivePipe();
};
class PartDesignExport SubtractivePipe : public Pipe {
PROPERTY_HEADER(PartDesign::SubtractivePipe);
public:
SubtractivePipe();
};
} //namespace PartDesign
#endif // PART_Pad_H