background image

 COLLABORATIVE DESIGN IN ANCATIA 

V5 USING VISUAL BASIC FOR 

APPLICATION D IBM-DB2 DATABASES 

Synergia projektowania w CATIA V5 (Computer 

Aided Three-dimensional Interactive 

Application) z wykorzystaniem Visual Basic oraz 

systemu bazy danych IBM DB2.  

Radu Constantin PARPALA 

University POLITEHNICA of Bucharest, Machine and 

Manufacturing System Department, Splaiul Independentei, 

no.313, Sector 6, RO-060042 Bucharest, ROMANIA, 

pmc@mix.mmi.pub.ro

 Lidia Florentina CIOBANU 

University POLITEHNICA of Bucharest, Machine and 

Manufacturing System Department, Splaiul Independentei, 

no.313, Sector 6, RO-060042 Bucharest, ROMANIA, 

lidia.ciobanu@mix.mmi.pub.ro

Nicolae PREDINCEA 

University POLITEHNICA of Bucharest, Machine and 

Manufacturing System Department, Splaiul Independentei, 

no.313, Sector 6, RO-060042 Bucharest, ROMANIA, 

predi@imst.msp.pub.ro

background image

1. Abstract

 The parametrical modelling of a product consists in 

describing it, from a geometrical point of view, using a number of 
parameters. Those parameters have to completely define all the 
features of the model. Parameterized modelling is the first step in 
the development process of this type of Collaborative Design 
Application. With a system providing the correct tools to access this 
data efficiently, the design process itself can be dramatically 
shortened.

1. Streszczenie

Parametryczne modelowanie produktu polega na opisywaniu 

go 
z geometrycznego punktu widzenia z wykorzystaniem wielu 
parametrów, które muszą całkowicie określić wszystkie cechy 
modelu. Sparametryzowane modelowanie jest pierwszym krokiem 
w procesie rozwoju tego typu Zintegrowanych Systemów 
Projektowych. Systemy dostarczające odpowiednie narzędzia 
umożliwiające skuteczny dostęp do danych , pozwalają na znaczne 
skrócenie procesów projektowych.

background image

We also consider that designers should spend more time actually 
designing. Historically a design engineer would spend as much as 
25-30% of his time simply handling information; looking for it, 
retrieving it, waiting for copies of drawings, archiving new data. 
Collaborative Design Systems removes this dead time almost 
entirely. The designer no longer needs to know where to look for 
released designs or other data; it is all there on demand. Those 
could be achieved by enhancing Visual Basic for Application (VBA) 
with the power of IBM-DB2 (International Business Machines 
Corporation Databases2) databases.

Naszym zdaniem, projektanci powinni spędzać więcej czasu nad 
rzeczywistym projektowaniem.  W przeszłości projektant, 25-30 % 
swojego czasu poświęcał na przetwarzanie informacji; szukając, 
zdobywając, czekając na kopie rysunków, archiwizując dane. Dzięki 
Collaborative Desing System inżynierowie nie marnują czasu na 
tego typu zajęcia. Projektant nie musi wiedzieć gdzie szukać 
wzorów lub innych danych; wszystko jest dostępne od ręki. 
Wszystko to można osiągnąć poprzez ulepszanie Visual Basic for 
Application (VBA) korzystając z potencjału IBM-DB2 databases.

background image

We had chosen Collaborative Design as a high-tech 

tool that supports very low-tech "natural" interactions. 

We consider that the results in our case study enable 

a much more productive solution. 

Pracujemy z Collaborative Design jako bardzo 

zaawansowanym narzędziem opartym na łatwym 

i intuicyjnym interfejsie. Mamy nadzieję, że wyniki 

naszych badań umożliwią opracowanie bardziej 

wydajnych rozwiązań. 

Key words: 
collaborative design – projektowanie 

współbieżne IBM DB2 – baza danych 
CATIA (

Computer Aided Three-

dimensional Interactive Application)

, Visual Basic

background image

2. Introduction

Today, when teams of engineers, designers or scientist collaborate on 
a development project, they have either to fly to a single location, or 
cope with collaboration technologies that are too limiting. Video 
conferencing permits people in different locations to interact, but it 
does not enable the sharing of work objects. On the other hand, 
various kinds of visualization software enable distributed teams to 
view and share work objects, however these applications do not 
support personal interaction either. 

2. Wprowadzenie

Dziś, kiedy zespoły inżynierów, projektantów lub naukowców 
współpracują nad projektami, mogą albo spotkać się w jednym 
miejscu albo współpracować na odległość. Wideokonferencja pozwala 
ludziom 
w różnych miejscach na interakcje, ale nie pozwala na wymianę 
przedmiotów pracy. Z drugiej strony, różne rodzaje oprogramowania 
do wizualizacji umożliwiają rozproszonych zespołów w celu 
wyświetlania 
i udostępniania obiektów pracy, jednak nie zastąpi to bezpośredniej 
współpracy. 

background image

A Virtual Collaborative Design prototype must 
combine best of these two kinds of technologies 
into a powerful collaborative solution. Participants 
have face-to-face contact as if they were looking 
at each other through a window.

Virtual Collaborative Design prototypów musi 
połączyć najlepsze aspekty tych dwóch sposobów 
inżynierskiej współpracy. Ludzie pracujący twarzą 
w twarz, mający kontakt i dostęp do danych jak z 
poziomu systemów komputerowych. 

background image

