Add Assembly App objects and some python bindings

Make Part working
This commit is contained in:
jriegel 2012-01-03 01:21:45 +01:00 committed by Stefan Tröger
parent 95c9259765
commit a224d93d8c
32 changed files with 1437 additions and 9 deletions

View File

@ -39,12 +39,12 @@ PyDoc_STRVAR(module_Assembly_doc,
/* Python entry */
extern "C" {
void AppAssemblyExport initAssembly()
void AssemblyExport initAssembly()
{
// load dependend module
try {
Base::Interpreter().loadModule("Part");
Base::Interpreter().loadModule("PartDesign");
Base::Interpreter().runString("import Part");
//Base::Interpreter().runString("import PartDesign");
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());

View File

@ -1,25 +1,78 @@
include_directories(
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}
${Boost_INCLUDE_DIRS}
${OCC_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
${XercesC_INCLUDE_DIRS}
# ${ODE_INCLUDE_DIRS}
${ODE_INCLUDE_DIRS}
)
set(Assembly_LIBS
# ${ODE_LIBRARIES}
${ODE_LIBRARIES}
${OCC_LIBRARIES}
Part
FreeCADApp
)
SET(Assembly_SRCS
generate_from_xml(ItemPy)
generate_from_xml(ItemAssemblyPy)
generate_from_xml(ItemPartPy)
generate_from_xml(ConstraintGroupPy)
SET(Features_SRCS
Item.cpp
Item.h
ItemPart.cpp
ItemPart.h
ItemAssembly.cpp
ItemAssembly.h
Constraint.cpp
Constraint.h
ConstraintGroup.cpp
ConstraintGroup.h
ConstraintAngle.cpp
ConstraintAngle.h
ConstraintAxis.cpp
ConstraintAxis.h
ConstraintContact.cpp
ConstraintContact.h
ConstraintFix.cpp
ConstraintFix.h
ConstraintOffset.cpp
ConstraintOffset.h
)
SOURCE_GROUP("Features" FILES ${Features_SRCS})
SET(Module_SRCS
AppAssembly.cpp
AppAssemblyPy.cpp
PreCompiled.cpp
PreCompiled.h
)
SOURCE_GROUP("Module" FILES ${Module_SRCS})
SET(Python_SRCS
ItemPy.xml
ItemPyImp.cpp
ItemAssemblyPy.xml
ItemAssemblyPyImp.cpp
ItemPartPy.xml
ItemPartPyImp.cpp
ConstraintGroupPy.xml
ConstraintGroupPyImp.cpp
)
SOURCE_GROUP("Python" FILES ${Python_SRCS})
SET(Assembly_SRCS
${Features_SRCS}
${Python_SRCS}
${Module_SRCS}
)
add_library(Assembly SHARED ${Assembly_SRCS})
target_link_libraries(Assembly ${Assembly_LIBS})

View File

@ -0,0 +1,60 @@
/***************************************************************************
* Copyright (c) 2012 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 <Base/Placement.h>
#include "Constraint.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::Constraint, App::DocumentObject)
Constraint::Constraint()
{
ADD_PROPERTY(First, (0));
ADD_PROPERTY(Second,(0));
}
short Constraint::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *Constraint::execute(void)
{
return App::DocumentObject::StdReturn;
}
}

View File

@ -0,0 +1,59 @@
/***************************************************************************
* Copyright (c) 2012 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 *
* *
***************************************************************************/
#ifndef Assembly_Constraint_H
#define Assembly_Constraint_H
#include <App/PropertyLinks.h>
#include <App/DocumentObject.h>
namespace Assembly
{
class AssemblyExport Constraint : public App::DocumentObject
{
PROPERTY_HEADER(Assembly::Constraint);
public:
Constraint();
App::PropertyLinkSub First;
App::PropertyLinkSub Second;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "PartDesignGui::ViewProviderConstraint";
//}
//@}
};
} //namespace Assembly
#endif // Assembly_Constraint_H

View File

@ -0,0 +1,59 @@
/***************************************************************************
* 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 <Base/Placement.h>
#include "ConstraintAngle.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintAngle, Assembly::Constraint)
ConstraintAngle::ConstraintAngle()
{
ADD_PROPERTY(Angle,(0));
}
short ConstraintAngle::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ConstraintAngle::execute(void)
{
return App::DocumentObject::StdReturn;
}
}

View File

@ -0,0 +1,58 @@
/***************************************************************************
* 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 *
* *
***************************************************************************/
#ifndef Assembly_ConstraintAngle_H
#define Assembly_ConstraintAngle_H
#include <App/PropertyStandard.h>
#include "Constraint.h"
namespace Assembly
{
class AssemblyExport ConstraintAngle : public Assembly::Constraint
{
PROPERTY_HEADER(Assembly::ConstraintAngle);
public:
ConstraintAngle();
App::PropertyFloat Angle;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "PartDesignGui::ViewProviderConstraintAngle";
//}
//@}
};
} //namespace Assembly
#endif // Assembly_ConstraintAngle_H

View File

@ -0,0 +1,59 @@
/***************************************************************************
* Copyright (c) 2012 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 <Base/Placement.h>
#include "ConstraintAxis.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintAxis, Assembly::Constraint)
ConstraintAxis::ConstraintAxis()
{
}
short ConstraintAxis::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ConstraintAxis::execute(void)
{
return App::DocumentObject::StdReturn;
}
}

View File

@ -0,0 +1,57 @@
/***************************************************************************
* Copyright (c) 2012 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 *
* *
***************************************************************************/
#ifndef Assembly_ConstraintAxis_H
#define Assembly_ConstraintAxis_H
#include <App/PropertyStandard.h>
#include "Constraint.h"
namespace Assembly
{
class AssemblyExport ConstraintAxis : public Assembly::Constraint
{
PROPERTY_HEADER(Assembly::ConstraintAxis);
public:
ConstraintAxis();
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "PartDesignGui::ViewProviderConstraintAxis";
//}
//@}
};
} //namespace Assembly
#endif // Assembly_ConstraintAxis_H

View File

@ -0,0 +1,59 @@
/***************************************************************************
* Copyright (c) 2012 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 <Base/Placement.h>
#include "ConstraintContact.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintContact, Assembly::Constraint)
ConstraintContact::ConstraintContact()
{
}
short ConstraintContact::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ConstraintContact::execute(void)
{
return App::DocumentObject::StdReturn;
}
}

View File

@ -0,0 +1,57 @@
/***************************************************************************
* Copyright (c) 2012 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 *
* *
***************************************************************************/
#ifndef Assembly_ConstraintContact_H
#define Assembly_ConstraintContact_H
#include <App/PropertyStandard.h>
#include "Constraint.h"
namespace Assembly
{
class AssemblyExport ConstraintContact : public Assembly::Constraint
{
PROPERTY_HEADER(Assembly::ConstraintContact);
public:
ConstraintContact();
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "PartDesignGui::ViewProviderConstraintContact";
//}
//@}
};
} //namespace Assembly
#endif // Assembly_ConstraintContact_H

View File

@ -0,0 +1,59 @@
/***************************************************************************
* 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 <Base/Placement.h>
#include "ConstraintFix.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintFix, Assembly::Constraint)
ConstraintFix::ConstraintFix()
{
}
short ConstraintFix::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ConstraintFix::execute(void)
{
return App::DocumentObject::StdReturn;
}
}

View File

@ -0,0 +1,56 @@
/***************************************************************************
* 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 *
* *
***************************************************************************/
#ifndef Assembly_ConstraintFix_H
#define Assembly_ConstraintFix_H
#include <App/PropertyStandard.h>
#include "Constraint.h"
namespace Assembly
{
class AssemblyExport ConstraintFix : public Assembly::Constraint
{
PROPERTY_HEADER(Assembly::ConstraintFix);
public:
ConstraintFix();
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "PartDesignGui::ViewProviderConstraintFix";
//}
//@}
};
} //namespace Assembly
#endif // Assembly_ConstraintFix_H

View File

@ -0,0 +1,59 @@
/***************************************************************************
* 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 <Base/Placement.h>
#include "ConstraintGroup.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintGroup, App::DocumentObject)
ConstraintGroup::ConstraintGroup()
{
ADD_PROPERTY(Constraints,(0));
}
short ConstraintGroup::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ConstraintGroup::execute(void)
{
return App::DocumentObject::StdReturn;
}
}

View File

@ -0,0 +1,58 @@
/***************************************************************************
* 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 *
* *
***************************************************************************/
#ifndef Assembly_ConstraintGroup_H
#define Assembly_ConstraintGroup_H
#include <App/PropertyLinks.h>
#include <App/DocumentObject.h>
namespace Assembly
{
class AssemblyExport ConstraintGroup : public App::DocumentObject
{
PROPERTY_HEADER(Assembly::ConstraintGroup);
public:
ConstraintGroup();
App::PropertyLinkList Constraints;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "PartDesignGui::ViewProviderConstraintGroup";
//}
//@}
};
} //namespace Assembly
#endif // Assembly_ConstraintGroup_H

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="DocumentObjectPy"
Name="ConstraintGroupPy"
Twin="ConstraintGroup"
TwinPointer="ConstraintGroup"
Include="Mod/Assembly/App/ConstraintGroup.h"
Namespace="Assembly"
FatherInclude="App/DocumentObjectPy.h"
FatherNamespace="App">
<Documentation>
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
<UserDocu>Base class of all objects in Assembly</UserDocu>
</Documentation>
</PythonExport>
</GenerateModel>

View File

@ -0,0 +1,34 @@
#include "PreCompiled.h"
#include "Mod/Assembly/App/ConstraintGroup.h"
// inclusion of the generated files (generated out of ConstraintGroupPy.xml)
#include "ConstraintGroupPy.h"
#include "ConstraintGroupPy.cpp"
using namespace Assembly;
// returns a string which represents the object e.g. when printed in python
std::string ConstraintGroupPy::representation(void) const
{
return std::string("<ConstraintGroup object>");
}
PyObject *ConstraintGroupPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int ConstraintGroupPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}

View File

@ -0,0 +1,59 @@
/***************************************************************************
* 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 <Base/Placement.h>
#include "ConstraintOffset.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintOffset, Assembly::Constraint)
ConstraintOffset::ConstraintOffset()
{
ADD_PROPERTY(Offset,(0));
}
short ConstraintOffset::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ConstraintOffset::execute(void)
{
return App::DocumentObject::StdReturn;
}
}

View File

@ -0,0 +1,58 @@
/***************************************************************************
* 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 *
* *
***************************************************************************/
#ifndef Assembly_ConstraintOffset_H
#define Assembly_ConstraintOffset_H
#include <App/PropertyStandard.h>
#include "Constraint.h"
namespace Assembly
{
class AssemblyExport ConstraintOffset : public Assembly::Constraint
{
PROPERTY_HEADER(Assembly::ConstraintOffset);
public:
ConstraintOffset();
App::PropertyFloat Offset;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "PartDesignGui::ViewProviderConstraintOffset";
//}
//@}
};
} //namespace PartDesign
#endif // PART_ConstraintOffset_H

View File

@ -0,0 +1,59 @@
/***************************************************************************
* 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 <Base/Placement.h>
#include "Item.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::Item, Part::Feature)
Item::Item()
{
ADD_PROPERTY(Model,(0));
}
short Item::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *Item::execute(void)
{
return App::DocumentObject::StdReturn;
}
}

View File

@ -0,0 +1,59 @@
/***************************************************************************
* 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 *
* *
***************************************************************************/
#ifndef Assembly_Item_H
#define Assembly_Item_H
#include <App/PropertyStandard.h>
#include <Mod/Part/App/PartFeature.h>
namespace Assembly
{
class AssemblyExport Item : public Part::Feature
{
PROPERTY_HEADER(Assembly::Item);
public:
Item();
App::PropertyLinkList Model;
App::PropertyLink Tip;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "PartDesignGui::ViewProviderItem";
//}
//@}
};
} //namespace PartDesign
#endif // PART_Item_H

View File

@ -0,0 +1,59 @@
/***************************************************************************
* Copyright (c) 2012 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 <Base/Placement.h>
#include "ItemAssembly.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ItemAssembly, Assembly::Item)
ItemAssembly::ItemAssembly()
{
ADD_PROPERTY(Items,(0));
}
short ItemAssembly::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ItemAssembly::execute(void)
{
return App::DocumentObject::StdReturn;
}
}

View File

@ -0,0 +1,58 @@
/***************************************************************************
* Copyright (c) 2012 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 *
* *
***************************************************************************/
#ifndef ItemAssembly_ItemAssembly_H
#define ItemAssembly_ItemAssembly_H
#include <App/PropertyStandard.h>
#include "Item.h"
namespace Assembly
{
class AssemblyExport ItemAssembly : public Assembly::Item
{
PROPERTY_HEADER(Assembly::ItemAssembly);
public:
ItemAssembly();
App::PropertyLinkList Items;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "PartDesignGui::ViewProviderItemAssembly";
//}
//@}
};
} //namespace Assembly
#endif // Assembly_ItemAssembly_H

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="ItemPy"
Name="ItemAssemblyPy"
Twin="ItemAssembly"
TwinPointer="ItemAssembly"
Include="Mod/Assembly/App/ItemAssembly.h"
Namespace="Assembly"
FatherInclude="Mod/Assembly/App/ItemPy.h"
FatherNamespace="Assembly">
<Documentation>
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
<UserDocu>Base class of all objects in Assembly</UserDocu>
</Documentation>
</PythonExport>
</GenerateModel>

View File

@ -0,0 +1,34 @@
#include "PreCompiled.h"
#include "Mod/Assembly/App/ItemAssembly.h"
// inclusion of the generated files (generated out of ItemAssemblyPy.xml)
#include "ItemAssemblyPy.h"
#include "ItemAssemblyPy.cpp"
using namespace Assembly;
// returns a string which represents the object e.g. when printed in python
std::string ItemAssemblyPy::representation(void) const
{
return std::string("<ItemAssembly object>");
}
PyObject *ItemAssemblyPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int ItemAssemblyPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}

View File

@ -0,0 +1,59 @@
/***************************************************************************
* Copyright (c) 2012 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 <Base/Placement.h>
#include "ItemPart.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ItemPart, Assembly::Item)
ItemPart::ItemPart()
{
ADD_PROPERTY(Model,(0));
}
short ItemPart::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ItemPart::execute(void)
{
return App::DocumentObject::StdReturn;
}
}

View File

@ -0,0 +1,58 @@
/***************************************************************************
* Copyright (c) 2012 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 *
* *
***************************************************************************/
#ifndef Assembly_ItemPart_H
#define Assembly_ItemPart_H
#include <App/PropertyLinks.h>
#include "Item.h"
namespace Assembly
{
class AssemblyExport ItemPart : public Assembly::Item
{
PROPERTY_HEADER(Assembly::ItemPart);
public:
ItemPart();
App::PropertyLink Model;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "ItemPartDesignGui::ViewProviderItemPart";
//}
//@}
};
} //namespace Assembly
#endif // Assembly_ItemPart_H

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="ItemPy"
Name="ItemPartPy"
Twin="ItemPart"
TwinPointer="ItemPart"
Include="Mod/Assembly/App/ItemPart.h"
Namespace="Assembly"
FatherInclude="Mod/Assembly/App/ItemPy.h"
FatherNamespace="Assembly">
<Documentation>
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
<UserDocu>Base class of all objects in Assembly</UserDocu>
</Documentation>
</PythonExport>
</GenerateModel>

View File

@ -0,0 +1,34 @@
#include "PreCompiled.h"
#include "Mod/Assembly/App/ItemPart.h"
// inclusion of the generated files (generated out of ItemPartPy.xml)
#include "ItemPartPy.h"
#include "ItemPartPy.cpp"
using namespace Assembly;
// returns a string which represents the object e.g. when printed in python
std::string ItemPartPy::representation(void) const
{
return std::string("<ItemPart object>");
}
PyObject *ItemPartPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int ItemPartPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="DocumentObjectPy"
Name="ItemPy"
Twin="Item"
TwinPointer="Item"
Include="Mod/Assembly/App/Item.h"
Namespace="Assembly"
FatherInclude="App/DocumentObjectPy.h"
FatherNamespace="App">
<Documentation>
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
<UserDocu>Base class of all objects in Assembly</UserDocu>
</Documentation>
</PythonExport>
</GenerateModel>

View File

@ -0,0 +1,34 @@
#include "PreCompiled.h"
#include "Mod/Assembly/App/Item.h"
// inclusion of the generated files (generated out of ItemPy.xml)
#include "ItemPy.h"
#include "ItemPy.cpp"
using namespace Assembly;
// returns a string which represents the object e.g. when printed in python
std::string ItemPy::representation(void) const
{
return std::string("<Item object>");
}
PyObject *ItemPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int ItemPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}

View File

@ -28,11 +28,11 @@
// Exporting of App classes
#ifdef FC_OS_WIN32
# define AppAssemblyExport __declspec(dllexport)
# define AssemblyExport __declspec(dllexport)
# define PartExport __declspec(dllimport)
# define MeshExport __declspec(dllimport)
#else // for Linux
# define AppAssemblyExport
# define AssemblyExport
# define PartExport
# define MeshExport
#endif

View File

@ -1,3 +1,5 @@
import FreeCAD,Assembly
import FreeCAD,Assembly,time
print "Script to test the assembly development"
time.sleep(3)