00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "PreCompiled.h"
00013 #ifndef _PreComp_
00014 # include <Python.h>
00015 # include <Interface_Static.hxx>
00016 #endif
00017
00018 #include <Base/Console.h>
00019 #include <Base/Interpreter.h>
00020 #include <Base/Parameter.h>
00021
00022 #include <App/Application.h>
00023
00024 #include "TopoShape.h"
00025 #include "FeaturePartBox.h"
00026 #include "FeaturePartBoolean.h"
00027 #include "FeaturePartCommon.h"
00028 #include "FeaturePartCut.h"
00029 #include "FeaturePartFuse.h"
00030 #include "FeaturePartSection.h"
00031 #include "FeaturePartImportStep.h"
00032 #include "FeaturePartImportIges.h"
00033 #include "FeaturePartImportBrep.h"
00034 #include "FeaturePartCurveNet.h"
00035 #include "FeaturePartCircle.h"
00036 #include "FeaturePartPolygon.h"
00037 #include "FeatureGeometrySet.h"
00038 #include "FeatureChamfer.h"
00039 #include "FeatureExtrusion.h"
00040 #include "FeatureFillet.h"
00041 #include "FeatureMirroring.h"
00042 #include "FeatureRevolution.h"
00043 #include "PartFeatures.h"
00044 #include "PrimitiveFeature.h"
00045 #include "Part2DObject.h"
00046 #include "CustomFeature.h"
00047 #include "TopoShapePy.h"
00048 #include "TopoShapeVertexPy.h"
00049 #include "TopoShapeFacePy.h"
00050 #include "TopoShapeWirePy.h"
00051 #include "TopoShapeEdgePy.h"
00052 #include "TopoShapeSolidPy.h"
00053 #include "TopoShapeCompoundPy.h"
00054 #include "TopoShapeCompSolidPy.h"
00055 #include "TopoShapeShellPy.h"
00056 #include "LinePy.h"
00057 #include "CirclePy.h"
00058 #include "EllipsePy.h"
00059 #include "ArcPy.h"
00060 #include "ArcOfCirclePy.h"
00061 #include "BezierCurvePy.h"
00062 #include "BSplineCurvePy.h"
00063 #include "HyperbolaPy.h"
00064 #include "OffsetCurvePy.h"
00065 #include "ParabolaPy.h"
00066 #include "BezierSurfacePy.h"
00067 #include "BSplineSurfacePy.h"
00068 #include "ConePy.h"
00069 #include "CylinderPy.h"
00070 #include "OffsetSurfacePy.h"
00071 #include "PlanePy.h"
00072 #include "RectangularTrimmedSurfacePy.h"
00073 #include "SpherePy.h"
00074 #include "SurfaceOfExtrusionPy.h"
00075 #include "SurfaceOfRevolutionPy.h"
00076 #include "ToroidPy.h"
00077 #include "PartFeaturePy.h"
00078 #include "PropertyGeometryList.h"
00079
00080 extern struct PyMethodDef Part_methods[];
00081
00082 PyDoc_STRVAR(module_part_doc,
00083 "This is a module working with shapes.");
00084
00085 extern "C" {
00086 void PartExport initPart()
00087 {
00088 PyObject* partModule = Py_InitModule3("Part", Part_methods, module_part_doc);
00089 Base::Console().Log("Loading Part module... done\n");
00090
00091
00092 Base::Interpreter().addType(&Part::TopoShapePy ::Type,partModule,"Shape");
00093 Base::Interpreter().addType(&Part::TopoShapeVertexPy ::Type,partModule,"Vertex");
00094 Base::Interpreter().addType(&Part::TopoShapeWirePy ::Type,partModule,"Wire");
00095 Base::Interpreter().addType(&Part::TopoShapeEdgePy ::Type,partModule,"Edge");
00096 Base::Interpreter().addType(&Part::TopoShapeSolidPy ::Type,partModule,"Solid");
00097 Base::Interpreter().addType(&Part::TopoShapeFacePy ::Type,partModule,"Face");
00098 Base::Interpreter().addType(&Part::TopoShapeCompoundPy ::Type,partModule,"Compound");
00099 Base::Interpreter().addType(&Part::TopoShapeCompSolidPy ::Type,partModule,"CompSolid");
00100 Base::Interpreter().addType(&Part::TopoShapeShellPy ::Type,partModule,"Shell");
00101
00102 Base::Interpreter().addType(&Part::LinePy ::Type,partModule,"Line");
00103 Base::Interpreter().addType(&Part::CirclePy ::Type,partModule,"Circle");
00104 Base::Interpreter().addType(&Part::EllipsePy ::Type,partModule,"Ellipse");
00105 Base::Interpreter().addType(&Part::HyperbolaPy ::Type,partModule,"Hyperbola");
00106 Base::Interpreter().addType(&Part::ParabolaPy ::Type,partModule,"Parabola");
00107 Base::Interpreter().addType(&Part::ArcPy ::Type,partModule,"Arc");
00108 Base::Interpreter().addType(&Part::ArcOfCirclePy ::Type,partModule,"ArcOfCircle");
00109 Base::Interpreter().addType(&Part::BezierCurvePy ::Type,partModule,"BezierCurve");
00110 Base::Interpreter().addType(&Part::BSplineCurvePy ::Type,partModule,"BSplineCurve");
00111 Base::Interpreter().addType(&Part::OffsetCurvePy ::Type,partModule,"OffsetCurve");
00112
00113 Base::Interpreter().addType(&Part::PlanePy ::Type,partModule,"Plane");
00114 Base::Interpreter().addType(&Part::CylinderPy ::Type,partModule,"Cylinder");
00115 Base::Interpreter().addType(&Part::ConePy ::Type,partModule,"Cone");
00116 Base::Interpreter().addType(&Part::SpherePy ::Type,partModule,"Sphere");
00117 Base::Interpreter().addType(&Part::ToroidPy ::Type,partModule,"Toroid");
00118 Base::Interpreter().addType(&Part::BezierSurfacePy ::Type,partModule,"BezierSurface");
00119 Base::Interpreter().addType(&Part::BSplineSurfacePy ::Type,partModule,"BSplineSurface");
00120 Base::Interpreter().addType(&Part::OffsetSurfacePy ::Type,partModule,"OffsetSurface");
00121 Base::Interpreter().addType(&Part::SurfaceOfExtrusionPy ::Type,partModule,"SurfaceOfExtrusion");
00122 Base::Interpreter().addType(&Part::SurfaceOfRevolutionPy::Type,partModule,"SurfaceOfRevolution");
00123 Base::Interpreter().addType(&Part::RectangularTrimmedSurfacePy
00124 ::Type,partModule,"RectangularTrimmedSurface");
00125
00126 Base::Interpreter().addType(&Part::PartFeaturePy ::Type,partModule,"Feature");
00127
00128 Part::TopoShape ::init();
00129 Part::PropertyPartShape ::init();
00130 Part::PropertyGeometryList ::init();
00131 Part::PropertyFilletEdges ::init();
00132
00133 Part::Feature ::init();
00134 Part::FeatureExt ::init();
00135 Part::FeaturePython ::init();
00136 Part::FeatureGeometrySet ::init();
00137 Part::CustomFeature ::init();
00138 Part::CustomFeaturePython ::init();
00139 Part::Primitive ::init();
00140 Part::Box ::init();
00141 Part::Boolean ::init();
00142 Part::Common ::init();
00143 Part::MultiCommon ::init();
00144 Part::Cut ::init();
00145 Part::Fuse ::init();
00146 Part::MultiFuse ::init();
00147 Part::Section ::init();
00148 Part::Chamfer ::init();
00149 Part::Extrusion ::init();
00150 Part::Fillet ::init();
00151 Part::Revolution ::init();
00152 Part::Mirroring ::init();
00153 Part::ImportStep ::init();
00154 Part::ImportIges ::init();
00155 Part::ImportBrep ::init();
00156 Part::CurveNet ::init();
00157 Part::Polygon ::init();
00158 Part::Circle ::init();
00159 Part::Vertex ::init();
00160 Part::Ellipsoid ::init();
00161 Part::Plane ::init();
00162 Part::Sphere ::init();
00163 Part::Cylinder ::init();
00164 Part::Cone ::init();
00165 Part::Torus ::init();
00166 Part::Helix ::init();
00167 Part::Wedge ::init();
00168 Part::Part2DObject ::init();
00169 Part::Part2DObjectPython ::init();
00170 Part::RuledSurface ::init();
00171 Part::Loft ::init();
00172
00173
00174 Part::Geometry ::init();
00175 Part::GeomPoint ::init();
00176 Part::GeomCurve ::init();
00177 Part::GeomBezierCurve ::init();
00178 Part::GeomBSplineCurve ::init();
00179 Part::GeomCircle ::init();
00180 Part::GeomArcOfCircle ::init();
00181 Part::GeomEllipse ::init();
00182 Part::GeomHyperbola ::init();
00183 Part::GeomParabola ::init();
00184 Part::GeomLine ::init();
00185 Part::GeomLineSegment ::init();
00186 Part::GeomOffsetCurve ::init();
00187 Part::GeomTrimmedCurve ::init();
00188 Part::GeomSurface ::init();
00189 Part::GeomBezierSurface ::init();
00190 Part::GeomBSplineSurface ::init();
00191 Part::GeomCylinder ::init();
00192 Part::GeomCone ::init();
00193 Part::GeomSphere ::init();
00194 Part::GeomToroid ::init();
00195 Part::GeomPlane ::init();
00196 Part::GeomOffsetSurface ::init();
00197 Part::GeomTrimmedSurface ::init();
00198 Part::GeomSurfaceOfRevolution ::init();
00199 Part::GeomSurfaceOfExtrusion ::init();
00200
00201
00202
00203 Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
00204 .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
00205 int unit = hGrp->GetInt("Unit", 0);
00206 switch (unit) {
00207 case 1:
00208 Interface_Static::SetCVal("write.iges.unit","M");
00209 Interface_Static::SetCVal("write.step.unit","M");
00210 break;
00211 case 2:
00212 Interface_Static::SetCVal("write.iges.unit","IN");
00213 Interface_Static::SetCVal("write.step.unit","IN");
00214 break;
00215 default:
00216 Interface_Static::SetCVal("write.iges.unit","MM");
00217 Interface_Static::SetCVal("write.step.unit","MM");
00218 break;
00219 }
00220 }
00221
00222 }