190 likes | 230 Views
PROGRAMMING GRAPHICAL OBJECTS AND DATABASE IN DESIGN. Algirdas Sokas Department of Engineering Graphics Vilnius Gediminas Technical University. Faculty of Fundamental Sciences bachelor study programs. B ioengineering Engineering Informatics Technomathematics. M a st e r stud y programs.
E N D
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
Master study programs • Bioengineering • Engineering Informatics AppliedInformatic, 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
Scientist of mathematic Edgar Frank Codd from IBM created first relational database model in 1969.
First version of AutoCAD was created by John Walker and Dan Drake in 1982. They founded ,,AUTODESK”.
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.
Data exchange technology Open database connectivity (ODBC) technology (1991). Object linking and embedding database (OLE DB) technology (1996). Modern technology is ActiveX (1996).
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.
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)
We can select one graphical object record in the database of graphical object parameters
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) ListBox1.AddItem rr(0) & " " & rr(1) & " " & rr(2) _ & " " & rr(3) & " " & rr(4) (12) rr.MoveNext (13) Loop (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 (15) Dim Data(0 To 1) As Variant (16) FunkcijaLangas TextBox2, TextBox3, oLangas (17) If oLangas.ObjectName = "AcDbPolyline" Then (18) DataType(0) = 1001: Data(0) = "LangoData" (19) DataType(1) = 1000 (20) Data(1) = TextBox1 & ";" & CStr(TextBox2)& _ ";" & CStr(TextBox3) & ";" & TextBox4 (21) oLangas.SetXData DataType, Data (22) End If (23)
Collect Drawing Information In The Database For j = 1 To maxrecord (24) rr2.AddNew (25) rr2.Fields("Code").Value = “L” & j (26) rr2.Fields("Name").Value = MM(j, 1) (27) rr2.Fields("Count").Value = MM(j, 2) (28) rr2.Update (29) Next j (30)
Analysis of procedures PC Pentium III, 600 MHz, RAM 200 MB
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.