0

I am trying to build a 3D model using FreeCAD Python software to simulate heat transfer through a material. I am currently trying to create a mesh to simulate a homogenous cube just to make sure it all works. I need to download the FreeCAD module to make the line 'from FreeCAD import Base, newDocument' work. I have tried typing 'conda install FreeCAD' into my Terminal shell, but the response is that there are 'conflicts'. How else can the FreeCAD Python module be installed?

The ultimate goal is to produce a mesh that is in a format compatible with SfePy software.

Here is the code I am trying to run:

import sys

FREECADPATH = '/usr/lib/freecad/lib/'

sys.path.append(FREECADPATH)

from FreeCAD import Base, newDocument

import Part

import Draft

import ProfileLib.RegularPolygon as Poly

doc = newDocument()

box = doc.addObject("Part::Box", "myBox")

box.Height = 5

box.Length = 5

box.Width = 5

doc.recompute()

Part.export(box, 'box.step')

doc.saveAs('box.FCStd')

import MeshPart

mesh = doc.addObject("Mesh::Feature", "Mesh")

mesh.Mesh = MeshPart.meshFromShape(Shape=box.box, MaxLength=0.002)

mesh.Mesh.write("./cube.bdf", "NAS", "mesh")

Thanks in advance.

SSK
  • 3,444
  • 6
  • 32
  • 59
  • What do you mean "simulate?". You would want a GUI if you are using 3D modeling and stuff. – coderman1234 Mar 24 '21 at 14:06
  • The plan is to use SfePy to produce a heat map of a 3D object from a point source of heat. I was recommended to use SfePy and FreeCAD by my supervisor. –  Mar 24 '21 at 16:41

0 Answers0