Help Needed. Plz.. Re:DXF

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
juzatestdrive
Forum Newbie
Posts: 3
Joined: Fri Jan 02, 2004 8:38 am

Help Needed. Plz.. Re:DXF

Post by juzatestdrive »

Hie,

Given the informations in DXF file(in ASCII code).
Is there any way that i can insert the DXF file into a database by using mysql?

Thank you for your help.....
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Sounds like the following would help to start with. Tweak it abit to fit you.

Code: Select all

<?php
    $filename = "file.dxf";
    $handle = fopen($filename, "r");
    $contents = fread($handle, filesize($filename));
    fclose($handle);
    // insert $contents into the database
?>
juzatestdrive
Forum Newbie
Posts: 3
Joined: Fri Jan 02, 2004 8:38 am

Insert/Select Entity From a Dxf file

Post by juzatestdrive »

Is there a way to insert a particular entity and it's attributes in the database table from a dxf file?

CREATE TABLE line(
ID int(4),
LayerName char(20),
Color int(50),
StartX Double[(M,D)],
StartY Double[(M,D)],
StartZ Double[(M,D)],
EndX Double[(M,D)],
EndY Double[(M,D)],
EndZ Double[(M,D)],
)

/*If I'm not wrong above is how to create a table, rite? But how do I insert the details from the dxf file into the above table?*/


By the way:
Thanks for the help Jam.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

You'll need several manuals:
http://www.php.net/manual/en/
http://www.mysql.com/doc/en/
http://myfileformats.com/files/DXF.ZIP

[php_man]fopen[/php_man]
[php_man]fread[/php_man]
[php_man]preg_match[/php_man]
...
Post Reply