CGX in FreeCAD little code
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Re: CGX in FreeCAD little code
Hmm... so if cgx is right, we're plain wrong...
-
- Posts: 107
- Joined: Tue Feb 10, 2015 12:33 pm
- Location: General Pacheco (Buenos Aires) - Argentina
- Contact:
Re: CGX in FreeCAD little code
Even comparing CGX/Abaqus is different! I will try to run the same model/mesh/bc/material in Abaqus. I know that Abaqus for postprocesing use some kind of averaging, but I'm not sure if CGX use the same procedure to show the stress.
Regards
PD: My father is an oldschool watchmaker, and he told me... Sergio, if you have a clock, you'll be certain about the hour, but if you have two clocks... forget it
Regards
PD: My father is an oldschool watchmaker, and he told me... Sergio, if you have a clock, you'll be certain about the hour, but if you have two clocks... forget it
Engineering Consultor at 4P Ingeniería
http://www.4p-ingenieria.com/
https://www.youtube.com/channel/UClZPfO ... Cx-_J36o_Q
http://www.4p-ingenieria.com/
https://www.youtube.com/channel/UClZPfO ... Cx-_J36o_Q
Re: CGX in FreeCAD little code
@sergu:
What cgx do you use, or where did you get the windows binary from? I'm just not able to open cgx directly with an frd file on Windows. I have to use SciTE first
What cgx do you use, or where did you get the windows binary from? I'm just not able to open cgx directly with an frd file on Windows. I have to use SciTE first
-
- Posts: 107
- Joined: Tue Feb 10, 2015 12:33 pm
- Location: General Pacheco (Buenos Aires) - Argentina
- Contact:
Re: CGX in FreeCAD little code
I'm using the last available from bConverged:
CalculiX_2_8_win_003.zip CalculiX for Windows 2.8, build 003 (60,352 kb) Posted 19 May 2015. This build includes CCX 2.8p2 (32 and 64 bit, both multi-thread), CGX 2.6.1, compiled help file, test cases and two CAD translation tools (VDA and ACIS to FBD).
In the old version of the macro (that's open inp file in Scite), I have changed the file association in Windows for the .inp files to be opened by cgx by default and then it can be opened also in this way (problem is that in file explorer you want to edit an inp file you must use the option "open with" than the direct double clic.
Regards
PD: I have checked that I'm not opening the frd files directly with cgx.exe, I'm using an cgx.bat included in the bConverged distribution. The text of this bat files is
CalculiX_2_8_win_003.zip CalculiX for Windows 2.8, build 003 (60,352 kb) Posted 19 May 2015. This build includes CCX 2.8p2 (32 and 64 bit, both multi-thread), CGX 2.6.1, compiled help file, test cases and two CAD translation tools (VDA and ACIS to FBD).
In the old version of the macro (that's open inp file in Scite), I have changed the file association in Windows for the .inp files to be opened by cgx by default and then it can be opened also in this way (problem is that in file explorer you want to edit an inp file you must use the option "open with" than the direct double clic.
Regards
PD: I have checked that I'm not opening the frd files directly with cgx.exe, I'm using an cgx.bat included in the bConverged distribution. The text of this bat files is
Code: Select all
@echo off
C:\PROGRA~2\BCONVE~1\common\site\cmdStartup.bat cgx %*
Engineering Consultor at 4P Ingeniería
http://www.4p-ingenieria.com/
https://www.youtube.com/channel/UClZPfO ... Cx-_J36o_Q
http://www.4p-ingenieria.com/
https://www.youtube.com/channel/UClZPfO ... Cx-_J36o_Q
Re: CGX in FreeCAD little code
Hi,First thank you all for improving the code.
In this new version of CGX Macro for FreeCAD, you can use both applications at the same time. youtube video: https://youtu.be/2G0wUsqlwOY
Regards.
Sorry for my bad english.
In this new version of CGX Macro for FreeCAD, you can use both applications at the same time. youtube video: https://youtu.be/2G0wUsqlwOY
Regards.
Sorry for my bad english.
Code: Select all
## CGX PostProccesing in FreeCAD
########### CONFIGURATION (Linux) ######
cgx_bin = '/usr/bin/cgx ' # CGX binary
########### START MACRO #############
# Linux --> cgx command --> cgx
# Windows --> SciTE is installed and *.inp opens with SciTE
import FreeCADGui
import FreeCAD
from PySide import QtCore, QtGui
selection = FreeCADGui.Selection.getSelection()
if len(selection) == 1:
sel = selection[0]
# print '\nSelected Object: ' ,sel.Name
if hasattr(sel,"Proxy") and sel.Proxy.Type == 'FemAnalysis':
# print sel.Name
analysis = sel
for m in FreeCAD.activeDocument().MechanicalAnalysis.Member:
if m.isDerivedFrom("Fem::FemMeshObject"):
filename = m.Name
break
else: # for loop runs through all members but no mesh found
print 'No Mesh --> No Output'
fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
ccxoutputdir = fem_prefs.GetString("WorkingDir", '')
filename = ccxoutputdir + '/' + filename + '.frd'
print filename
from platform import system
if system() == "Linux":
cgxcommand =cgx_bin +' -v ' + filename
print cgxcommand
#import subprocess
process = QtCore.QProcess()
try:
process = QtCore.QProcess()
process.startDetached(cgxcommand)
FreeCAD.Console.PrintMessage('Running '+ cgxcommand)
except:
FreeCAD.Console.PrintError('Error!!, sorry..')
QtGui.QMessageBox.critical(None,'Error','Error!!, Sorry.Please report the error in the FreeCAD forum',QtGui.QMessageBox.Abort)
elif system() == "Windows":
# the webbrowser.open() does not work directly on *.frd --> *.inp are used to open SciTE
# in windows inp-file extension has to be assigned to open SciTE on double click (works if SciTE is installed)
# The OutputDir of the MechanicalAnalysis should left blank --> C:/tmp is used
print 'In SciTE --> Menue Tools --> Post Process or Shift+F10'
QtGui.QMessageBox.information(None,'Information','In SciTE --> Menue Tools --> Post Process or Shift+F10',QtGui.QMessageBox.Abort)
import webbrowser
webbrowser.open(filename)
else:
print "Your OS is ", system(), ", which is not yet supported !"
QtGui.QMessageBox.critical(None,'Error',"Your OS is ", system(), ", which is not yet supported !",QtGui.QMessageBox.Abort)
else:
print 'Select a MechanicalAnalysis Object'
QtGui.QMessageBox.information(None,'Information','Select a MechanicalAnalysis Object',QtGui.QMessageBox.Abort)
else:
print 'Select one MechanicalAnalysis Object'
QtGui.QMessageBox.information(None,'Information','Select a MechanicalAnalysis Object',QtGui.QMessageBox.Abort)
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
Scope Ingenieria (scopeingenieria.com)
Re: CGX in FreeCAD little code
New version.
- The macro and any updates will be staying at my github account:
https://github.com/psicofil/Macros_Free ... EM.FCMacro
- Now the macro displays the results of the active mechanical analysis Regards
Sorry for my bad English
- The macro and any updates will be staying at my github account:
https://github.com/psicofil/Macros_Free ... EM.FCMacro
- Now the macro displays the results of the active mechanical analysis Regards
Sorry for my bad English
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
Scope Ingenieria (scopeingenieria.com)
Re: CGX in FreeCAD little code
New updates in this macro:
- Correction in the error difference between working folder
- Support xterm as CGX console commands (Linux - is optional)
- Support for Windows
Regards
- Correction in the error difference between working folder
- Support xterm as CGX console commands (Linux - is optional)
- Support for Windows
Regards
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
Scope Ingenieria (scopeingenieria.com)
Re: CGX in FreeCAD little code
Hey, I checked the youtube video and it got my interest, but when executing the macro it does nothing, I am using FreeCAD 0.16 for Windows10
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Re: CGX in FreeCAD little code
Have you read this post? https://forum.freecadweb.org/viewtopic.php?f=18&t=12212 It is highly recomended use FreeCAD 0.17.xxxxx version if you gone work with FEM
Re: CGX in FreeCAD little code
I tested this macro on this:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11792 (Git)
Build type: Release
Branch: master
Hash: 7aec98ffb66065854a66d6d6715845fdbf0869a7
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: German/Germany (de_DE)
No luck, like you
So i did some really crappy changes. For now it works (only) on win 10. See comments in source - Please just remove .txt extension and edit line 21 und 26 to suite your needs
- Save it in your macro folder.
- Ensure that ccx and cgx have same version, better are from same build!
Workflow:
- select 3D-FEM-example from FreeCAD start page
- activate Analysis
- start ccx to obtain a matching (new) .frd file
- start macro
- playing around 2 minutes in cgx
- realize that this is stuff from the 90's
- install paraview
- be happy