Friday, October 29, 2010

Well, it's been quite a long since I posted anything (obviously). I've been busy trying to learn a bit of C++ coding, in my quest to learn the ins and outs of HeeksCAD,HeeksCNC, and HeeksPython.
I am mostly doing the 'learn by example' route, plus a few good tutorials, books, and some very helpful advice from Dan Heeks himself. If I get into a bind, he usually can point to some example code that helps me understand things.
I have been able to add quite a few new functions to HeeksPython and a few things to HeeksCAD itself. HeeksPython is fun to add functions to, because there is a lot of 'low hanging fruit' so to speak. It's pretty easy to add a python binding to HeeksCAD, if there is already a C++ function in /interface/HeeksCADInterface.cpp . I started out by copying jonpry's existing functions ('NewArc', 'NewLine' etc). As I have gotten a little more experience, I have gotten more adventurous and added functions for deriving point data from the GraphicsCanvas itself. I also found a way of adding fillets to pairs of 2D lines. Over the last month, I have added ways of creating a new coordinate system,returning the parameters of coordinate systems,text,and a way of importing dxf files from python.
The HeeksPython function 'importdxf' is exiting for me because I have plans for creating solids quickly with the aid of other 2D cad programs like caduntu , qcad, or even true-type-tracer-dxf. Having HeeksPython loaded with functionality will help automate the design process somewhat.
Here is an example of a script that uses true-type-tracer-dxf to create some text on the HeeksCAD graphics screen:

import os
import HeeksPython as cad

path = '''/home/dan/Documents/drawings/ttt/'''
program = '''truetype-tracer-dxf'''
phrase = ''' \' this is a test \' '''
pipe = ''' > '''
file = '''aphrase.dxf'''

out = program + phrase + pipe + path + file

f = path + file