The main goal of this paper is the development of an 
Application Interface for the CAD-system CATIA V5. Using a 
complex database, work models are stored and shared over 
Internet or Local Area Network (LAN). This application is 
intended to work as an interface between the CATIA 
integrated system and a model database. Using a 
parametrical model stored in a database, several engineers 
could work on the same job in the same time. 

Głównym celem tej pracy jest opracowanie interfejsu aplikacji 
dla systemu CAD CATIA V5. Wykorzystywanie rzetelnych baz 
danych, przechowywane 
i udostępniane modeli w internecie lub lokalnej sieci LAN. Ta 
aplikacja przeznaczona jest do pracy jako interfejs miedzy 
zintegrowanych systemem CATIA, a bazą danych modelu. 
Korzystając z parametrycznego modelowania dane 
przechowywane w bazie, pozwalają na prace wielu 
inżynierów w tym samym czasie na jednym stanowisku.

background image

Building a database application can be a 
challenging process. Another purpose of this 
article is to introduce IBM's Universal Database 
and Microsoft's Visual Basic 6.0. 

Zbudowanie takiej aplikacji bazy danych może 
być bardzo trudnym zadaniem. Drugą kwestią 
poruszoną w tym artykule będzie przybliżenie 
Universal Database IBM oraz Microsoft Visual 
Basic 6.0.

background image

1.1 IBM – DB2 Database Server DB2 Universal 

Developer's Edition offers a low cost package for a single 
application developer to design, build, and prototype 
applications for deployment on any of the DB2 client or server 
platforms. This comprehensive developer’s offering includes all 
client and server DB2 editions, DB2 Connect, the DB2 Extenders, 
Warehouse Manager, and Intelligent Miner allowing customers to 
build solutions that utilize the latest database technologies. 

1.1 IBM – DB2 Uniwersalna baza danych Server DB2 

Twórcy oferują niski pakiet kosztów aplikacji do projektowania, 
tworzenia i prototypowania modeli dla wdrożenia każdego klienta 
w system DB2. Wszechstronna oferta obejmuje wszystkich 
użytkowników, daje możliwość edytowania bazy danych, dostęp 
do niej oraz inteligentne przeglądanie. Powyższe fakty 
umożliwiają klientom tworzenie rozwiązań, które wykorzystują 
najnowsze technologie bazodanowe.     

background image

1.2 CATIA / Visual Basic interface 
CATIA V5 is an integrated suit of Compute Aided 
Design (CAD), Computer Aided Engineering (CAE) 
and Computer Aided Manufacturing (CAM) 
applications for digital product definition and 
simulation. 

CATIA V5 to zintegrowana część Komputerowego 
wspomagania projektowania (CAD), 
Komputerowego wspomagania inżynierskiego 
(CAE), Komputerowego wspomagania produkcji 
(CAM), są to aplikacje dla cyfrowej definicji 
produktu oraz symulacji. 

background image

The main feature used for Computer Aided Design 
with CATIA is the sketch. The main parameters of 
the products are defined in the Sketcher Design 
Module. Another set of parameters are defined 
using the Part Design Module.

Główną cechą systemu CATIA jest szkic, gdzie 
zdefiniowane są główne parametry 
projektowanego modelu. Kolejne zestawy 
parametrów określane są za pomocą modułu Part 
Design.

background image

1.2.1 CATIA V5 Automation approaches 

The macros are very easy to use Recorded macros 

can be reused for different purposes or to automate 

some common actions. They are free and they do 

not require a special license. The main limitations of 

macros are that they are very difficult to debug and 

that is hard to share common code lines. 

1.2.1 CATIA V5 Podejście automatyczne

Makra są bardzo łatwe w użyciu, zapisane pozwalają 

na ponowne wykorzystanie do różnych celów lub 

zautomatyzować niektóre wspólne działania. Są 

bezpłatne 

i nie wymagają specjalnych licencji. Potencjalne 

błędy są bardzo trudne do naprawienia, co jest 

głównym ograniczeniem w udostępnianiu kodów 

reszcie zespołu.  

background image

VBA is a free version of visual basic editor, which is 

included in CATIA Integrated Software. Not all the 

main libraries included in VB are available in VBA and 

all application created with VBA for CATIA are only 

accessible inside CATIA. The program also include a 

powerful debugger which can dramatically shorten 

the time for the programming process In VBA for 

CATIA the user also have the possibility to create 

Graphical User Interfaces (GUI) 

VBA jest darmową wersją Visual Basic, które 

umożliwia prace w Zintegrowanym Systemie CATIA. 

Nie wszystkie biblioteki zawarte w VB dostępne są w 

języku VBA, jednak wszystkie aplikacje stworzone w 

VBA dla CATIA są dostępne tylko 

w systemie CATIA. Program jest również 

wykorzystywany jako debugger, który znacząco 

skraca czas w procesie programowania w VBA dla 

użytkowników CATIA, którzy dzięki temu mają 

możliwość tworzenia graficznych interfejsów (GUI).

background image

With Visual Basic, it is possible to create self-
standing application outside the CATIA environment. 
The user can benefit of increased implementation of 
components and type libraries. Individual module 
files make collaboration and sharing code easier. The 
main disadvantage of using VB is that it is not free.

