Transcript Document

PROGRAMMING
GRAPHICAL OBJECTS
AND DATABASE IN
DESIGN
Algirdas Sokas
Department of Engineering Graphics
Vilnius Gediminas Technical University
Faculty of Fundamental Sciences
bachelor study programs
 Bioengineering
 Engineering Informatics
 Technomathematics
2
Master study programs
 Bioengineering
 Engineering Informatics
Applied Informatic,
Computerising of Physical and Technical Investigations,
Information Systems.
 Information Technology
Data Mining Technology,
Engineering and Computer Graphics,
Spatial Information Systems.
 Applied Statistics
 Ecology of Technosphere
3
Students
1600
1400
Students
1200
1000
Bachelor
800
600
Master
400
200
0
1999 2000 2001 2002 2003 2004 2005
4
Scientist of mathematic Edgar Frank Codd from IBM
created first relational database model in 1969.
5
First version of AutoCAD was created by John Walker
and Dan Drake in 1982. They founded ,,AUTODESK”.
6
Formulation of problem
Prepare
methods,
algorithms
and
procedures
for
solving
these
design
problems:
 Attach
information from database to a
graphical object being drawn;
 Read information from certain graphical
objects of a drawing and collect, store and
present this information in database.
7
8
Data exchange technology
Open database connectivity (ODBC)
technology (1991).
Object linking and embedding database
(OLE DB) technology (1996).
Modern technology is ActiveX (1996).
9
Algorithms
Form an algorithm to attach database record information to
graphical object:
1. Select one graphical object record in the database;
2. Create extended data of new graphical object;
3. Draw programming graphical object depending on
extended data and scale in the drawing.
Form algorithm to read the information from graphical
objects and to collect extended data in the database
records:
1. Select k graphical objects in the drawing;
2. Take first object from beginning;
3. Verify whether object has extended data;
If does not have, go to position 2; if has, go to position 4;
4. Collect extended data in the database record.
10
Programming with objects
from database
We have to create an instance of the application and to
declare a variables that will represent the other application:
Dim cc As ADODB.Connection
(1)
Dim rr As ADODB.Recordset
(2)
Second, we have to create a set of statements with declared
variables:
Set cc = New ADODB.Connection
(3)
With cc
(4)
.Provider = "Microsoft.Jet.OLEDB.4.0"
(5)
.Open "C:\My Documents\ dbac2.mdb"
(6)
End With
(7)
Set rr = New ADODB.Recordset
(8)
11
Database table and drawing information
12
We can select one graphical object record in
the database of graphical object parameters
13
Procedure fragment to select one
graphical object record in the database
rr.Open "Lentele1", cc, adOpenKeyset, adLockBatchOptimistic
(9)
ListBox1.Clear
(10)
Do Until rr.EOF
(11)
Loop
ListBox1.AddItem rr(0) & " " & rr(1) & " " & rr(2) _
& " " & rr(3) & " " & rr(4)
(12)
rr.MoveNext
(13)
(14)
14
The next procedure selecting one graphical object
record with 5 fields in the database of graphical
object parameters and creating extended data of
new graphical objects
Dim DataType(0 To 1) As Integer
Dim Data(0 To 1) As Variant
FunkcijaLangas TextBox2, TextBox3, oLangas
If oLangas.ObjectName = "AcDbPolyline" Then
DataType(0) = 1001: Data(0) = "LangoData"
DataType(1) = 1000
Data(1) = TextBox1 & ";" & CStr(TextBox2)& _
";" & CStr(TextBox3) & ";" & TextBox4
oLangas.SetXData DataType, Data
End If
(15)
(16)
(17)
(18)
(19)
(20)
(21)
(22)
(23)
15
Collect Drawing Information In The
Database
For j = 1 To maxrecord
rr2.AddNew
rr2.Fields("Code").Value = “L” & j
rr2.Fields("Name").Value = MM(j, 1)
rr2.Fields("Count").Value = MM(j, 2)
rr2.Update
Next j
(24)
(25)
(26)
(27)
(28)
(29)
(30)
16
Analysis of procedures
PC Pentium III,
600 MHz,
RAM 200 MB
17
Example. The house windows
18
Conclusions
Prepare methods, algorithms and procedures for solving these design
problems: attach information from database to a graphical object being drawn,
reading information from certain graphical objects of a drawing and collecting,
storing, presenting this information in database formats, fulfilling mathematical
operations with read information.
Form an algorithm to attach database record information to graphical object.
Form algorithm to read the information from graphical objects and to collect
extended data in the database records.
The following are presented: procedure fragments and results dependent on
selected record in the database of graphical object parameters; creation of
extended data for new graphical object; and information transfer to another
database. How the prepared procedures work that collect drawing information in
the database with different number of graphical objects and with and without
sorting procedure.
Prepare example house facade drawing and database with windows information
with program written in VBA language.
19