473,326 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Access CATIA V5 with win32com (LONG)

Hello,

I have some problems to automate a CAD (computer aided design) Software called
CATIA V5 from Dassault Systemes.

CATIA V5 has a builtin VB-Editor like Word, Excel, … and registers itself as a
COM-server. With VB one can automate everything in CATIA V5 with a lot of
registered Object Libraries.

A VB example:
...
'Create a new product document object by adding a document with the
Product
'type to the document collection of the CATIA application.
Dim oProductDoc As Document
Set oProductDoc = CATIA.Documents.Add("Product")

'Retrieve the root product.
Dim oRoot As Product
Set oRoot = oProductDoc.Product

'Retrieve the root product collection of products.
Dim oRootCol As Products
Set oRootCol = oRoot.Products
...

The problem is that CATIA V5 has not only one Object Library like Word or Excel
to get access for. Dassault splitted all functionalities of the CAD system
to separate Object Libraries. Therefore to automate this CAD-system with Python
I want to use the following Type Libraries in a script.

"CATIA V5 Interfaces Object Library" to get access to the core functionalities
of the CAD system (the Application):
Similar to "Dim mydoc as Document" in VB - but in Python

"CATIA V5 ProductStructureInterfaces ObjectLibrary" to get access to the parts
of an mechanical assembly:
Similar to "Dim my_product_document as Product" in VB - but in Python

This should use both TypeLibs:

import win32com.client
catapp = win32com.client.Dispatch("CATIA.Application") # Connects to CATIA V5
and uses CATIA V5 Interfaces Object Library
my_product_document = catapp.ActiveDocument.Product #".Product" makes the error
my_product_document.Count()

But the last 2 lines gives me the following error:
AttributeError: '<win32com.gen_py.CATIA V5 InfInterfaces Object Library.Document
instance at 0x19543064>' object has no attribute 'Products'

Yes OK, the attribute "Product" is from "CATIA V5 ProductStructureInterfaces
Object Library" (which has the CLSID {5065F8B6-61BB-11D1-9D85-0000F8759F82})
and not from "CATIA V5 Interfaces Object Library" ("CATIA.Application") which I
automatically use.

When I try to use the CLSID of "CATIA V5 ProductStructureInterfaces Object
Library" I get a Class not registered:

import win32com.client
catapp = win32com.client.Dispatch("CATIA.Application") # Connects to CATIA V5
Interfaces Object Library
catprod = win32com.client.Dispatch("{5065F8B6-61BB-11D1-9D85-0000F8759F82}")#
Connects to CATIA V5 ProductStructureInterfaces Object Library

To get access to the wanted ProductDocument Object I get an error:
com_error: (-2147221164, 'Class not registered', None, None)

How can I register it ?

And how can I use both TypeLibs and can have access to the very important
Product-Object? The builtin VB editor makes everything
automatically...

best regards

Mustafa Görmezer

------------------------------------
htp - Hannovers Telefon Partner GmbH
http://www.htp-tel.de
Jul 18 '05 #1
0 3990

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: DD | last post by:
Hello, Could anyone please help me?? Is there somebody who could explain me how to make a connection to a access database with a python cgi script. I would like to use common sql commands in my...
0
by: goermezer | last post by:
Hello, I got it ! There was an example (for Office I think) in the test-directory of Pywin32, where I have the first lines from. But this is dynamic binding. Can anybody explain this for early...
3
by: Mark Line | last post by:
Hello! I'm a python n00b! I've been writing in c++ for a few years so programming's not new to me, just python that I don't know the syntax!
1
by: DD | last post by:
Hello, Could anyone please help me?? Is there somebody who could explain me how to make a connection to a access database with a python cgi script. I would like to use common sql commands in my...
4
by: bytecolor | last post by:
Hi people, Using win32com on 2k SP3... >>> import win32com.client as w32c >>> fc = w32c.Dispatch('Featurecam.Application') >>> fc.InstallPath u'C:\\PROGRA~1\\FEATUR~1' >>> Using win32com...
0
by: Grasshopper | last post by:
I am the as beginner as they come to VB 6.0. My project is to control another program through CATIA DesignTables (parameterized Excel sheets that update a CATIA model) through a VB interface. So I...
2
by: admv4 | last post by:
I want to know if it is possible to make a Windows file system or drive accessable to be written to and read from in Catia? I am running Catia V4.2 operating on AIX V5.3. I think that Microsoft has a...
3
by: Iain King | last post by:
I'm manipulating an MS Access db via ADODB with win32com.client. I want to rename a field within a table, but I don't know how to. I assume there is a line of SQL which will do it, but nothing...
2
by: tedpottel | last post by:
Hi, I cannot get the following code to work import win32com.client import time engine = win32com.client.Dispatch("DAO.DBEngine.36") db=engine.OpenDatabase(r"testdate2.mdb") access =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.