Korzystając z Visual Basic, można stworzyć 
samodzielną aplikacje poza środowiskiem CATIA. 
Użytkownik może korzystać ze zwiększonej 
implementacji komponentów oraz typów bibliotek. 
Indywidualne moduły plików potrafią współpracować 
i udostępniać kody w łatwiejszy sposób. Największą 
wadą w korzystaniu z VB jest konieczność 
wykupienia licencji. 

background image

The CAA (Component Application Architecture) is 
more powerful and faster than VB but it is more 
difficult to use. It provides access to CATIA 
interfaces. It is not available to Visual Basic.

CAA jest lepsze i szybsze niż VB jednak 
skomplikowana obsługa wymaga większej wiedzy. 
Zapewnia dostęp do interfejsów CATIA. Nie jest 
dostępny w systemie Visual Basic. 

background image

1.2.2 Visual Basic versus CATIA V5 knowledge 

Advisor 

There are 2 main directions regarding CATIA 

automation. Those are: 

1.2.2 Visual Basic kontra CATIA V5 

kompetentny doradca

  Występują dwa główne kierunki w zakresie 

automatyzacji CATIA.

background image

- Automation using Visual Basic 

Pros: External to CATIA, Graphical user interface, Coding editor, Functions 
without existing seed model, Supports large complex applications. 
Cons: Not persistent, All CATIA functionality not exposed, Limited applicable 
documentation 

- Automation using Knowledge Advisor 

Pros: Integrated into CATIA, Persistent, Supported and documented by 
DASSAULT. 
Cons: Complex models are difficult to maintain, lacks debugging help, require 
additional licenses.

Automatyzacja z użyciem VB
 

plusy: możliwość pracy po za CATIA, Graficzny interfejs użytkownika, edytor 
kodów, funkcje bez istniejącego modelu, wsparcie dużych kompleksowych 
aplikacji.
minusy: nietrwałe, nie wszystkie funkcje CATIA działają, ograniczone 
zastosowanie dokumentacji

- Automatyzacja z wykorzystaniem specjalisty 

plusy: zintegrowany z CATIA, trwały, obsługiwany i udokumentowany przez 
DASSAULT
minusy:  skomplikowane modele są trudne do utrzymania, kłopotliwe 
naprawianie błędów, wymaga dodatkowych licencji

background image

2. Microsoft Data Access Components (MDAC) SDK 

Overview
The Microsoft Data Access Components (MDAC) SDK is 

the primary source of information and instruction on 

using data access technologies. Its tools, samples, and 

documentation are designed to help developers create 

solutions for their data access needs. MDAC is used in 

our case to access IBM DB2 databases from the VB 

environment. 

2. Microsoft Data Access Components (MDAC) SDK 

Overview
 The Microsoft Data Access Components (MDAC) SDK 

jest podstawowym źródłem informacji i wskazówek na 

temat korzystania z technologii dostępu do danych. 

Narzędzia, przykłady i dokumentacja są 

zaprojektowane, aby pomóc programistom w 

tworzeniu rozwiązań dla swoich potrzeb dostępu do 

danych. MDAC jest używany w celu dostępu do bazy 

danych IBM DB2 dla środowiska VB.

background image

2.1 Universal Data Access 

Universal Data Access is the Microsoft strategy for providing 
access to information across the enterprise. Universal Data Access 
provides high-performance access to a variety of relational and 
non-relational information sources, and an easy-to-use 
programming interface that is tool and language independent. 
These technologies enable you to integrate diverse data sources, 
create easy-to-maintain solutions, and use your choice of best-of-
breed tools, applications, and platform services. 

2.1 Uniwersalny dostęp do danych

Uniwersalny dostęp do danych jest strategią Microsoft w celu 
zapewnienia dostępu do informacji w całym przedsiębiorstwie. 
UDA zapewnia wysokiej jakości dostęp do relacyjnych i 
nierelacyjnych źródeł informacji oraz łatwy w użyciu interfejs w 
większości języków świata. Technologie te pozwalają na integracje 
różnych źródeł danych, tworzenia łatwych w utrzymaniu rozwiązań 
oraz korzystać z najlepszych w swojej klasie narzędzi, aplikacji 
i platform. 

background image

Universal Data Access does not require expensive 
and time-consuming movement of data into a 
single data store, nor does it require commitment 
to a single vendor product. Universal Data Access 
is based on open industry specifications with 
broad industry support, and works with all major 
established database platforms.

Universal Data Access nie wymaga drogiego i 
czasochłonnego przepływu danych w jednym 
magazynie, ani nie wymaga zaangażowania do 
pojedynczego produktu. UDA jest oparty na 
otwartych specyfikacjach przemysłowych 
z szerokiego wsparcia przemysły i działa na 
wszystkich głównych platformach bazodanowych.

background image

2.2 Microsoft Data Access Components Overview 
The Microsoft Data Access Components (MDAC) are the key 
technologies that enable Universal Data Access. Data-driven 
client/server applications deployed over the Web or a LAN can 
use these components to easily integrate information from a 
variety of sources, both relational (SQL) and non-relational. 
These components include Microsoft ActiveX Data Objects 
(ADO), OLE DB, and Open Database Connectivity (ODBC). 

2.2 Microsoft Data Access przegląd komponentów
The Microsoft Data Access Components (MDAC) są 
kluczowymi technologiami, które umożliwia Uniwersal Data 
Access. Aplikacje oparte na danych klient/server 
wprowadzonych przez internet  lub LAN pozwalają na użycie 
tych komponentów w łatwiejszy integrowany sposób 
z wykorzystanie różnych, relacyjnych/nierelacyjnych źródeł. Te 
komponenty to Microsoft ActiveX Data Objects (ADO), OLE DB 
i Open Database Connectivity (ODBC). 

