Adding property to a Linked Object.

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Adding property to a Linked Object.

Post by keithsloan52 »

If I add a property to a Linked Object it updates the the Linked object with the Property, is there a way to add a property to the Link?
so that the the Link has the property?
User avatar
dprojects
Posts: 722
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Adding property to a Linked Object.

Post by dprojects »

It means you have broken FreeCAD version ;-) As I remember while I was setting textures via setTextures the linked object always inherited the texture. But the texture URL was stored as new custom property at main object.

Image

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Adding property to a Linked Object.

Post by keithsloan52 »

The property is added to the Object with

Code: Select all

obj.addProperty("App::PropertyString","PhysVol","GDML").PhysVol = name
And this property and value show up on the Linked Object
Image 06-07-2022 at 20.45.jpg
Image 06-07-2022 at 20.45.jpg (205.98 KiB) Viewed 555 times
edwilliams16
Veteran
Posts: 3179
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Adding property to a Linked Object.

Post by edwilliams16 »

So, the original and the links all have the same value for the new property - changing one changes all? Is there a way to have them possess their own independent values?
User avatar
dprojects
Posts: 722
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Adding property to a Linked Object.

Post by dprojects »

You can make Link to Link but... the Link still inherits from the base object. But if you remove the base object, the first Link will be broken, but the Link to Link now get the property ;-) this is probably bug but it works ;-)

Image

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

Re: Adding property to a Linked Object.

Post by paullee »

dprojects wrote: Wed Jul 06, 2022 8:18 pm You can make Link to Link but... the Link still inherits from the base object. But if you remove the base object, the first Link will be broken, but the Link to Link now get the property ;-) this is probably bug but it works ;-)

Image
To my understanding it should works - in a discussion with Realthunder about FeaturePython, a FP has a property X, add X to a Link of the FP, it become an 'independent' property for the Link itself.


Not sure where Realthunder originally discuss about that, below thread is about the feature to execute particular method() for a Link with 'independent properties values' in that Link. (This particular post is about a regression found earlier which Realthunder fixed already). Search for the post where it discuss how to add properties to Links.

[Link] of (Sketch)ObjectPython / Part FeaturePython lose its 'Proxy Methods' ?

Hope it helps :)
User avatar
dprojects
Posts: 722
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Adding property to a Linked Object.

Post by dprojects »

I think the LinkGroup and Link are the best features at FreeCAD so far. Single click and you can have realistic looking dowels or any other objects in place. And this works quick and is fully parametric, if you change base all dowels will change.

Image

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
Post Reply