Skip to content

Commit

Permalink
FCSSketch: debug tool - bring solver problem to py console
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepSOIC committed May 5, 2020
1 parent 7cd8efd commit 269a4de
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Mod/Sketcher/App/FCSSketch.cpp
Expand Up @@ -42,6 +42,7 @@
#include <Base/Console.h>
#include <Base/VectorPy.h>
#include <Base/StdStlTools.h>
#include <Base/Interpreter.h>

#include <Mod/Part/App/Geometry.h>
#include <Mod/Part/App/GeometryCurvePy.h>
Expand Down Expand Up @@ -1023,6 +1024,13 @@ Base::Vector3d FCSSketch::calculateNormalAtPoint(int geoIdCurve, double px, doub
return Base::Vector3d(1,1,1);
}

void sendToConsole(Py::Object obj, std::string name){
Base::Interpreter().runStringArg(
"import ctypes\n"
"%s = ctypes.cast(0x%p, ctypes.py_object).value",
name.c_str(), obj.ptr());
}

int FCSSketch::solve(void)
{
if(Geoms.empty() || Constrs.empty())
Expand Down Expand Up @@ -1056,6 +1064,9 @@ int FCSSketch::solve(void)

FCS::HLM lmbackend = new FCS::LM;

sendToConsole(sys.getHandledObject(),"sksys");//debug
sendToConsole(lmbackend.getHandledObject(),"slv");//debug

lmbackend->solve(sys,valueset);
valueset->apply();

Expand Down

0 comments on commit 269a4de

Please sign in to comment.