[solved] LinkTransform creates link at the wrong position

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!
User avatar
uwestoehr
Posts: 2144
Joined: Sun Jan 27, 2019 3:21 am

[solved] LinkTransform creates link at the wrong position

Post by uwestoehr » Sun Nov 22, 2020 10:39 pm

I have a sphere primitive that I would like to create a link for. Since the link should be at the same position than the sphere, I
1. create a link
2. then I set in the "LinkTransform" to "true"

But then the link is still not at the same position than the original:
FreeCAD_7sAopfbHJF.png
screenshot of the result
FreeCAD_7sAopfbHJF.png (49.56 KiB) Viewed 255 times
Testfile:
Link-bug.FCStd
testfile
(12.58 KiB) Downloaded 7 times

Do I make a mistake or is there an issue?

realthunder wrote: .
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23057 (Git)
Build type: Release
Branch: master
Hash: e2b58bf3d52e4f9b5eea8885d95e4a255d072ea2
Python version: 3.6.8
Qt version: 5.12.6
Coin version: 4.0.0a
OCC version: 7.4.0.beta
Locale: German/Germany (de_DE)
Last edited by uwestoehr on Wed Nov 25, 2020 6:04 pm, edited 1 time in total.
User avatar
Roy_043
Posts: 2355
Joined: Thu Dec 27, 2018 12:28 pm

Re: LinkTransform creates link at the wrong position

Post by Roy_043 » Mon Nov 23, 2020 10:08 am

The LinkTransform works correctly I would say, but it does not take account of the 'final' global placement of the source object, which in the example is also determined by the placement of the Std_Part it is nested in.
User avatar
papyblaise
Posts: 2865
Joined: Thu Jun 13, 2019 4:28 pm
Location: France

Re: LinkTransform creates link at the wrong position

Post by papyblaise » Mon Nov 23, 2020 10:22 am

the error was to create a Part (yellow staircase) instead of a Body (blue staircase)
jmaustpc
Posts: 10524
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: LinkTransform creates link at the wrong position

Post by jmaustpc » Mon Nov 23, 2020 10:45 am

papyblaise wrote:
Mon Nov 23, 2020 10:22 am
the error was to create a Part (yellow staircase) instead of a Body (blue staircase)
that comment is total rubbish.

uwestoehr has a lot of FreeCAD knowledge.
jmaustpc
Posts: 10524
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: LinkTransform creates link at the wrong position

Post by jmaustpc » Mon Nov 23, 2020 11:12 am

uwestoehr wrote:
Sun Nov 22, 2020 10:39 pm
I have a sphere primitive that I would like to create a link for. Since the link should be at the same position than the sphere, I
1. create a link
2. then I set in the "LinkTransform" to "true"

But then the link is still not at the same position than the original:
My understanding is that the position is correct it's just that the link follows relative to the Part container it is placed in or if not in one then global axis system.

This makes sense when you think about a typical use case. Lets say you have a bolt that holds two objects together in two different part containers, if the bolt goes through object B into a hole in object A in both cases, but in the second Part Container Object B is a different shape so its actually object C, but in both cases the Bolt is wanted to be in the same location relative to their Part Container since the hole in object A is the same, but not the same location relative to the global axis system. Because perhaps one Part container goes on the left of something but the second Part Contain goes on the right. Does that make sense?

In your example that is what has happened. The difference in Global position is due to the -4mm Z placement of the "Part" container.
jmaustpc
Posts: 10524
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: LinkTransform creates link at the wrong position

Post by jmaustpc » Mon Nov 23, 2020 11:31 am

jmaustpc wrote:
Mon Nov 23, 2020 11:12 am
My understanding is that the position is correct it's just that the link follows relative to the Part container
I just check to confirm that it is placement relative to the Part container and not only it's offset from attachment.

This file is a modified version of yours, I put your link sphere in another Part, adjusted the second Part z to the same -4mm and the spheres were overlapping perfectly as expected.

Then I added the cube, and changed your original sphere's attachment to a vertex of that cube which moved it 10mm back, the link sphere in the second Part container (Part001) also moved the 10mm so that it still perfectly overlaps. This demonstrates that Link is following placement of the original object relative to the original objects Part container , and if the link output object is not in a Part container then its placement is relative to the Global axis system. When the link object is moved into a new Part container it automatically applies it's placement relative to that new Part container.

No doubt realthunder will advise if I have miss understood something. :) But If my understanding is correct then this is intended behaviour.

Jim
jmaustpc
Posts: 10524
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: LinkTransform creates link at the wrong position

Post by jmaustpc » Mon Nov 23, 2020 11:46 am

Whoops, I forgot to attach the file. I had to go outside and check on my newborn kids, as in goats not humans! :-) It's night here and its rained and cold, well wet hence make them cold, not cold compared to many of you guys. The mummy goat was cleaver, she found a nice warm dry spot under a shelter I had in the paddock, what a good first time mum. :)
Link-bug2.FCStd
(16.39 KiB) Downloaded 4 times
User avatar
uwestoehr
Posts: 2144
Joined: Sun Jan 27, 2019 3:21 am

Re: LinkTransform creates link at the wrong position

Post by uwestoehr » Mon Nov 23, 2020 2:11 pm

jmaustpc wrote:
Mon Nov 23, 2020 11:31 am
No doubt realthunder will advise if I have miss understood something. :) But If my understanding is correct then this is intended behaviour.
But then I have a problem. My use case is this: I work a lot with assembly 4 files. They work this way that the different parts are put into a Std_Part container as links. I need to link these links to transform them further. I can and also will not make a link also to the Std_Part container, I only want a link to some of the parts in the assembly. I need these links to appear exactly at the same position as they are shown in the model.

@realthunder, do you see a way to extend the LinkTransform setting so that also links to objects in App::Part will appear at the same position? If not, what do you propose I should do instead?
User avatar
uwestoehr
Posts: 2144
Joined: Sun Jan 27, 2019 3:21 am

Re: LinkTransform creates link at the wrong position

Post by uwestoehr » Mon Nov 23, 2020 2:16 pm

uwestoehr wrote:
Mon Nov 23, 2020 2:11 pm
@realthunder, do you see a way to extend the LinkTransform setting so that also links to objects in App::Part will appear at the same position? I
I think an additional option "preserve global position" could be added. When used, it ass the placement of the App::Part container to the transformed link.
User avatar
Roy_043
Posts: 2355
Joined: Thu Dec 27, 2018 12:28 pm

Re: LinkTransform creates link at the wrong position

Post by Roy_043 » Wed Nov 25, 2020 2:41 pm

uwestoehr wrote:
Mon Nov 23, 2020 2:16 pm
I think an additional option...
If you create a sub-link (Std_LinkMakeRelative) instead of a 'normal' link (Std_LinkMake) the link will follow the 'final' global position. So what you want is already possible.
See video (T=14:05): https://github.com/realthunder/FreeCAD_ ... /wiki/Link
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 10 guests