[cad-linux] Re: database cad system
- From: "Brian Johnson" <bjohnson@xxxxxxxxxxxxxxxxxxxxxx>
- To: cad-linux@xxxxxxxxxxxxx
- Date: Mon, 23 Jun 2003 16:01:05 +0000
This might get you going. In the main section of your code you use:
use DBI;
my $dbh = &dbconnect;
my $sth_select_all = $dbh->prepare(
"SELECT e.*, p.palm_rec_id, u.cat_name".
" FROM (palm_memos p RIGHT JOIN phpgw_notes e ON p.cal_id = e.note_id)".
" LEFT JOIN phpgw_categories u ON e.note_category = u.cat_id".
" WHERE e.note_owner = ?"
) or die $err_prep_sql;
$sth_select_all->execute($HEADERS{phpid})
or die "$err_exec_sql $dbh->errstr";
and have a sub-procedure:
sub dbconnect {
my $dbh;
if ($HEADERS{'dsn'} =~ /mysql/) {
# Mysql connect
$dbh = DBI->connect(
$HEADERS{'dsn'}.';host='.$HEADERS{'dbhost'}.';port='.$HEADERS{'dbport'},
$HEADERS{'dbuser'},
$HEADERS{'dbpasswd'}
) or die "401 Can't connect to database $dbh->errstr";
} else {
# PgSQL connect
$dbh = DBI->connect(
$HEADERS{'dsn'}.';host='.$HEADERS{'dbhost'}.';port='.$HEADERS{'dbport'},$HEADERS{'dbuser'},'"'.$HEADERS{'dbpasswd'}.'"')
or die "401 Can't connect to database $dbh->errstr";
}
return $dbh;
} # dbconnect
Eric Wilhelm (ewilhelm@xxxxxxxxxxxxx) wrote:
>
>More of this for anyone that has been missing it:
>
>I've been crazy busy with work and it looks like I will continue this way for
>quite some time now but I think I will be working toward the
>database-connected cad system on future projects.
>
>Anyone know of a way to drive an sql database from Perl? I've looked briefly
>at a couple of projects, but not in enough detail to really assess their
>usability.
>
>It looks like the networked database would be the way to set this up in future
>projects, except for the problem that everything graphical is so mired in
>autocad and file-based methodology.
>
>I'm planning to look into openCascade in the near future, but the first step
>will be getting the perl wrapper for the dwg toolkit released. The current
>project is very much based on the dwg and dxf access provided by this toolkit
>(really the best way (for now) to get graphical data into the program (but is
>has the drawback that the data has no associativity)).
>
>The programming for this project has been mostly cobbled together (because of
>the development schedule), but has shown many of the flaws in the static-file
>methodology (as well as some in my perl modules' design). I think the future
>projects will be heading more toward a dynamically-configured networked
>database (if for no other reason than to save the effort of repeating the
>same code in multiple programs (execution or typing-wise).)
>
>I'd really like to move this process away from the "creative misuse of
>software" that it is now, but the complexity of the process and the changes
>from one job to another make the creation of very interface-intensive
>applications prohibitive. Maybe openCascade can help-out here?
>
>My work is in automation of custom architectural sheet-metal cladding systems
>(so you see why commercial software isn't available). I'm hoping that what
>happens with this in the next few years will have a serious impact on how we
>all use software for architectural and mechanical design.
>
>Right now, the system has been working with Pro-E (via trailfiles (really need
>a less primitive link to this system)) and AutoCAD. This allows the people
>to make the design decisions and my perl scripts to handle the heavy lifting.
>
>Future systems would do better with an open parametric system, but what to use
>for a starting point? (needs a gui for the people and an open backend for
>the perl scripts (possibly via C))
>
>Another goal that we are looking at is full automation of
>numerically-controlled equipment (no simple task). Any suggestions on
>libraries or existing projects regarding this would be helpful as well.
>
>I'm set on Perl for the main programming language because of the custom nature
>of every job and the short development time. As things begin to show up
>repeatedly, a C-based module (usually tied to an existing library) would be
>in order, but this is not easy or quick for me.
>
>I think the main hurdle right now is creating/linking to a good human
>interface that can be customized to each job and used to create and modify
>associative data (while it is fairly simple (controlling geometry) data, the
>lack of associativity creates huge headaches in changes to the design,
>sequence, parameters, etc.)
>
>--Eric
>
--
Brian Johnson
* This is where my witty signature line would be if I bothered to edit this
line :) *
- Follow-Ups:
- [cad-linux] Re: database cad system
- From: Eric Wilhelm
Other related posts:
- » [cad-linux] database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- » [cad-linux] Re: database cad system
- [cad-linux] Re: database cad system
- From: Eric Wilhelm