Search found 102 matches

by foadsf
Wed Aug 22, 2018 3:24 pm
Forum: Help on using FreeCAD
Topic: Plotting vertex coordinates
Replies: 11
Views: 4759

Re: Plotting vertex coordinates

You could also use draft workbench:

Code: Select all


App.newDocument("new")

Gui.activateWorkbench("DraftWorkbench")
import Draft

for vertexNum, vertex in enumerate(vertices):
	p=Draft.makePoint(vertex[0],vertex[1],vertex[2])
	p.Label=str(vertexNum)

by foadsf
Wed Aug 22, 2018 1:33 pm
Forum: CfdOF / CFD
Topic: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?
Replies: 30
Views: 7213

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

thanks to this post I'm now able to import the vertices as tuples with

Code: Select all

r1 = re.search(r'vertices\s*\(\s*(.*)\s*\)', s, re.DOTALL)
vertices = [(float(v[0]),float(v[1]),float(v[2]))
        for v in re.findall(r'\(\s*([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\s*\)', r1.group(1))]

print(vertices)
by foadsf
Wed Aug 22, 2018 12:25 pm
Forum: CfdOF / CFD
Topic: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?
Replies: 30
Views: 7213

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

happy to see that you liked the idea.
I'm trying, but I'm no expert! a little bit of help here and here would be highly appreciated.
by foadsf
Wed Aug 22, 2018 11:03 am
Forum: CfdOF / CFD
Topic: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?
Replies: 30
Views: 7213

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

There is no mesh yet. The issue is that usually blockMesh is not able to compile the blockMeshDict files. visualisation helps to see the problems. So far I'm able to read the blockMeshDict file by: import os os.chdir(os.path.dirname(__file__)) with open("blockMeshDict", "r") as f...
by foadsf
Wed Aug 22, 2018 9:16 am
Forum: CfdOF / CFD
Topic: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?
Replies: 30
Views: 7213

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

First step we can implement a simple Python 2.7 script which reads the blockMeshDict file, looks for vertices keyword (which shouldn't be after // or in between /* ... */) and reads the list of tuples (x,y,z) in the parentheses after the keyword. Then creates points, for example in Draft workbench, ...
by foadsf
Wed Aug 22, 2018 6:22 am
Forum: CfdOF / CFD
Topic: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?
Replies: 30
Views: 7213

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Thanks. I did not know about the CFD section. The feature I'm requesting is to import and modify OpenFOAM's blockMeshDict as explained here.
by foadsf
Tue Aug 21, 2018 1:13 pm
Forum: Open discussion
Topic: Displaying labels next to the objects as texts
Replies: 0
Views: 1001

Displaying labels next to the objects as texts

Is there any option to display label of an object next to it? For example if I create some points in Draft workbench and assign some labels, I want to see those labels next to the points. Is this possible? P.S.1. I posted this question also here on Reddit P.S.2. Follow up on this issue here in Stack...
by foadsf
Tue Aug 21, 2018 12:07 pm
Forum: CfdOF / CFD
Topic: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?
Replies: 30
Views: 7213

feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Hello Everyone, Following this reddit post I was advised to ask feature request here in the forum. It would be great if we could have a plugin like CadQuery's module where on one panel we could edit the blockMeshDict source code and then update the view. And there could be a live preview option to r...
by foadsf
Thu Apr 13, 2017 3:00 pm
Forum: Python scripting and macros
Topic: FreeCAD does not execute the python script as expected
Replies: 11
Views: 4133

Re: FreeCAD does not execute the python script as expected

OK, I figured the problem out. you may see the correct macro here in this Github Gist explanation: Basically the solution is that when we want to run a Boolean operation on two existing objects we should not change their visibility to false (as the default GUI commands do). If we include those comma...
by foadsf
Thu Apr 13, 2017 2:13 pm
Forum: Python scripting and macros
Topic: FreeCAD does not execute the python script as expected
Replies: 11
Views: 4133

FreeCAD does not execute the python script as expected

I'm trying to learn FreeCAD python scripting. Basically I open the python console and do what I want to do in the GUI and then look into the python console to learn the commands. and then read the API for that specific task to learn the correct form of python commands. Things were going fine till I ...