View Full Version : dxf to database OR dxf to visual basic?
juzatestdrive
23rd Dec 2003, 02:20 am
i would like to know is there any way that i can make a database table for each enitty that is found in dxf file?
Example of an entity in a dxf file:
0
LINE
5
53
100
AcDbEntity
8
4
6
CONTINUOUS
62
6
100
AcDbLine
10
108577048.876492
20
344295406.246376
30
-6.0
11
108577037.133274
21
344285406.253273
31
-6.0
how can i extract all the variables and the values of an entity from the dxf file to a table(circle,line,arc...) in a database? Or is it much easier to use visual basic ? If there is any example of it, i will really appreciated it. Thank you for your time.
___________________
Merry Christmas to all..
hendie
23rd Dec 2003, 08:55 am
it is probably possible but would be very time consuming and difficult. What is the purpose of the database ? if you tell us what the db is for perhaps we can point out a better way to achieve what you require
juzatestdrive
23rd Dec 2003, 09:34 am
The dxf file that i have is like a map with lots of diagrams embed layer by layer.
Objective:
(1) to retrieve the data from the dxf file
(2) with the database also, be able to update the dxf file
(3) be able to create,delete and display the data that is in the database.
Maybe:
i can get a database to store datas such as X,Y coordinate of an entity. for example, that the dxf file (autocad) has shapes like line,circle or polyline, how can i store the data of each into a separate table.
hendie
23rd Dec 2003, 09:46 am
basically you would need to create an entry for each item that is listed in the DXF group codes. That could run into several hundred different fields.
I would post an excerpt here but it would be far too long.
I'm still having difficulty in understanding exactly what you are trying to do ? What is the purpose of the DXF file ? is it to drive a CNC machine or something ?
whay can't you simply open the DXF file and manipulate it in Acad ?
juzatestdrive
23rd Dec 2003, 09:53 am
:oops: sorry.. hmm i need to like calculate between two lines that intercross each other and estimate does it affect the other lines or shape that is there, within the dxf give i need to estimate it. i'm not good that explaining...
hendie
23rd Dec 2003, 09:59 am
wouldn't it just be easier to open the DXF and query the items in question ?
juzatestdrive
23rd Dec 2003, 11:10 am
i know that autocad can do that.... but i was assign to use other program sure as visual basic or database to extract the data... so i am trying to find out ways to do that...
hendie
23rd Dec 2003, 11:28 am
ok, I still don't understand what you are trying to do.
why extract data from the DXF when you can extract it from the drawing
here is a list of some of the group codes... NOTE: this list is not exhaustive !
Group code value types
Code range Group value type
09 String. (With the introduction of extended symbol names in AutoCAD 2000, the 255 character limit has been lifted. There is no explicit limit to the number of bytes per line, although most lines should fall within 2049 bytes.)
1059 Double precision 3D point
6079 16-bit integer value
9099 32-bit integer value
100 String (255-character maximum; less for Unicode strings)
102 String (255-character maximum; less for Unicode strings)
105 String representing hexadecimal (hex) handle value
140147 Double precision scalar floating-point value
170175 16-bit integer value
280289 8-bit integer value
300309 Arbitrary text string
310319 String representing hex value of binary chunk
320329 String representing hex handle value
330369 String representing hex object IDs
370379 8-bit integer value
380389 8-bit integer value
390399 String representing hex handle value
400409 16-bit integer value
410419 String
999 Comment (string)
10001009 String. (Same limits as indicated with 09 code range.)
10101059 Floating-point value
10601070 16-bit integer value
1071 32-bit integer value
Group codes by number
Group code Description
5 APP: persistent reactor chain
4 APP: conditional operator (used only with ssget)
3 APP: extended data (XDATA) sentinel (fixed)
2 APP: entity name reference (fixed)
1 APP: entity name. The name changes each time a drawing is opened. It is never saved (fixed)
0 Text string indicating the entity type (fixed)
1 Primary text value for an entity
2 Name (attribute tag, block name, and so on)
34 Other text or name values
5 Entity handle; text string of up to 16 hexadecimal digits (fixed)
6 Linetype name (fixed)
7 Text style name (fixed)
8 Layer name (fixed)
9 DXF: variable name identifier (used only in HEADER section of the DXF file)
10 Primary point; this is the start point of a line or text entity, center of a circle, and so on
DXF: X value of the primary point (followed by Y and Z value codes 20 and 30)
APP: 3D point (list of three reals)
1118 Other points
DXF: X value of other points (followed by Y value codes 2128 and Z value codes 3138)
APP: 3D point (list of three reals)
20, 30 DXF: Y and Z values of the primary point
2128, 3137 DXF: Y and Z values of other points
38 DXF: entity's elevation if nonzero
39 Entity's thickness if nonzero (fixed)
4048 Floating-point values (text height, scale factors, and so on)
48 Linetype scale; floating-point scalar value; default value is defined for all entity types
49 Repeated floating-point value. Multiple 49 groups may appear in one entity for variable-length tables (such as the dash lengths in the LTYPE table). A 7x group always appears before the first 49 group to specify the table length
5058 Angles (output in degrees to DXF files and radians through AutoLISP and ObjectARX applications)
60 Entity visibility; integer value; absence or 0 indicates visibility; 1 indicates invisibility
62 Color number (fixed)
66 "Entities follow" flag (fixed)
67 Spacethat is, model or paper space (fixed)
68 APP: identifies whether viewport is on but fully off screen; is not active or is off
69 APP: viewport identification number
7078 Integer values, such as repeat counts, flag bits, or modes
90-99 32-bit integer values
100 Subclass data marker (with derived class name as a string). Required for all objects and entity classes that are derived from another concrete class. The subclass data marker segregates data defined by different classes in the inheritance chain for the same object.
This is in addition to the requirement for DXF names for each distinct concrete class derived from ObjectARX (see "Subclass Markers")
102 Control string, followed by "{<arbitrary name>" or "}". Similar to the xdata 1002 group code, except that when the string begins with "{", it can be followed by an arbitrary string whose interpretation is up to the application. The only other control string allowed is "}" as a group terminator. AutoCAD does not interpret these strings except during drawing audit operations. They are for application use
105 Object handle for DIMVAR symbol table entry
210 Extrusion direction (fixed)
DXF: X value of extrusion direction
APP: 3D extrusion direction vector
220, 230 DXF: Y and Z values of the extrusion direction
280-289 8-bit integer values
290-299 Boolean flag value
300-309 Arbitrary text strings
310-319 Arbitrary binary chunks with same representation and limits as 1004 group codes: hexadecimal strings of up to 254 characters represent data chunks of up to 127 bytes
320-329 Arbitrary object handles; handle values that are taken "as is." They are not translated during INSERT and XREF operations
330-339 Soft-pointer handle; arbitrary soft pointers to other objects within same DXF file or drawing. Translated during INSERT and XREF operations
340-349 Hard-pointer handle; arbitrary hard pointers to other objects within same DXF file or drawing. Translated during INSERT and XREF operations
350-359 Soft-owner handle; arbitrary soft ownership links to other objects within same DXF file or drawing. Translated during INSERT and XREF operations
360-369 Hard-owner handle; arbitrary hard ownership links to other objects within same DXF file or drawing. Translated during INSERT and XREF operations
370-379 Lineweight enum value (AcDb::LineWeight). Stored and moved around as a short. Custom non-entity objects may use the full range, but entity classes only use 371-379 DXF group codes in their representation, because AutoCAD and AutoLISP both always assume a 370 group code is the entity's lineweight. This allows 370 to behave like other "common" entity fields.
380-389 PlotStyleName type enum (AcDb::PlotStyleNameType). Stored and moved around as a short. Custom non-entity objects may use the full range, but entity classes only use 381-389 DXF group codes in their representation, for the same reason as the Lineweight range above.
390-399 String representing handle value of the PlotStyleName object, basically a hard pointer, but has a different range to make backward compatibility easier to deal with. Stored and moved around as an Object ID (a handle in DXF files) and a special type in AutoLISP. Custom non-entity objects may use the full range, but entity classes only use 391-399 DXF group codes in their representation, for the same reason as the Lineweight range above.
400-409 16-bit Integers
410-419 String
999 DXF: The 999 group code indicates that the line following it is a comment string. SAVEAS does not include such groups in a DXF output file, but OPEN honors them and ignores the comments. You can use the 999 group to include comments in a DXF file that you've edited
1000 ASCII string (up to 255 bytes long) in extended data
1001 Registered application name (ASCII string up to 31 bytes long) for extended data
1002 Extended data control string ("{"or "}")
1003 Extended data layer name
1004 Chunk of bytes (up to 127 bytes long) in extended data
1005 Entity handle in extended data; text string of up to 16 hexadecimal digits
1010 A point in extended data
DXF: X value (followed by 1020 and 1030 groups)
APP: 3D point
1020, 1030 DXF: Y and Z values of a point
1011 A 3D world space position in extended data
DXF: X value (followed by 1021 and 1031 groups)
APP: 3D point
1021, 1031 DXF: Y and Z values of a world space position
1012 A 3D world space displacement in extended data
DXF: X value (followed by 1022 and 1032 groups)
APP: 3D vector
1022, 1032 DXF: Y and Z values of a world space displacement
1013 A 3D world space direction in extended data.
DXF: X value (followed by 1022 and 1032 groups)
APP: 3D vector
1023, 1033 DXF: Y and Z values of a world space direction
1040 Extended data floating-point value
1041 Extended data distance value
1042 Extended data scale factor
1070 Extended data 16-bit signed integer
1071 Extended data 32-bit signed long
but if you are trying to calculate things like intersections, interferences etc, then you would need to write code to calculate that. Autocad already has that code programmed into it and it is readily availabel for use through Lisp, Vlisp & VBA.
I wouldn't even know where to begin to try and calculate those things from another database.
Powered by vBulletin™ Version 4.1.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.