Saturday, February 7, 2009

QCad 2.0.5 on Intel iMac OS X 10.4


Looking for a program to view and edit .dxf files on the Mac I stumbled upon QCad from Ribbonsoft. Now I can view and edit the BfB lasercut components .dxf files.

Compile QCad
Although the QCad source is under GPL, only demo versions are availabale as binary. So, compiled QCad from source. Follows the list and some links I used to get QCad compiled under OS X 10.4.11 with gcc-4.0 (and using a MacPorts QT3 installation, present from previous MacPort installed sw)


### install QT3 package with MacPorts. I assume you are familiar with MacPorts and have it installed
$ ssh -l yourAdminUser localhost ## I use this to logon as admin from within a ordinary user terminal session
$ sudo port selfupdate
$ sudo port install qt3
...
### compile QCad
$ cd /opt/local
$ sudo mkdir qcad
$ sudo cp /Users/yourUserId/Desktop/QCad/qcad-2.0.5.0-1-community.src.tar.gz .
$ tar xfz qcad-2.0.5.0-1-community.src.tar.gz
$ rm qcad-2.0.5.0-1-community.src.tar.gz

### to prevent "qmacstyle_mac.h: No such file or directory" error, applied patch manually (as patch raised errors) by commenting out (with vi) in src/main.cpp:
//#ifdef __APPLE__
//#include
//#endif:
...
//#ifdef __APPLE__
// QApplication::setStyle(new QMacStyle());
//#endif

$ export QTDIR=/opt/local/lib/qt3 ## location of MacPorts QT3 install
$ export QMAKESPEC=/opt/local/lib/qt3/mkspecs/macx-g++
$ cd scripts
$ ./build_qcad.sh notrans


Running QCad
Start the App from X11 window:
$ open /opt/local/qcad/qcad-2.0.5.0-1-community.src/qcad/QCad.app

Or run it from a terminal window:
$ export DISPLAY=':0.0'
$ cd /opt/local/qcad/qcad-2.0.5.0-1-community.src/qcad
$ open QCad.app

AppleScript to launch QCad
Or create an Applescript, saved as application, to start QCad in X11:
--
-- Start QCad
-- 2009-02-07 New script
--
tell application "Finder"
--Launch X11 and bring to front
activate application "X11"

--String that will be executed by the do shell script command
--First set the display
set cmd to {}
set end of cmd to "export DISPLAY=':0.0'; "
set end of cmd to "cd " & the quoted form of "/opt/local/qcad/qcad-2.0.5.0-1-community.src/qcad/" & "; "
set end of cmd to "open QCad.app; "
set theCommand to cmd as text
--display dialog ("shell command: " & theCommand)
with timeout of 1000000 seconds
do shell script theCommand
end timeout
end tell

1 comment:

  1. Johan,

    I am working hard to get QCAd compiling fine on OSX, WIndows and Linux with qt4. No more messing around with qt3!

    The software is still alpha, but tat really doesn't mean it doesn't work... There are just still some issues to iron out. But you can already draw like in QCad CE, load and save files etc...

    here is the project : https://sourceforge.net/projects/caduntu/

    ReplyDelete