void Config_ModuleReader::loadScript(const std::string theFileName)
{
- std::string aPythonFile = theFileName + ".py";
/* aquire python thread */
PyGILState_STATE gstate = PyGILState_Ensure();
- PyObject* module = PyImport_ImportModule(aPythonFile.c_str());
+ PyObject* module = PyImport_ImportModule(theFileName.c_str());
if (!module) {
- std::string anErrorMsg = "An error occured while loading " + aPythonFile;
+ std::string anErrorMsg = "An error occured while importing " + theFileName;
//Get detailed error message:
if (PyErr_Occurred()) {
PyObject *ptype, *pvalue, *ptraceback;
%template(modelAPI_CompositeFeature) shared_ptr_cast<ModelAPI_CompositeFeature, ModelAPI_Feature>;
%template(modelAPI_Feature) shared_ptr_cast<ModelAPI_Feature, ModelAPI_Object>;
// Result casts
+%template(modelAPI_Result) shared_ptr_cast<ModelAPI_Result, ModelAPI_Object>;
%template(modelAPI_ResultConstruction) shared_ptr_cast<ModelAPI_ResultConstruction, ModelAPI_Result>;
%template(modelAPI_ResultBody) shared_ptr_cast<ModelAPI_ResultBody, ModelAPI_Result>;
%template(modelAPI_ResultPart) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_Result>;
aWidth = self.real(self.WIDTH_ID()).value()
aLength = self.real(self.LENGTH_ID()).value()
aHeight = self.real(self.HEIGHT_ID()).value()
- aHeightFeature = None
- aHeightFeatureResult = ModelAPI.modelAPI_ResultBody(self.reference(self.HEIGHT_REF_ID()).value())
- if aHeightFeatureResult is not None:
- aHeightFeature = aHeightFeatureResult.document().feature(aHeightFeatureResult)
- aWidthFeature = ModelAPI.modelAPI_Feature(self.reference(self.WIDTH_REF_ID()).value())
- aLengthFeature = ModelAPI.modelAPI_Feature(self.reference(self.LENGTH_REF_ID()).value())
+ aWidthRefValue = self.reference(self.WIDTH_REF_ID()).value()
+ aLengthRefValue = self.reference(self.LENGTH_REF_ID()).value()
+ aHeightRefValue = self.reference(self.HEIGHT_REF_ID()).value()
aResult = None
- if not all((aWidthFeature, aLengthFeature, aLengthFeature)):
+ if not all((aWidthRefValue, aLengthRefValue, aHeightRefValue)):
aResult = extrusion.getBody(self.makeBox(aLength, aWidth, aHeight))
else:
+ aHeightProxyResult = ModelAPI.modelAPI_Result(aHeightRefValue)
+ aWidthFeature = ModelAPI.modelAPI_Feature(aWidthRefValue)
+ aLengthFeature = ModelAPI.modelAPI_Feature(aLengthRefValue)
+ aHeightResult = ModelAPI.modelAPI_ResultBody(aHeightProxyResult)
aWidthFeature.real("ConstraintValue").setValue(aWidth)
aLengthFeature.real("ConstraintValue").setValue(aLength)
- aHeightFeature.real("extrusion_size").setValue(aHeight)
- aResult = extrusion.getBody(aHeightFeature)
+ if aHeightResult is not None:
+ aHeightFeature = aHeightResult.document().feature(aHeightResult)
+ aHeightFeature.real("extrusion_size").setValue(aHeight)
+ aResult = extrusion.getBody(aHeightFeature)
self.setResult(aResult)
def makeBox(self, aWidth, aLength, aHeight):