Element widget for Sketcher WB

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
jmaustpc
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Element widget for Sketcher WB

Postby jmaustpc » Mon Oct 06, 2014 12:00 pm

Hi Abdullah

Something is wrong with the naming for the external geometry elements, they are numbered with a hyphen where as other items are not.

this is just a simple file I used for testing.
elementeexternalgeometrytesting.fcstd
(35.44 KiB) Downloaded 24 times
externaslgeometryelementswidgettesting.jpg
externaslgeometryelementswidgettesting.jpg (22.22 KiB) Viewed 1255 times
if you look at the point external geometry in sketch001 and the edges external geometry in sketch002, you will see what I mean.

This is sketch001, you can see that the first point is point(Edge6) which is a normal point I added into the sketch where as the next two points are external geometry points, Point (Edge-3) and point (Edge-4)
externaslgeometryelementswidgettesting1.jpg
externaslgeometryelementswidgettesting1.jpg (21.69 KiB) Viewed 1255 times

This below is sketch002, the first Line is the ordinary line set to construction mode, where as the next two are external geometry.
externaslgeometryelementswidgettesting2.jpg
externaslgeometryelementswidgettesting2.jpg (13.32 KiB) Viewed 1255 times

Another little thing, in all your branches and in master, I noticed that the extended naming for a point says "edge", is it supposed to?

Jim
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Element widget for Sketcher WB

Postby abdullah » Mon Oct 06, 2014 3:28 pm

jmaustpc wrote:Something is wrong with the naming for the external geometry elements, they are numbered with a hyphen where as other items are not.
jmaustpc wrote:Another little thing, in all your branches and in master, I noticed that the extended naming for a point says "edge", is it supposed to?
Extended naming has to do with how a python user could interface with the element. I know nothing of Python and I have never used the python console in FreeCAD. An external geometry is stored internally using negative numbers, so that is the reason for the "hyphen".

Using C++ if I tell selected "Edge-3", it just does work. I think I can also tell select "ExternalEdge3",

However, because I do not know if it works or not from Python. I made the following enquiry some posts ago in this thread:
abdullah wrote:Specially, anyone using python with FreeCAD, this "Edge-3" is what you would expect as extended name, or more "ExternalEdge3", or does not matter??
This I think should be answered by someone that does use python to treat geometry... :? Anywant of you power users out there?


BTW: Edge-1 and -2 are the x and y axes of the sketch..., that is why it starts in -3
jmaustpc
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Element widget for Sketcher WB

Postby jmaustpc » Mon Oct 06, 2014 3:40 pm

Hi Abdullah

abdullah wrote:Extended naming has to do with how a python user could interface with the element. I know nothing of Python and I have never used the python console in FreeCAD. An external geometry is stored internally using negative numbers, so that is the reason for the "hyphen".

Using C++ if I tell selected "Edge-3", it just does work. I think I can also tell select "ExternalEdge3",
OK, well then all is well! :)

One question does all of the above apply to the points as well? I mean should the extended naming call then an "edge"?

If the above is correct then I suggest you create a pull request for this.

Jim
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Element widget for Sketcher WB

Postby abdullah » Tue Oct 07, 2014 12:20 pm

Hi Jim!

I have just realised that when you select one object, in the status bar you can see the python name. So, Edge-3 is actually ExternalEdge1 (abs(index)-2). I have adapted the code to show this.
jmaustpc wrote:One question does all of the above apply to the points as well? I mean should the extended naming call then an "edge"?
The extended naming is intended for the edge, consistent with non-external elements. The list does not get updated when you change element, it is saying you are selecting the starting point of ExternalEdge1.

Pull requested in: viewtopic.php?f=17&t=7921
jmaustpc
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Element widget for Sketcher WB

Postby jmaustpc » Wed Oct 08, 2014 1:27 am

abdullah wrote:
jmaustpc wrote:One question does all of the above apply to the points as well? I mean should the extended naming call then an "edge"?
The extended naming is intended for the edge, consistent with non-external elements. The list does not get updated when you change element, it is saying you are selecting the starting point of ExternalEdge1.

Pull requested in: viewtopic.php?f=17&t=7921
Hi Abdullah :)
Just checking, do you know that I am talking about the "point" element in sketcher? Not a starting or ending point on a line or anything else, just the plain "point" object? Hence it has no edge associated with it. I am not talking about the names changing when the selection type is changed in the drop down list. I am talking about the name generated on creation, on first putting a sketcher "point" object into a sketch. :)

Jim
abdullah
Posts: 3174
Joined: Sun May 04, 2014 3:16 pm

Re: Element widget for Sketcher WB

Postby abdullah » Wed Oct 08, 2014 11:31 am

jmaustpc wrote:Just checking, do you know that I am talking about the "point" element in sketcher?
Ah! No I was not understanding you :) . However, that is quite of a funny story: the points are also edges (at least for the c++ implementation). I have no clue if a python user can actually use the edge or not. I would really really like to know this from someone that usually uses Python in freeCAD.

Nevertheless, that is material for another pull request. I mean, the current pull request is for supporting external geometry, so it can go ahead.

Then, if someone knowledgable in python would be so kind to tell (or test), if the edge is usable in Python, then we can prepare another feature enhancement with this information. You can even make another ticket and assign it to me ;)