I have implemented the Arc of Circle in FCSSketch.
I am running into issues relating to the CCW emulation and makeRules.
I have pushed what I have to the branch.
Three places in FCSSketch deal with this:
Code: Select all
int FCSSketch::addArc(const Part::GeomArcOfCircle &arc, bool fixed)
{
// create our own copy
GeomArcOfCircle *arcc = static_cast<GeomArcOfCircle*>(arc.clone());
Base::Vector3d center = arcc->getCenter();
double radius = arcc->getRadius();
Base::Vector3d startPnt = arcc->getStartPoint(/*emulateCCW=*/true);
Base::Vector3d endPnt = arcc->getEndPoint(/*emulateCCW=*/true);
Code: Select all
int FCSSketch::solve(void)
{
...
for(auto &g : LineSegments)
sys->addConstraint(g->makeRuleConstraints());
for(auto &g : Arcs)
sys->addConstraint(g->makeRuleConstraints());
and
Code: Select all
bool FCSSketch::updateGeometry()
{
...
else if (it->type == GeoType::Arc) {
GeomArcOfCircle *aoc = static_cast<GeomArcOfCircle*>((*it).geo.get());
aoc->setCenter(Vector3d(Points[it->midPointId]->x.savedValue(),
Points[it->midPointId]->y.savedValue(),
0.0)
);
aoc->setRadius(Arcs[it->index]->radius.savedValue());
aoc->setRange(Arcs[it->index]->u0.savedValue(), Arcs[it->index]->u1.savedValue(), true);
}
getPoint and
setRange have the option of CCW emulation.
If I
remove the makeRuleConstraints() for arcs in solve().
1. With CCW=true in
addArc() and
updateGeometry() The arc that is created is not the one I draw (unless it is in the first quadrant)
2. With CCW=false in
addArc() the arc is the one I draw.
3. Obviously when I can add a coincident constraint endpoint of the arc to a line, the times it works, only the line moves but not to make connection (somehow right because it does not have endofarc rules)
However, if I create the rule constraints:
1. With CCW=true in
addArc() the arc is not even created, LM indicates step too small. It appears a conflicting constraint problem that does not converge.
2. With CCW=false the arc is created, but no coincidence on endpoint can be added with the issue of LM being too small.
Hopefully, you will have an idea of what the issue is. I remember you had an example with arcs of circle working from Python, so it should work. I do not get why it does not.