Testing it with a sketch with 3 edges returns something below... and seem to be something Abdullah mention earlier...?
- Further test show this Tag behaves interestingly... It return a UUID kind of string, unlike the Geometry[index] / Shape.Edge[Index]..
(sorry, i can't read c++ and a beginner in python only, so what I can do is lengthy trial and error below...)
Code: Select all
>>> se1=s.Geometry[0] >>> se2=s.Geometry[1] >>> se3=s.Geometry[2] >>> >>> se1.Tag 'a5ee5ee6-7937-4873-925f-579d1d8be4b8' >>> se2.Tag '49e613b7-a5dd-474d-a16b-52d15e7cefc3' >>> se3.Tag '8181cc10-e04b-4384-8115-54219c49078e'
- Now delete '2nd' edge... assign and read the Tag again... no '3rd' edge of cos.
... now the geometry index 'shift', which is kind of 'topological issues' / problem?, referencing to same index leads to wrong element..
... but seem the Tag is 'constant' right?
Code: Select all
>>> s01=s.Geometry[0] >>> s02=s.Geometry[1] >>> s03=s.Geometry[2] Traceback (most recent call last): File "<input>", line 1, in <module> IndexError: list index out of range >>> >>> s01.Tag 'a5ee5ee6-7937-4873-925f-579d1d8be4b8' >>> s02.Tag '8181cc10-e04b-4384-8115-54219c49078e'
- Then, w/o saving it, close it and re-open it (i.e. keep 3 edges)...
... so it seem the Tag is generated each time the file is opened, but never change (unlike the geometry or shape.edge index which change) when some edges in the middle are deleted.
Code: Select all
>>> se1.Tag '622356c1-5d35-401d-8e49-3eb8ec26e973' >>> se2.Tag '61d5bc7c-055b-417d-a41c-33032ad1499b' >>> se3.Tag '7833b3c9-2ebf-45c9-96ef-38c576a0e0ee'
(Which I am hoping Realthunder's Sketch Export feature would have solved it all along...!) one of missing pieces in the puzzle!
EDIT: https://forum.freecadweb.org/viewtopic. ... 32#p214271abdullah wrote: ↑Sat Feb 10, 2018 8:47 amThe code is this (src/Mod/Part/App/Geometry.h), see getTag() below and the protected functions:paullee wrote: ↑Sat Feb 10, 2018 8:03 am
I am interesting in the 'unique identifier' you mentioned, hope somebody can help looking in the code and use it. My test to use the convoluting workflow: datum constraints+expression engine+reference datum constraints is not productive though works. I guess the 'unique identifier' would make resolve it fundamentally.
Thanks anyway.
Code: Select all
class PartExport Geometry: public Base::Persistence { TYPESYSTEM_HEADER(); public: virtual ~Geometry(); virtual TopoDS_Shape toShape() const = 0; virtual const Handle(Geom_Geometry)& handle() const = 0; // Persistence implementer --------------------- virtual unsigned int getMemSize(void) const; virtual void Save(Base::Writer &/*writer*/) const; virtual void Restore(Base::XMLReader &/*reader*/); /// returns a copy of this object having a new randomly generated tag. If you also want to copy the tag, you may use clone() instead. /// For creation of geometry with other handles, with or without the same tag, you may use the constructors and the sethandle functions. /// The tag of a geometry can be copied to another geometry using the assignTag function. virtual Geometry *copy(void) const = 0; ...
EDIT: https://forum.freecadweb.org/viewtopic. ... 30#p216875realthunder wrote: ↑Sat Feb 24, 2018 9:11 amYes, it calculates the name of external edge by hashing linked object_name+element_name. You can delete the external edge, and later link back to the same edge, the name stays the same. However, to have a complete safe external link, you still need the linked object to have a stable topological name, and I plane to work on that too.[*]It seem edges are now using 'unique identifier' that would not repeated / recycled right? And it become safe again to use Link to External Edges right?