Страница 1 из 1

Product Coordinates

СообщениеДобавлено: 13 июн 2012 14:08
saravanakumarr
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:

Re: Product Coordinates

СообщениеДобавлено: 14 июн 2012 08:47
Artem
Код: Выделить всё
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"

Re: Product Coordinates

СообщениеДобавлено: 14 июн 2012 10:29
saravanakumarr
Thank you so much. That solved the problem.

Re: Product Coordinates

СообщениеДобавлено: 14 июн 2012 10:56
Wireless_Fidelity
Индусы и сюда добрались...

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.

Re: Product Coordinates

СообщениеДобавлено: 14 июн 2012 10:58
[PTM]
И среди них бывают нормальные программисты.

Re: Product Coordinates

СообщениеДобавлено: 14 июн 2012 12:04
AKB
Wireless_Fidelity писал(а):Индусы и сюда добрались...

Seoul, Korea :-)