Product Coordinates

Программирование для CATIA.

Product Coordinates

Сообщение saravanakumarr » 13 июн 2012 14:08

Hello,

Programmatically how to extract the coordinates(X,Y,Z &
Angles) of all the children of a product.

I am using the below code. But an error comes as below
shown image.

Код: Выделить всё
For i = 1 To Products.Count

    Dim Product As Product
    Set Product = Products.Item(i)

    Dim ProductPos As Position
    Set ProductPos = Product.Position

    Dim iAxisComponentsArray(11)
    ProductPos.GetComponents iAxisComponentsArray

Next i


Error Msg:
Compile error: Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic.

:dash1:
saravanakumarr
Новичок
Новичок
 
Сообщения: 2
Зарегистрирован: 13 июн 2012 13:49

Re: Product Coordinates

Сообщение Artem » 14 июн 2012 08:47

Код: Выделить всё
Dim d As Product
Set d = CATIA.ActiveDocument.Selection.Item(1).Value
For i = 1 To d.Products.Count

    Dim Product As Product
    Set Product = d.Products.Item(i)

    Dim ProductPos 'As Position
    Set ProductPos = Product.Position

    Dim iAxisComponentsArray(11)
    ProductPos.GetComponents iAxisComponentsArray
    MsgBox CStr(iAxisComponentsArray(0)) + CStr(iAxisComponentsArray(1))

Next i

Try this. On the future - selection also not like "as selection"
animae scrinium servitus
Аватара пользователя
Artem
Активный участник
Активный участник
 
Сообщения: 387
Зарегистрирован: 14 сен 2007 07:14

Re: Product Coordinates

Сообщение saravanakumarr » 14 июн 2012 10:29

Thank you so much. That solved the problem.
saravanakumarr
Новичок
Новичок
 
Сообщения: 2
Зарегистрирован: 13 июн 2012 13:49

Re: Product Coordinates

Сообщение Wireless_Fidelity » 14 июн 2012 10:56

Индусы и сюда добрались...

Use search before asking. This will show your respect to the community. I believe you haven't even googled for your issue as there are hundreds pages that have a solution.
Аватара пользователя
Wireless_Fidelity
Активный участник
Активный участник
 
Сообщения: 394
Зарегистрирован: 10 апр 2010 00:11

Re: Product Coordinates

Сообщение [PTM] » 14 июн 2012 10:58

И среди них бывают нормальные программисты.
Изображение
Аватара пользователя
[PTM]
Moderator
 
Сообщения: 2159
Images: 43
Зарегистрирован: 13 сен 2007 13:03
Откуда: Rzn
Blog: View Blog (15)

Re: Product Coordinates

Сообщение AKB » 14 июн 2012 12:04

Wireless_Fidelity писал(а):Индусы и сюда добрались...

Seoul, Korea :-)
ಠ_ಠ
Аватара пользователя
AKB
Website Manager
 
Сообщения: 122
Зарегистрирован: 20 сен 2015 13:38
Откуда: Ленинград


Вернуться в CAA-RADE

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 1