background image

2.2.1 ActiveX Data Objects (ADO) 

Microsoft ActiveX Data Objects (ADO) is the strategic application 

programming interface (API) to data and information. ADO provides 

consistent, high-performance access to data and supports a variety of 

development needs, including the creation of front-end database 

clients and middle-tier business objects that use applications, tools, 

languages, or Internet browsers. ADO is designed to be the one data 

interface needed for single and multi-tier client/server and Web-based 

data-driven solution development. The primary benefits of ADO are 

ease of use, high speed, low memory overhead, and a small disk 

footprint. 

2.2.1 ActiveX Data Objets (ADO)

Microsoft ActiveX Data Objects (ADO) jest strategią programowania 

interfejsu (API) do danych i informacji. ADO zapewnia stałą, wysoką 

wydajność dostępu do danych i obsługuje różne potrzeby rozwojowe, 

w tym tworzenie front-end klientów bazy danych oraz obiektów 

średniej klasy, które korzystają z aplikacji/narzędzi biznesowych, jak i 

tworzenie przeglądarek internetowych. ADO jest zaprojektowane jako 

jeden interfejs wykorzystywany przez jednego lub wielu użytkowników 

serwera, rozwiązania opartego na danych z sieci. Podstawowymi 

korzyściami płynącymi  z ADO to łatwość użycia, duża szybkość, niski 

narzut pamięci i małą powierzchnię dysku. 

background image

ADO provides an easy-to-use interface to OLE DB, which 
provides the underlying access to data. ADO is implemented 
with minimal network traffic in key scenarios, and a minimal 
number of layers between the front end and data store all to 
provide a lightweight, high-performance interface. ADO is 
easy to use because it uses a familiar metaphor the COM 
automation interface, available from all leading Rapid 
Application Development (RAD) tools, database tools, and 
languages on the market today. 

 ADO zapewnia łatwy w użyciu interfejs OLE DB, który 
zapewnia dostęp do podstawowych danych. ADO jest 
wdrożony poprzez minimalny ruch w sieci
, minimalną 
liczbą warstw (okna i formularze) pomiędzy interfejsem a 
bazą danych oraz kompleksowe przechowywanie danych jest 
możliwe dzięki wysokiej jakości inferfejsowi. ADO jest łatwe 
w obsłudze, ponieważ wykorzystuje szeroko znane interfejsy 
COM, dostępne z wiodącymi narzędziami Rapid Application 
Development (RAD), a także narzędzia bazy danych oraz 
języki występujące na rynku. 

 

background image

2.2.2 OLE DB

OLE DB is the Microsoft strategic system-level programming 
interface to data across the organization. OLE DB is an open 
specification designed to build on the success of ODBC by 
providing an open standard for accessing all kinds of data. 
Whereas ODBC was created to access relational databases, OLE 
DB is designed for relational and non-relational information 
sources, including mainframe ISAM/VSAM and hierarchical 
databases; e-mail and file system stores; text, graphical, and 
geographical data; custom business objects; and more. 

