feature: general initial value and body source, to be tested

About the development of the FEM module/workbench.

Moderator: bernd

qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: feature: general initial value and body source, to be tested

Post by qingfeng.xia »

that is silly error, should be x- y- z-component.
I also have another way to input vector, just as C++ constraint type (direction + mag), I have not fully tested, could be added in the future
bernd wrote: Sun Feb 23, 2020 3:36 pm https://github.com/berndhahnebach/FreeC ... get.py#L96

Code: Select all

            self.componentLabels = ["x-component", "x-component", "x-component"]
Why three times x-component?
Last edited by qingfeng.xia on Mon Feb 24, 2020 11:22 pm, edited 1 time in total.
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: feature: general initial value and body source, to be tested

Post by qingfeng.xia »

bernd wrote: Mon Feb 24, 2020 8:55 pm IMHO it shoudl be named FemConstraintGeneric instead FemGenericConstraint

It should be easy to just do find and replacement. I will do it later.
I am stuck on the json serialization error.
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: feature: general initial value and body source, to be tested

Post by qingfeng.xia »

bernd wrote: Mon Feb 24, 2020 8:55 pm IMHO it shoudl be named FemConstraintGeneric instead FemGenericConstraint

A new PR has been sent to your fembodyconstraint branch. I pull your branch on Tuesday, it still show merge conflict, not sure why.

1. Class rename
2. Json serializable error fixed
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: feature: general initial value and body source, to be tested

Post by bernd »

great, nevermind about the merge conflict ...
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: feature: general initial value and body source, to be tested

Post by bernd »

qingfeng.xia wrote: Sat Feb 29, 2020 9:46 pm 2. Json serializable error fixed
which part of the code does fix this erro ? I run into the same problem https://forum.freecadweb.org/viewtopic.php?f=18&t=44021
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: feature: general initial value and body source, to be tested

Post by bernd »

merged your code and did myself some code formating and renaming to fit all generic constraint code in FEM code conventions. https://github.com/berndhahnebach/FreeC ... 5bb5176d65 in branch https://github.com/berndhahnebach/FreeC ... constraint

The Json serializable error still resists ... :(


https://github.com/FreeCAD/FreeCAD/comp ... 5bb5176d65 (all changes so far)
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: feature: general initial value and body source, to be tested

Post by bernd »

qingfeng.xia wrote: Sat Feb 29, 2020 9:46 pm 2. Json serializable error
see here for more information https://forum.freecadweb.org/viewtopic.php?f=18&t=44021
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: feature: general initial value and body source, to be tested

Post by bernd »

qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: feature: general initial value and body source, to be tested

Post by qingfeng.xia »

add those 2 dumb functions to viewprovider class, in addition to _FemConstraintGeneric.py class. It fixed json error for me.
This solution is aslo form FreeCAD forum.https://forum.freecadweb.org/viewtopic. ... 94#p373094

src/Mod/Fem/femguiobjects/_ViewProviderFemGenericConstraint.py

Code: Select all

    def __getstate__(self):
        return None

    def __setstate__(self,state):
        return None
I read your latest branch, you have deleted those 3 functions from _FemConstraintGeneric.py

Code: Select all

    def execute(self, obj):
        ''' Called on document recompute '''
        return

    def __getstate__(self):
        # Called during document saving
        return self.Type

    def __setstate__(self, state):
        if state:
            self.Type = state
Those 3 functions should be taken back. and also some comment to protect those dumb functions , not to be deleted in the future.


bernd wrote: Tue Mar 10, 2020 9:15 am
The Json serializable error still resists ... :(

https://github.com/FreeCAD/FreeCAD/comp ... 5bb5176d65 (all changes so far)
Last edited by qingfeng.xia on Thu Mar 12, 2020 1:00 pm, edited 1 time in total.
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: feature: general initial value and body source, to be tested

Post by bernd »

no they need not! Everything should work fine so far! They where missing in the superclass!

Would you give it a try?
Post Reply