Possible bug: sketches using linked external geometry

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
dimitar
Posts: 229
Joined: Thu Jun 13, 2019 6:10 am
Contact:

Possible bug: sketches using linked external geometry

Post by dimitar »

Hi,

I have a situation where multiple sketches reference some elements from a master sketch. In the master sketch, I try to remove some of the lines. When I go back to the sketch referencing the master sketch, I cannot reference any new geometry from that master sketch anymore. So, I do what I usually do in these types of situations - close and open Freecad again. However, once I open the file, all the constraints of the sketches referencing the file are gone.

I am wondering what I may be doing wrong here or if this behaviour is a bug, or if it is indeed doing what it's doing by design?

I've posted a short video to show the issue: https://streamable.com/x9thi (seems like there's no way to embed streamable videos?)

Also, attached are two files. The initial one that works, and the second one is with some of the elements removed from the master sketch.

System & build info:

Code: Select all

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16117 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: dbb4cc6415bac848a294f03b80f65e888d531742
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
Attachments
test03b-bug2.FCStd
(26.51 KiB) Downloaded 24 times
test03b-bug.FCStd
(35.5 KiB) Downloaded 20 times
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: Possible bug: sketches using linked external geometry

Post by kisolre »

As far as I recall external geometries are linked by indices (in order of creation, skipping reference geometry). And if something changes in the original before them they move to the new entity. If index goes out of bounds (you have fewer elements) there probably will be errors.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Possible bug: sketches using linked external geometry

Post by bejant »

dimitar wrote: Sun Jul 14, 2019 2:20 pm I am wondering what I may be doing wrong here
If you change the Master Sketch, things referenced from it in other Sketches don't update. You should complete the Master Sketch before referencing from it.
chrisb
Veteran
Posts: 54144
Joined: Tue Mar 17, 2015 9:14 am

Re: Possible bug: sketches using linked external geometry

Post by chrisb »

In this case you can use the Sketch validation tool and remove all references to external geometry. Then enter the Sketch and remove the external geometries if they still exist. After that you should be able to add references to externals again.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

Re: Possible bug: sketches using linked external geometry

Post by paullee »

This should be one of problem associated with sketcher (some indicated it is not strictly topological naming problem)

A few quick remarks:-

Realthundar's Assembly 3 Branch
  1. There is a Assembly 3 branch by Realthundar - w/ SketchExport feature + 'persistent edge naming'
  2. That should fix the 'bug', but not knowing this particular feature is merged or not... asking https://forum.freecadweb.org/viewtopic. ... 10#p222807
Ugly Workaround
  1. 2nd, an ugly workaround is described in link below
  2. ... in essence, after link to external geometry, 'make a copy' and 'freeze the copy' by Block constraints - need ' manual updating' https://forum.freecadweb.org/viewtopic. ... 30#p273230
Other workaround / Core FC fix
  1. 3rd, the Sketch edges has tag that is 'semi-persistent'
  2. ... the tag is persistent even you delete edges in sketch, so you can trace with python;
  3. ... unfortunately, the tags are not persistent over each file open (they are 're-assign' on every document restore);
  4. ... I remember, with abdullah / realthundar's help, I can mock-up with some python code to trace and restore the tags ... so 'dependent sketch' has no problem 'referencing' 'Master Sketch' but it is very convoluted...
  5. abdullah / realthundar did not recommended users to implement workaround through SketchPython remarking that should be 'fixed internally' like Assembly 3 branch

    Hope there are other workflow solving this problem / maybe other better 'workaround' solutions :)
User avatar
dimitar
Posts: 229
Joined: Thu Jun 13, 2019 6:10 am
Contact:

Re: Possible bug: sketches using linked external geometry

Post by dimitar »

paullee wrote: Sun Jul 14, 2019 9:06 pm This should be one of problem associated with sketcher (some indicated it is not strictly topological naming problem)

A few quick remarks:-

Realthundar's Assembly 3 Branch
  1. There is a Assembly 3 branch by Realthundar - w/ SketchExport feature + 'persistent edge naming'
  2. That should fix the 'bug', but not knowing this particular feature is merged or not... asking https://forum.freecadweb.org/viewtopic. ... 10#p222807
Ugly Workaround
  1. 2nd, an ugly workaround is described in link below
  2. ... in essence, after link to external geometry, 'make a copy' and 'freeze the copy' by Block constraints - need ' manual updating' https://forum.freecadweb.org/viewtopic. ... 30#p273230
Other workaround / Core FC fix
  1. 3rd, the Sketch edges has tag that is 'semi-persistent'
  2. ... the tag is persistent even you delete edges in sketch, so you can trace with python;
  3. ... unfortunately, the tags are not persistent over each file open (they are 're-assign' on every document restore);
  4. ... I remember, with abdullah / realthundar's help, I can mock-up with some python code to trace and restore the tags ... so 'dependent sketch' has no problem 'referencing' 'Master Sketch' but it is very convoluted...
  5. abdullah / realthundar did not recommended users to implement workaround through SketchPython remarking that should be 'fixed internally' like Assembly 3 branch

    Hope there are other workflow solving this problem / maybe other better 'workaround' solutions :)
Thanks for all these solutions! Since my sketches are fairly simple at this point, I ended up rebuilding them, but it is good to know about all the possible solutions. Will certainly be bookmarking this for later on :)
chrisb wrote: Sun Jul 14, 2019 4:46 pm In this case you can use the Sketch validation tool and remove all references to external geometry. Then enter the Sketch and remove the external geometries if they still exist. After that you should be able to add references to externals again.
Thanks for making me aware of the sketch validation tool. I use it all the time now.
Post Reply