Sketch vertex, index renumbering after edit?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: Sketch vertex, index renumbering after edit?

Post by paullee »

Had an earlier discussion about this, IMHO as far as inherent operation in Sketch itself is concerned this is not 'typical TNP problem' :)

For each elements in Sketch (line, arc), there is a Tag which is 'semi-persistent' survive editing of Sketch - See sketch.Geometry[index].Tag == Unique identification survive changes? Not sure @abdullah/@realthundar commented the Tag 'semi-persistent' is not made persistent in history.

Code: Select all

        tag = fp.Geometry[index].Tag					
I just learn basic python and find several approaches 'for myself' - one experimental made public in my experiment SketchArch Add-on

Discussion of the several approaches - Topological naming tolerant

Maybe you can have a look at if anything would inspire - https://github.com/paullee0/FreeCAD_Ske ... hObject.py
e.g.

Code: Select all

def getEdgeTagIndex(self, fp, tag=None, index=None, useEdgeTagDictSyncFindIndex=False):		
Good luck :)
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Sketch vertex, index renumbering after edit?

Post by onekk »

heron wrote: Sat Jan 08, 2022 8:00 pm Your macro is cool, many thanks!
You are welcome.

It is simply some math applied.

jbi wrote: Thu Dec 16, 2021 3:14 pm Instead of the index use vertex.hashCode() So maintain a parallel list of vertex.hashCode()
Sorry for not having noted your answer, but without a quote I have no "signal" of reply.

I will try to guess what you mean, maybe if you post a modified version of the code I will improve my knowledge.

Regards to all.

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply