Getting the sketcher geometric elements that the solver indicates as dependent

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Getting the sketcher geometric elements that the solver indicates as dependent

Post by abdullah »

I have written a new Python function of the sketch object (aka ActiveSketch), which provides the elements that the solver indicates they have dependent parameters (so they are not constraint, are movable,...). I looks like this:

Code: Select all

>>> ActiveSketch.getGeometryWithDependentParameters()
[(0L, 2L), (0L, 0L)]
So it returns a list of tuples, each tuple being (GeoId,PosId).

Any input before I PR it?
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Getting the sketcher geometric elements that the solver indicates as dependent

Post by Kunda1 »

I think @Joel_graff might dig this
Joel_graff wrote:poke
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Getting the sketcher geometric elements that the solver indicates as dependent

Post by Joel_graff »

abdullah wrote: Fri Jun 08, 2018 7:34 pm I have written a new Python function of the sketch object (aka ActiveSketch), which provides the elements that the solver indicates they have dependent parameters (so they are not constraint, are movable,...). I looks like this:
Hmmm.. I admit I'm not sure, exactly, what that does...
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Getting the sketcher geometric elements that the solver indicates as dependent

Post by abdullah »

Joel_graff wrote: Sat Jun 09, 2018 11:58 am
abdullah wrote: Fri Jun 08, 2018 7:34 pm I have written a new Python function of the sketch object (aka ActiveSketch), which provides the elements that the solver indicates they have dependent parameters (so they are not constraint, are movable,...). I looks like this:
Hmmm.. I admit I'm not sure, exactly, what that does...
You ask:
ActiveSketch.getGeometryWithDependentParameters()

You get replied with a list of tuples:
[(0L, 2L), (0L, 0L)]

each element of the list represents an edge or a vertex. The first element of the tuple is the GeoID, the second element of the tuple is the PosID. For example, with the output above the Sketcher is telling you: "The solver detects that the endpoint of the element with GeoID=0 is not fully constraint, so it is "movable", or if you want you need to constraint it, directly or indirectly, if you want to arrive to a fully constraint sketch. The same happens with the Edge of the geometry with GeoID=0. It is basically telling you were your DoFs are.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Getting the sketcher geometric elements that the solver indicates as dependent

Post by Joel_graff »

abdullah wrote: Sat Jun 09, 2018 2:08 pm
Joel_graff wrote: Sat Jun 09, 2018 11:58 am
abdullah wrote: Fri Jun 08, 2018 7:34 pm I have written a new Python function of the sketch object (aka ActiveSketch), which provides the elements that the solver indicates they have dependent parameters (so they are not constraint, are movable,...). I looks like this:
Hmmm.. I admit I'm not sure, exactly, what that does...
You ask:
ActiveSketch.getGeometryWithDependentParameters()

You get replied with a list of tuples:
[(0L, 2L), (0L, 0L)]

each element of the list represents an edge or a vertex. The first element of the tuple is the GeoID, the second element of the tuple is the PosID. For example, with the output above the Sketcher is telling you: "The solver detects that the endpoint of the element with GeoID=0 is not fully constraint, so it is "movable", or if you want you need to constraint it, directly or indirectly, if you want to arrive to a fully constraint sketch. The same happens with the Edge of the geometry with GeoID=0. It is basically telling you were your DoFs are.
Ahhh. gotcha. Very clear! That looks really useful.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Getting the sketcher geometric elements that the solver indicates as dependent

Post by Kunda1 »

abdullah wrote: Sat Jun 09, 2018 2:08 pm You ask:
ActiveSketch.getGeometryWithDependentParameters()

You get replied with a list of tuples:
[(0L, 2L), (0L, 0L)]

each element of the list represents an edge or a vertex. The first element of the tuple is the GeoID, the second element of the tuple is the PosID. For example, with the output above the Sketcher is telling you: "The solver detects that the endpoint of the element with GeoID=0 is not fully constraint, so it is "movable", or if you want you need to constraint it, directly or indirectly, if you want to arrive to a fully constraint sketch. The same happens with the Edge of the geometry with GeoID=0. It is basically telling you were your DoFs are.
Is there a documentation page where we can quickly post that tidbit to ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Getting the sketcher geometric elements that the solver indicates as dependent

Post by abdullah »

Kunda1 wrote: Mon Jun 11, 2018 12:07 am
abdullah wrote: Sat Jun 09, 2018 2:08 pm You ask:
ActiveSketch.getGeometryWithDependentParameters()

You get replied with a list of tuples:
[(0L, 2L), (0L, 0L)]

each element of the list represents an edge or a vertex. The first element of the tuple is the GeoID, the second element of the tuple is the PosID. For example, with the output above the Sketcher is telling you: "The solver detects that the endpoint of the element with GeoID=0 is not fully constraint, so it is "movable", or if you want you need to constraint it, directly or indirectly, if you want to arrive to a fully constraint sketch. The same happens with the Edge of the geometry with GeoID=0. It is basically telling you were your DoFs are.
Is there a documentation page where we can quickly post that tidbit to ?
None to my knowledge.

Documentation from code will be generated... whenever it is generally generated, but probably it would be great to have all this bits somewhere...
Post Reply