2.2.2 OLE DB
OLE DB jest to dzieło Microsoft`u na poziomie systemu 
strategicznego interfejsu programowania dla danych w całej 
organizacji. OLE DB jest to otwarta specyfikacja oparta na 
sukcesie ODBC poprzez zapewnienie otwartego standardu do 
wszelkiego rodzaju danych. Podczas gdy ODBC został stworzony, 
aby uzyskać dostęp do relacyjnych baz danych, w tym typu 
mainframe ISAM/VSAM i hierarchicznych baz danych: e-mail i 
plików systemowych; tekstowych, graficznych i geograficznych 
danych; niestandardowych zagadnień biznesowych; i wielu innych.

background image

OLE DB defines a collection of COM interfaces that encapsulate various 

database management system services. These interfaces enable the 

creation of software components that implement such services. OLE DB 

components consist of data providers, which contain and expose data; 

data consumers, which use data; and service components, which 

process and transport data (such as query processors and cursor 

engines). OLE DB interfaces are designed to help components integrate 

smoothly so that OLE DB component vendors can bring high-quality 

OLE DB components to market quickly. In addition, OLE DB includes a 

bridge to ODBC to enable continued support for the broad range of 

ODBC relational database drivers available today.

OLE DB (Object Linking and Embedding, Database) określa zbiór 
interfejsów COM, które hermetyzują różne usługi zarządzania bazami 
danych systemowych. Interfejsy te umożliwiają tworzenie 
komponentów oprogramowania, które wykonują takie usługi. Elementy 
OLE DB zawierają dane dotyczące dostawców; dane konsumentów, 
które używa baza; oraz elementy obsługowe, które przetwarzają i 
transportują dane (takich jak procesory zapytań i silników kursora). 
Interfejsy OLE DB zostały zaprojektowane w celu płynnego 
zintegrowania elementów, także dostawcy OLE DB mogą w krótkim 
czasie wypracować wysokiej jakości komponenty OLE DB. Ponad to, 
OLE DB zawiera swoisty most do ODBC, aby umożliwić ciągłe wsparcie 
dla szerokiej gamy sterowników ODBC relacyjnych baz danych, 
dostępnych na dzień dzisiejszy.

background image

2.2.3 Open Database Connectivity (ODBC) 

The Microsoft Open Database Connectivity (ODBC) interface is an 

industry standard and a component of Microsoft Windows Open Services 

Architecture (WOSA). The ODBC interface makes it possible for 

applications to access data from a variety of database management 

systems (DBMSs). ODBC permits maximum interoperability an 

application can access data in diverse DBMSs through a single interface. 

Furthermore, that application will be independent of any DBMS from 

which it accesses data. Users of the application can add software 

components called drivers, which create an interface between an 

application and a specific DBMS. 

2.2.3 Open Database Connectivity (ODBC)

Interfejs Microsoft Open Database Connectivity (ODBC)  jest 
przemysłowym standardem oraz komponentem Microsoft Windows Open 
Services Architecture (WOSA).  ODBC stwarza możliwości dla dla 
aplikacji, aby uzyskać dostęp do danych z różnych systemów zarządzania 
bazami danych (DBMSs). ODBS pozwala na maksymalną 
interoperatywność, dzięki czemu aplikacja ma dostęp do danych 
z różnych DBMSs z jednego „okna”. W przyszłości, taka aplikacja będzie 
samodzielną jednostką zespołu DBMS skąd będzie miała dostęp do 
danych. Użytkownicy aplikacji mogą dodawać składniki oprogramowania 
zwane sterownikami, które tworzą interfejs między aplikacją, a 
określonym DBMS. 

background image

3. Practical example

Considering the fact that this program is 
intended to be the starting point of a CAD 
cooperative system it must be developed as a 
self-standing application. This is the reason why 
we used a self-standing installation of Visual 
Basic 6 and not the VBA for CATIA. 

3. Przykład

Biorąc pod uwagę fakt, że program ten ma być 
punktem wyjścia do systemu CAD musi być 
rozwijany (obsługiwany) jako samodzielna 
aplikacja.
 To jest powodem, dlaczego użyliśmy 
samodzielnej instalacji Visual Basic 6, a nie VBA 
na platformie CATIA.

background image

Scripting languages such as Visual Basic rely on 
objects. Most pieces of data you can access are 
objects. With CATIA, documents, windows, viewers, 
cameras, parts, sketches, pads, even lines and curves, 
are represented as objects in Visual Basic. An object is 
depicted using a blue box in the object diagrams 
(Figure 1) [2])

 Języki skryptów, takie jak Visual Basic korzystają z 
obiektów (funkcje, procedury, dane dll). 
W większości zestawów danych można uzyskać dostęp 
do nich. CATIA, dokumenty, okna, obserwatorzy, 
kamery, części, szkice, klocki, nawet linie i krzywe 
reprezentują obiekty w Visual Basic. Obiekt jest 
przedstawiony za pomocą niebieskiego pola w 
diagramach obiektów. 

background image

From the diagram above, we can see that the Application object 

aggregates a Documents collection. The Documents collection 

aggregates any number of Documents. The Document object is an 

abstract object, and only its derived types can actually be created, 

that is the PartDocument for Part Design, the ProductDocument for 

Assembly Design, the DrawingDocument for Drafting, the 

AnalysisDocument for Analysis and the CatalogDocument. All those 

documents inherit the aggregated Selection object. But only the 

DrawingDocument has a DrawingSheets collection. 

Z poniższego wykresu, możemy wyczytać kolekcje dokumentów 
występujących w aplikacji. Może ona mieć nieograniczoną liczbę 
poszczególnych dokumentów. Obiekt „Dokument” jest 
abstrakcyjnym obiektem i tylko jego pochodny typ można aktualnie 
tworzyć (wywołać) i to jest: „PartDokument” dla projektowania 
części, „Product dokument” dla Projektu Montażu, „Dokument 
Drawing” dla rysunków złożeniowych, „Analisis Document” 
służący analizom i „Catalog Document”. Wszystkie te dokumenty 
dziedziczą zespolone wybrane obiekty. Jednak tylko obiekt 
„DrawingDocument” posiada kolekcje „Drawing Sheets” (arkuszy 
dotyczących rysunku). 

background image
background image

          
 3.1 Database structure 
As a starting example we 

developed a simple database structure (COWORKDB) 

containing 4 tables (Figure 2.): MAIN, PARAMETERS, 

USERS, FLAGS 

The “MAIN” table contain essentials information, like the 

name of the CATPart file or the path where the model is 

located on the Local Area Network, about the CATIA 3D 

models stored on the server.

3.1 Struktura bazy danych

Tak, jak na początkowym przykładzie opracowaliśmy 

prostą strukturę bazy danych nazywaną COWORKDB, 

zawierającą 4 tabele: MAIN, PARAMETERS, USERS, 

FLAGS.

     Tabela MAIN, czyli gówna, zawiera podstawowe 

informacje takie jak nazwa dokumentu lub odnośnik do 

serwera 

w którym zlokalizowany jest model. 

background image

• The “PARAMETERS” table is the most important 

table. It contains all the parameters that are utilised 

in the design process. These parameters are read 

by the Visual basic application and then they are 

used for the model generation in CATIA V5. After 

the process design is finished these parameters are 

retrieved and stored again in the “PARAMETERS” 

tabl.

• Tabela PARAMETERS – tabela parametrów, jest 

najważniejszą z tabel. Zawiera ona wszystkie 

parametry, które są wykorzystywane przy 

procesach projektowania. Parametry są 

odczytywane przez aplikację Visual Basic i dalej 

używane do utworzenia  modelu w programie CATIA 

V5. Po zakończeniu projektowaniu dane z tej tabeli 

są ponownie odnawiane 

i przechowywane 

background image

•  Another essential table is the “FLAGS” table in 

which the program store essential information 

about the status of the model. 

• The “USERS” table contain all the users that have 

access to the selected model. Each model can 

have a different set of users. 

• Inną podstawą tabelą jest tabela FLAGS w której 

program przechowuje informacje o statusie 

modelu.

• Tabela USERS – użytkownicy, zawiera listę osób, 

które posiadają dostęp do określonego modelu, 

przy czym każdy 

z modeli może posiadać inną listę użytkowników.

background image
background image

    

The COWORKDB database is created on the 

server machine using the Control Center 

application (Figure 3). For each 3D model one set 

of records are entered into the database 

structure. Each model must have at least one 

user able to access it and no more than one 

physical file specified. 

     
   Baza COWORKDB jest tworzona na serwerze przy 

użyciu aplikacji Control Center. Dla każdego 

modelu 3D jeden zestaw dokumentacji jest 

umieszczony w strukturze bazy danych.  

Każdy model musi mieć co najmniej jednego 

użytkownika, który posiada dostęp do niego oraz  

musi posiadać nie więcej niż jeden określony 

dokument.  

     

background image

 

The following procedure can be used to connect to 

a table:

Poniższa procedura może być użyta do powiązania z 

tabelą.

background image
background image
background image
background image

     

3.2 Defining the parametrical model The parametrical 

model must contain all the parameters needed to completely 

define the part. From this set of parameters only a few are 

entered by the users, the others are constant or the program 

calculates them. In our case almost all user parameters are 

needed only for the design of the main sketch (Figure 2) 

     Figure 4 The parameters that have to be entered by the 

user

    3.2 Definiowanie modelu parametrycznego. Model 

parametryczny musi zawierać wszystkie parametry 

potrzebne do kompletnego określenia części. Z tego zestawu 

danych tylko kilka jest  wprowadzanych przez użytkownika 

natomiast reszta jest stała lub obliczana przez program. 

W naszym przypadku prawie wszystkie parametry są 

potrzebne tylko to zaprojektowania głównego szkicu (rys. 2).

     Rysunek 4 Parametry wprowadzane przez użytkownika:

background image
background image

     

3.3 Creating the procedures The PartDocument 

object aggregates, or includes, the part tree structure 

starting with the Part object located at the top of the 

part specification tree. Among these objects, we find 

first objects and collections you can also find in the 

part specification tree. These objects are: 

         -the constraints you can set to your 3D objects 

and stored in the Constraints collection you can 

retrieve using the Part's Constraints property 

     3.3 Tworzenie procedurObiekt PartDocument 

zawiera drzewko struktury danej części. Wśród 

obiektów możemy znaleźć pierwsze obiekty oraz 

zbiory które znajdują się również w drzewku 

zawierającym specyfikację części. Te obiekty to:

      -ograniczenia, możemy odnieść do obiektów 3D i 

przechować 

w zbiorze ograniczeń który może być odzyskany przy 

użyciu Part’s Constrains 

background image

• The relations between parameters stored in a Relations 

collection you can retrieve using the Part's Relations 

property 

• The parameters stored in a Parameters collection you can 

retrieve usin the Part's Parameters property 

• The factories: a Factory3D object to create 3D reference 

elements and a ShapeFactory object to create shapes. You 

can retrieve these factories using the Part's Factory3D and 

ShapeFactory properties respectively. 

• Relacje pomiędzy parametrami umieszczonymi w zbiorze 

relacji mogą być odzyskane przez Part’s Relations property.

• Parametry umieszczone w zbiorze parametrów mogą być 

odzyskane przy użyciu Parts Parameters property.

• Obiekt Fabryka3D do tworzenia odniesień 3D różnych 

elementów oraz obiekt ShapeFactory do tworzenia 

kształtów. Możemy odzyskać te parametry używając Pars 

Factory3D oraz ShapeFactory.

background image

     

The Sketch object contains 2D geometric elements that define 

the sketch. These elements are created using the Factory2D 

object and contained in a GeometricElements collection 

aggregrated by the sketch. To create 2D geometric elements, we 

need first to "open the sketch edition" using the OpenEdition 

method that returns the Factory2D object which supplies the 

appropriate methods to create 2D geometric elements. Once we 

have finished creating 2D geometric elements, "close the sketch 

edition" using the CloseEdition method. These two methods 

correspond to the commands that let you interactively enter and 

leave the sketch. 

    Szkic zawiera elementy geometryczne w rzucie 2D. Elementy te 

są tworzone poprzez narzędzie Facorty2D i zawarte są w zbiorze 
GeometricElements . Żeby stworzyć elementy geometryczne 
należy najpierw otworzyć edycję szkiców używając OpenEdition i 
wrócić do Factory2D który dostarcza odpowiednie narzędzia do 
tworzenia elementów geometrycznych. Kiedy skończymy 
tworzenie elementów, zamykamy edycję szkicu używając 
CloseEdition. Te dwie komendy pozwalają interaktywnie 
wchodzić i wychodzić ze szkicu. 

background image

• Constrains can be set to the 2D geometric elements using 

the methods supplied by the Constraints collection 
aggregated to the sketch. A Constraint can constrain one, 
two or three elements. Broken and unupdated constraints 
can be retrieved from the collection, as well as the number 
of constraints that fall in these categories in the collection. A 
given constraint is defined using properties to set its type, its 
mode, its side and orientation, its dimension and 
configuration, its reference axis, and its status. 

• Więzy mogą być odniesione do elementów 2D przy użyciu 

metod oferowanych przez Constraints collection. Mogą one 
wiązać jeden, dwa lub trzy elementy. Przerwane lub nie 
zaktualizowane ograniczenia może być odzyskane ze zbioru 
tak jak definicje ograniczeń, które tworzą kategorie 
w kolekcji. Dane ograniczenie jest definiowane przy użyciu 
własności określających typ, orientację, wymiar, w 
odniesieniu do osi i statusu. 

background image

• 3.4 Handling parameters 

The CATIA Knowledge Advisor automation objects are those who can be 
use to create and manipulate the knowledgeware features in a VB 
program [6]. These automation objects can be divided into two 
categories: 

– The objects which provide creation methods. They are the Relations and 

Parameters collections. These objects are only implemented on CATPart 
documents

– The knowledgeware objects whereby one can manipulate the Parameter, 

Formula, Rule, Check and Design Table features once they have been created. 
The hierarchy of these objects is described in the Parameter and Relation tree 
structures. 

• 3.4. Obsługa paramatrów

Obiekty automatyzacji CATIA Knowledge Advisor, które mogą być używane do 
tworzenia i modyfikowania cech knowledgeware w programie Visual Basic. Można 
podzielić  je na dwie kategorie:

– Obiekty które zapewniają metody tworzenia. Są zbiorami relacji i parametrów. 

Obiekty te są zaimplementowane tylko w dokumentach CATPart

– Obiekty knowledgeware którym można manipulować Parametry, Formuły, Linie, 

Ograniczenia i wyglądy konstrukcyjne tabel po ich utworzeniu. Hierarchia tych 
obiektów jest opisana w parametrze i strukturze drzewa relacji.

background image

• The entry point is the Relations or Parameters collection (Figure 

5). To retrieve the appropriate collection, one must retrieve the 
Part object of the active document. This Part object aggregates 
all the objects making up the CATPart: the Bodies, the Relations, 
the Parameters to name but a few. 

Dim oActiveDoc As Document (zmienne)
Set oActiveDoc = CATIA.ActiveDocument (obiekt)
Dim oParams As Parameters 
Set oParams = oActiveDoc.Part.Parameters 

• Punkt wejścia jest relacją lub zbiorem parametrów (rys. 5). Aby 

wyszukać właściwą kolekcję (xxx wyjaśnić kolekcje 
danych, obiektów), jedna z nich musi przeszukać część 
obiektu w ramach aktywnego dokumentu.Obiekt „Part” 
(dotyczący części) zawiera wszystkie obiekty wykonane w 
CATPart( wyjasnij): „Bodies” (część algorytmu bez 
definicji zmiennych, zawiera główny kod), relacje, 
parametry do nazwania (kilka).

background image

• Parameters as well as Relations can be scanned in their 

collections 
(Figure 5). An item is retrieved from its collection using the 
Item method and the index of the item in the collection. 
Usually, the argument representing the index in the Item 
method is a Variant.

Dim oParam1 As Parameter
Set oParam1 = oParams.Item(6)

• Parametry jak również relacje mogą być zeskanowane w 

swoich zbiorach. (rys. 5). Punkt/szczegół/element jest 
pobierany z jego zbioru za pomocą metody przedmiotu oraz 
współczynnika  elementu w zbiorze. Zwykle wariantem jest 
argument reprezentujący indeks/współczynnik w  metodzie 
przedmiotu.

background image

Parametry
Jednostki
Jednostka
Parametr
Relacja
Realny param.
Wymiar
Jednostka
Kąt
Długość
Int param.
Enum param.
Bool param.
Str param.
Lista 
parametrów
List

background image

• Using parameters collection it is possible to 

directly modify all the parameters stored in the 
“PARAMETERS” database’s table.

• Używanie zbiorów parametrów jest możliwe do 

bezpośredniej modyfikacji wszystkich parametrów 
zapisanych w bazie „parametry”.

background image

• 3.5 Handling errors 

If errors are not systematically handled which is often the case when using 
scripting languages a lot of unpredictable events can take place before the 
end user identifies a problem. As a default behaviour the interpreter will 
stop and display an error message box whenever an error is raised. Those 
errors are not to clear, so it is very hard for the common user to understand 
them. In this case if the program is written for public purposes it is good, 
where it is possible, to disable the automatic error handling mechanism 
using the "On Error Resume Next" syntax. This is recommended only where 
frequent error may occur and is necessary for the programmer to manually 
interpret all the error codes. 

• 3.5 Obsługa błędów

Jeśli błędy nie są systematyczne co często zdarza się przy użyciu języków 
skryptowych wiele nieprzewidywalnych zdarzeń może nastąpić przed tym 
jak użytkownik zidentyfikuje problem.  Jako domyślne zachowanie 
interpretator/tłumacz zatrzyma i wyświetli okno komunikatu o błędzie, 
gdy błąd zostanie wyświetlony. Te błędy są nie do usunięcia, więc jest to 
bardzo trudne dla zwykłych użytkowników, aby je zrozumieć. W tym 
przypadku, jeśli program jest napisany na cele publiczne to dobrze jest, jak 
jest to możliwe, aby wyłączyć automatyczny mechanizm obsługi błędów za 
pomocą składni "On Error Resume Next". Jest to zalecane tylko w 
przypadku częstego błędu jaki może wystąpić i jest niezbędne dla 
programisty ręcznie interpretować wszystkie kody błędów.

background image

In our case, a frequent error appears when trying to access 
CATIA objects and CATIA is not running. If we will let Visual Basic 
handle the error, the program will display an error message 
(“ActiveX component can’t create object”) and the program will 
exit. Instead of this message if we take control of error handling 
procedure we could use a message box to alert the user and 
continue running the program. The difference between the two 
modes is shown in Figure 6 

W naszym przypadku, często błąd, który pojawia się podczas 
próby dostępu do CATIA objects i CATIA nie jest uruchomiony. 
Jeśli pozwolimy na uchwycenie błędu przez program Visual 
Basic, wyświetli on komunikat o błędzie ("Składnik ActiveX nie 
może utworzyć obiektu") i program zostanie zamknięty. Zamiast 
tego komunikatu, jeśli weźmiemy kontrolę procedury obsługi 
błędów możemy użyć okna komunikatu, które ostrzega 
użytkownika i kontynuuje realizację programu. Różnica 
pomiędzy tymi dwoma trybami jest pokazany na rysunku 6.

background image

The fallowing code demonstrate a way of handling errors for 
the GetObject procedure: 

Dim CATIA As Object 
On Error Resume 
Set CATIA=GetObject(,"CATIA.Application") 
iErr = Err.Number 
if (iErr <> 0) Then 
On Error Goto 0 
CATIA=CreateObject("CATIA.Application") 
End If 
On Error Goto 0 

Następujący kod demonstruje sposób obsługi błędów dla 
GetObject procedury:

background image
background image

4. Conlusion
Thanks to programming, it is possible to customize a generic 
system according to ones specific needs and therefore make it 
more efficient. Specifically it is possible to automate the 
repetitive phases of the design process through the 
development of ad-hoc procedures.

4. Wnioski
Dzięki programowaniu, można dostosować ogólny system 
zgodnie 
z konkretnymi potrzebami, a w związku z tym jest bardziej 
efektywny. 
W szczególności możliwe jest zautomatyzowanie 
powtarzających się etapów procesu projektowania poprzez 
rozwój doraźnej procedury.

background image

This work documents the development of an automatic design system 
for modular parts. By using the developed system, the user can: 

– Shorten the custom design time from at least one day to a few 

minutes 

– Produce all the engineering drawings automatically 
– Reduce the production costs by more than 40% percent through 

design optimization 

– Generate a product design satisfying all the functional and size 

requirements 

Ta praca dokumentuje rozwój automatycznego systemu projektowania 
modułowych części. Za pomocą opracowanego systemu, użytkownik 
może:

– Skrócić czas niestandardowego projektowania z co najmniej 

jednego dnia do kilku minut

– Opracować automatycznie wszystkie rysunki techniczne
– Zredukować koszty produkcyjne o więcej niż 40% przez 

optymalizację projektu

– Generować projektowanie produktu spełniającego wszystkie 

wymagania funkcjonalne i rozmiarowe

background image

By utilizing parametric modelling, interactive programming, and an 
open-architecture optimization strategy, a product can be 
automatically and simultaneously designed, modelled, and 
optimized. 
In the future, this program will be improved in order to allow the 
access of more than one engineer to the same model, which means 
collaborative work. This is especially useful for large 3D models 
where different engineers design several subparts of the main part. 

Dzięki wykorzystaniu parametrycznego modelowania, 
interaktywnego programowania i otwartej architektury strategii 
optymalizacji, produkt może być automatycznie i jednocześnie 
zaprojektowany, wzorowany i zoptymalizowany. 
W przyszłości program ten zostanie poprawiony w celu 
umożliwienia dostępu więcej niż jednemu inżynierowi do tego 
samego modelu, co oznacza, współpracę. Jest to szczególnie 
przydatne w przypadku dużych modeli 3D, w którym  różni 
inżynierowie robią projekt składający się z kilku różnych części 
tworzących główną część.

background image

5 REFERENCES / Literatura
[1] C.J. BOCKMANN, L. KLANDER, L. TANG “Visual Basic Programmer’s 

Library”, TEORA, Bucharest 2002, 973-601-912-8, 2002 

[2] CATIA V5R13 Online Documentation 
[3] N. Clark, T. Schneider. “Getting Started with KBE: Working With 

the CATIA / Visual Basic Interface, 14 Nov., 2003. 

[4] Bachman F. Volume II: “Technical Concepts of Component-Based 

Software Engineering, 2

nd 

Edition” [online], 

Available:<http://www.sei.cmu.edu/publications/documents/00.rep
orts/ 00tr008.html 

[5] Microsoft CO Specification 1995 [online], Available: 

http://www.microsoft.com/com /resources/comdocs.asp 

[6] R.C. Parpala, C.C. Bucur, L.F. Ciobanu, C.L. Popa. “Automatic 

generation of part and assemblies in CATIA V5 using Visual Basic”, 
Proceedings of 8

th

International Conference on Management of 

Innovative Technologies, MIT’ 2005, ISBN961-6238-96-5, 
September 2005, Fiesa, Slovenia 


Document Outline