Work Feature workbench with parametric objects

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: Work Feature workbench with parametric objects

Post by rentlau_64 »

Hello all

I need Help to find a manner to reference my "CenterLinePoint" Object to a "BaseFeature" (if selected)

my code is :

Code: Select all

class CenterLinePoint(WF_Point):
    """ The CenterLinePoint feature object. """
    # this method is mandatory
    def __init__(self,selfobj):
        self.name = "CenterLinePoint"
        WF_Point.__init__(self, selfobj, self.name)
        """ Add some custom properties to our CenterLinePoint feature object. """
        selfobj.addProperty("App::PropertyLinkSub","Edge",self.name,
                            "Input edge")   
        selfobj.addProperty("App::PropertyInteger","NumberLinePart",self.name,
                            "The number of parts of parent segment !").NumberLinePart=2
        selfobj.addProperty("App::PropertyInteger","IndexPart",self.name,
                            "The location of the point : 1/2 means middle of the segment !").IndexPart=1        
        
        selfobj.setEditorMode("Edge", 1)
        selfobj.Proxy = self    
     
    # this method is mandatory   
    def execute(self,selfobj):
    	...
And I get an error : "Link go out of the allowed scope" for the "CenterLinePoint" Object created.

Hereafter an illustration
LinkToBaseFeature.png
LinkToBaseFeature.png (306.86 KiB) Viewed 4104 times
OS: Ubuntu 17.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13142 (Git)
Build type: None
Branch: master
Hash: b0928342309511026e713d1f4e26be65b5b297dc
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: French/France (fr_FR)

Thank you for your help

Rentlau
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Work Feature workbench with parametric objects

Post by realthunder »

rentlau_64 wrote: Sun Mar 04, 2018 9:03 am Hello all

I need Help to find a manner to reference my "CenterLinePoint" Object to a "BaseFeature" (if selected)
Assuming you are not creating any cyclic references, simply change your PropertyLinkSub to PropertyLinkSubGlobal shall work. The reason for this message is because Body, being derived from geo feature group, demands all objects that reference its children being added to the group, too. So, by right, your CenterLinePoint object should be added to the Body (or App::Part) as well. You can use Global links to bypass that requirement.

On the other hand, you should realize that if you link to a children of a body without adding your object to the body as well, you'll have trouble getting the actual coordinate of the object.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: Work Feature workbench with parametric objects

Post by rentlau_64 »

Hi,

A new release is on line...
github :https://github.com/Rentlau/WorkFeature-WB


realthunder » Wed Mar 07, 2018 11:15 pm
Assuming you are not creating any cyclic references, simply change your PropertyLinkSub to PropertyLinkSubGlobal shall work. The reason for this message is because Body, being derived from geo feature group, demands all objects that reference its children being added to the group, too. So, by right, your CenterLinePoint object should be added to the Body (or App::Part) as well. You can use Global links to bypass that requirement.

On the other hand, you should realize that if you link to a children of a body without adding your object to the body as well, you'll have trouble getting the actual coordinate of the object.
Thank very much you I will use this info for next release.

Rentlau
Last edited by rentlau_64 on Thu Mar 08, 2018 6:29 pm, edited 1 time in total.
User avatar
bill
Posts: 376
Joined: Fri Jan 09, 2015 9:25 pm

Re: Work Feature workbench with parametric objects

Post by bill »

rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: Work Feature workbench with parametric objects

Post by rentlau_64 »

Hello,
Is there any value to add this workbench to /FreeCAD-addons ?

If yes feel free to do, i will be very please. :D :D

Rentlau_64
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Work Feature workbench with parametric objects

Post by triplus »

Best place to request for Work Feature workbench to be added is here:

https://github.com/FreeCAD/FreeCAD-addons/issues
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: Work Feature workbench with parametric objects

Post by rentlau_64 »

Triplus,
Thank you the request is done.
Rentlau_64
User avatar
HarryGeier
Veteran
Posts: 1231
Joined: Mon Jul 10, 2017 12:36 pm
Location: Hof Germany

Re: Work Feature workbench with parametric objects

Post by HarryGeier »

rentlau_64 wrote: Thu Mar 08, 2018 9:38 pm Triplus,
Thank you the request is done.
Rentlau_64
Is it supposed to work in .17 now.. here still no luck.. cannot refer to the created elements, They are not in the active body, nor can i move them into it...
Kaum macht man´s richtig , gehts´s
My Video Tutorials on Youtube: https://www.youtube.com/channel/UCoe3B ... p8Q/videos
My FreeCAD Stuff on Hidrive: https://my.hidrive.com/share/qr3l1yddy6#$/
User avatar
bill
Posts: 376
Joined: Fri Jan 09, 2015 9:25 pm

Re: Work Feature workbench with parametric objects

Post by bill »

I installed and see only this: :?

WF_WB.png
WF_WB.png (37.9 KiB) Viewed 3930 times

Should I be seeing all the FUNCTIONs of the old WF-macro ?
Selecting in the WB-mode will be nicer than the cramped panel-mode!

I am using FC-Daily: Git version 13375; just FYI!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Work Feature workbench with parametric objects

Post by triplus »

rentlau_64 wrote: Thu Mar 08, 2018 9:38 pm Triplus,
Thank you the request is done.
Rentlau_64
Great. Note that is could take a few days.
HarryGeier wrote: Thu Mar 08, 2018 10:19 pm Is it supposed to work in .17 now.. here still no luck.. cannot refer to the created elements, They are not in the active body, nor can i move them into it...
Likely this wasn't tackled yet in Work Feature workbench. In addition i feel that some general guidelines or/and discussion about this area is still missing and will need to happen in the future.
bill wrote: Thu Mar 08, 2018 10:23 pm Should I be seeing all the FUNCTIONs of the old WF-macro ?
I bit of patience will likely be needed to get to that goal. ;)
Selecting in the WB-mode will be nicer than the cramped panel-mode!
Both approaches have some pros and cons. Workbench approach for example should for one improve the customization potential. More standard workflow and install and usage experience is expected too. Parametric objects ...
Post Reply