Cyclic reference to and Still touched after recompute

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
bgma1961
Posts: 107
Joined: Mon Apr 02, 2018 9:19 am

Cyclic reference to and Still touched after recompute

Post by bgma1961 »

Hello,

I have some issues with Arch WB,

1. When I enter <<Wall030>> .Height in the "Formula Editor" for Wall032 it says "Cyclic reference to _ # Wall030".
I made a list of properties that have been changed to get an overview.
Would be handy if there is somewhere you can pick it up from.

Main.png
Main.png (104.41 KiB) Viewed 1363 times
3.FCStd
(30.95 KiB) Downloaded 27 times
Cyclic reference to _#Wall030.png
Cyclic reference to _#Wall030.png (4.52 KiB) Viewed 1363 times
Property wall.png
Property wall.png (4.52 KiB) Viewed 1363 times

Code: Select all

   Wall030.Height = 100,000 mm
    Line033.End.x = <<Rectangle005>> .Placement.Base.x + <<Rectangle005>> .Length
    Line033.End.y = .Start.y
    Line033.Start.x = Line034.End.x
    Line033.Start.y = Line034.Start.y

   Wall031.Height = <<Wall030>> .Height
    Line034.End.x = 6179.150 mm
    Line034.End.y = .Start.y
    Line034.Start.x = Line036.Start.x
    Line034.Start.y = 10,820 m

 * Wall032.Height = "Cyclic reference to _ # Wall030".
    Line035.End.x = <<Rectangle004>> .Length + <<Rectangle004>> .Placement.Base.x
    Line035.End.y = .Start.y
    Line035.Start.x = <<Spreadsheet>> .BEWW
    Line035.Start.y = <<Rectangle004>> .Placement.Base.y

   Wall033.Height = <<Wall030>> .Height
   Wall033.Width = <<Rectangle004>> .Length - <<Rectangle>> .Length - 36mm
    Line036.End.x = .Start.x
 * Line036.End.y = <<Rectangle004>> .Placement.Base.y - <<Wall032>> .Width
    Line036.Start.x = <<Rectangle>> .Placement.Base.x + <<Rectangle004>> .Length
    Line036.Start.y = <<Rectangle>> .Placement.Base.y

 * If I delete "- <<Wall032>> .Width" from Line036.End.y it works.
   I do not see that this should make it not work. BUG?

   Rectangle.Placement.Position.x = <<Spreadsheet>> .BEWW
   Rectangle.Placement.Position.y = 8482,000 mm
   
   Rectangle004.Placement.Position.x = <<Spreadsheet>> .BEWW
   Rectangle004.Placement.Position.y = <<Spreadsheet>> .Wp1y - Height / mm - <<Spreadsheet>> .BEWW
   Rectangle004.Height = 2316,000 mm
   
   Rectangle005.Placement.Position.x = <<Spreadsheet>> .BEWW
   Rectangle005.Placement.Position.y = <<Spreadsheet>> .Wp1y - Height / mm - <<Spreadsheet>> .BEWW
   Rectangle005.Height = 2814,000 mm

Next problem is when I select "Recompute" I get the message "Still touched after recompute"
Still touched after recompute.png
Still touched after recompute.png (6.16 KiB) Viewed 1363 times

/ Best Regards Bengt-Göran
--------------------------------------------------------

Code: Select all

OS: Windows 7 SP 1 (6.1)
Word size of FreeCAD: 64-bit
Version: 0.20.28193 (Git)
Build type: Release
Python 3.8.12, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: C/Default (C)
--------------------------------------------------------
User avatar
Roy_043
Veteran
Posts: 8552
Joined: Thu Dec 27, 2018 12:28 pm

Re: Cyclic reference to and Still touched after recompute

Post by Roy_043 »

I just found out today that there is a function that can help in such cases.
https://forum.freecadweb.org/viewtopic.php?f=17&t=42183#p357959 wrote:another more important function href(arg), which hides any object reference inside the argument to work around cyclic dependency error. You need to be careful when using href() as it may give unexpected result. As a rule of thumb, it will be safe if href() is refering (directly or indirectly) to some property that will only be changed by user instead of calculated by the object (e.g. with other expressions).
After applying this function in the expressions used to define the start and end points of Line033 and Line036, I can use <<Wall030>>.Height for Wall032. I do not know why it works.
Attachments
3-href.FCStd
(31.15 KiB) Downloaded 21 times
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: Cyclic reference to and Still touched after recompute

Post by chrisb »

If you want to solve this in a less risky way, you can use a new object which is references by both af these objects, e.g. by using a DynamicData or a spreadsheet object.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: Cyclic reference to and Still touched after recompute

Post by chrisb »

Do you know the Dependency Graph? Have a look at it, and decide if it is really a good idea to use these references or if you can identify things in your model which allow a more hierarchical structure.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
bgma1961
Posts: 107
Joined: Mon Apr 02, 2018 9:19 am

Re: Cyclic reference to and Still touched after recompute

Post by bgma1961 »

chrisb wrote: Sun Mar 27, 2022 7:28 pm Do you know the Dependency Graph? Have a look at it, and decide if it is really a good idea to use these references or if you can identify things in your model which allow a more hierarchical structure.
Because I do not have access to all measurements and they cannot be measured, it must be calculated, which means that I have to draw in a way that means that I do not have to redraw everything because, for example, a wall ends up in another place.

This little drawing is not the whole "truth"

I have tried to use "Dependency Graph" but it is so messy that it is not useful.
Could not create PDF or print page, so I tried to attach .FCStd-file but it is too large. ( 4 603 KB)
Attachments
KV.png
KV.png (65.65 KiB) Viewed 1195 times
bgma1961
Posts: 107
Joined: Mon Apr 02, 2018 9:19 am

Re: Cyclic reference to and Still touched after recompute

Post by bgma1961 »

Roy_043 wrote: Sun Mar 27, 2022 6:54 pm I just found out today that there is a function that can help in such cases.
https://forum.freecadweb.org/viewtopic.php?f=17&t=42183#p357959 wrote:another more important function href(arg), which hides any object reference inside the argument to work around cyclic dependency error. You need to be careful when using href() as it may give unexpected result. As a rule of thumb, it will be safe if href() is refering (directly or indirectly) to some property that will only be changed by user instead of calculated by the object (e.g. with other expressions).
After applying this function in the expressions used to define the start and end points of Line033 and Line036, I can use <<Wall030>>.Height for Wall032. I do not know why it works.
if there is no drawback to href () why is it not the default? But it seems to work.
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: Cyclic reference to and Still touched after recompute

Post by chrisb »

bgma1961 wrote: Mon Mar 28, 2022 12:43 am if there is no drawback to href () why is it not the default? But it seems to work.
There is a drawback: you have to assure on your own, that no cyclic references occur. The current check is a sufficient condition on the object level, but it is not a necessary one.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
bgma1961
Posts: 107
Joined: Mon Apr 02, 2018 9:19 am

Re: Cyclic reference to and Still touched after recompute

Post by bgma1961 »

Hello,

I still have problems with "Still touched after recompute" even though I use href ().
It seems like .Start.xyz and .End.xyz are involved in this issue.
If I enter .Start.x in End.x, I get "Still ..." if I write the same value, "Still ..." disappears.
This does not always happen but sometimes .Start.xyz works.

/Best Regards BG

Code: Select all

OS: Windows 7 SP 1 (6.1)
Word size of FreeCAD: 64-bit
Version: 0.20.28671 (Git)
Build type: Release
Python 3.8.13, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: Swedish/Sweden (sv_SE)
Post Reply