Fem constraint contact

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
bernd
Posts: 6872
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Fem constraint contact

Postby bernd » Wed Jan 16, 2019 7:00 pm

the code still still has quite some pep8 code formatting issues ...

try on a linux machine ...

Code: Select all

find src/Mod/Fem/ -name "*\.py" | grep -v convert2TetGen.py | grep -v InitGui.py | grep -v TestFem.py | xargs -I [] flake8 --ignore=E266,E402,E722,W503 --max-line-length=200 []
User avatar
bernd
Posts: 6872
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Fem constraint contact

Postby bernd » Wed Jan 16, 2019 8:22 pm

for the cube example I get a exception ...

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 56, in _wrapfunc
    return getattr(obj, method)(*args, **kwds)
TypeError: Partition index must be integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femguiobjects/_ViewProviderFemConstraintAutoContact.py", line 136, in add_contact
    femutils.AddAutoContact(self.slope,self.friction,self.facenum)
  File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femtools/femutils.py", line 308, in AddAutoContact
    results = np.array(get_all_close_surfaces(locations,num))
  File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femtools/femutils.py", line 197, in get_all_close_surfaces
    store.append(find_index_of_nearest(array, i, num))    
  File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femtools/femutils.py", line 188, in find_index_of_nearest
    idxmin = np.argpartition(np.array(distance), num)
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 808, in argpartition
    return _wrapfunc(a, 'argpartition', kth, axis=axis, kind=kind, order=order)
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 66, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py", line 46, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
TypeError: Partition index must be integer
makkemal
Posts: 379
Joined: Wed Apr 29, 2015 12:41 pm

Re: Fem constraint contact

Postby makkemal » Fri Jan 18, 2019 9:14 am

Sorry about the Flake8 formatting errors somehow the auto formatting in my pydev got disabled.
That is fixed now
https://github.com/makkemal/FreeCAD.git

Code: Select all

Freecad/FreeCAD$ find src/Mod/Fem/ -name "*\.py" | grep -v convert2TetGen.py | grep -v InitGui.py | grep -v TestFem.py | xargs -I [] flake8 --ignore=E266,E402,E722,W503 --max-line-length=200 []
src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintAutoContact.py:36:1: F401 '_FemConstraintAutoContact' imported but unused
My test prob still run without errors, you just have to be sure analysis is active files attached again.
I also tested on windows machine

Code: Select all

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15652 +2 (Git)
Build type: Release
Branch: femautocontact
Hash: cd70f86543101b6440f65ce82fc14e88daca778e
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/SouthAfrica (en_ZA)
Now why do you get that error ?
Attachments
contact_test2.FCStd
(9.07 KiB) Downloaded 2 times
contact_test.FCStd
(10.47 KiB) Downloaded 1 time
User avatar
bernd
Posts: 6872
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Fem constraint contact

Postby bernd » Fri Jan 18, 2019 11:16 am

great ... https://github.com/makkemal/FreeCAD/com ... utocontact

I will give it a try. It might be because I'm on Py3 already. I will fix the problem in this regard then ...

bernd
User avatar
bernd
Posts: 6872
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Fem constraint contact

Postby bernd » Fri Feb 08, 2019 9:58 am

there is a nice real example for this auto contact utility: https://forum.freecadweb.org/viewtopic.php?f=18&t=34052