Getting the sketcher geometric elements that the solver indicates as dependent

Need help, or want to share a macro? Post here!
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Getting the sketcher geometric elements that the solver indicates as dependent

Postby abdullah » 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:

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
Posts: 5781
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Sat Jun 09, 2018 12:31 am

I think @Joel_graff might dig this
Joel_graff wrote:poke
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Joel_graff
Posts: 1540
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

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

Postby Joel_graff » 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...
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
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

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

Postby abdullah » 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.
User avatar
Joel_graff
Posts: 1540
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

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

Postby Joel_graff » Sun Jun 10, 2018 1:05 pm

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
Posts: 5781
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » 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 ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

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

Postby abdullah » Mon Jun 11, 2018 4:43 pm

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...