×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

HOW TO GET POSITION AND ROTATION VALUES

HOW TO GET POSITION AND ROTATION VALUES

HOW TO GET POSITION AND ROTATION VALUES

(OP)
Hi, I want to get position values and rotation values which belongs interfaces by creating macro?CAn you give me any idea?Thank you.

RE: HOW TO GET POSITION AND ROTATION VALUES

Do you want to measure distance and angle between two objects ?

RE: HOW TO GET POSITION AND ROTATION VALUES

(OP)
Actually,I want to measure an interface coordinates or position values(X,Y,Z,ROTX,RotY,RotZ) from world zero.

RE: HOW TO GET POSITION AND ROTATION VALUES

(OP)
For example, I found my part's volume and mass thanks to below codes.And also ı want to figure out position (x,y,z,rotx,roty,rotz) by like these codes.Is it possible?Thanks a lot now.

MsgBox "Part Volume: " &MyProduct.Analyze.Volume
MsgBox "Part Mass: " &MyProduct.Analyze.Mass

Option Explicit

Dim strSearch As String
Dim PartFound As Boolean
'Dim MySelection As Selection

Sub CATMain()

Dim MyDoc As Document
Dim MyProduct As Product

Set MyDoc = CATIA.ActiveDocument
Set MyProduct = MyDoc.Product
'Set MySelection = MyDoc.Selection

strSearch = InputBox("Input Search String")
PartFound = False

If strSearch = "" Then
MsgBox "Search String is Empty", vbExclamation, "Error"
End
End If

Call Traverse(MyProduct)

If PartFound = True Then
MsgBox "Part Found", vbInformation, "Success"
Else
MsgBox "Part Not Found", vbExclamation, "Fail"
End If

End Sub

Sub Traverse(MyProduct As Product)

Dim i As Integer
Dim PartName As String

If PartFound = True Then
Exit Sub
End If

For i = 1 To MyProduct.Products.Count

If MyProduct.Products.Item(i).Products.Count = 0 Then

PartName = MyProduct.Products.Item(i).ReferenceProduct.Parent.Name

If PartName = strSearch Then

PartFound = True

Dim MySelection As Selection
Set MySelection = MyProduct.Parent.Selection

MySelection.Clear
MySelection.Add MyProduct.Products.Item(i)

CATIA.StartCommand "center graph"
CATIA.StartCommand "reframe on"
MsgBox "Part Volume: " &MyProduct.Analyze.Volume
MsgBox "Part Mass: " &MyProduct.Analyze.Mass


End If

Else

Call Traverse(MyProduct.Products.Item(i).ReferenceProduct)

End If

Next

End Sub

RE: HOW TO GET POSITION AND ROTATION VALUES

Actually I am not able to find the solution to your problem either manually or through macro. I am searching for the same. If I find it I'll let you know. May be someone else will do it for you

RE: HOW TO GET POSITION AND ROTATION VALUES

(OP)
Thank you Iam just want to be clear.By this way I shared this explanation.I am glad to help :)

RE: HOW TO GET POSITION AND ROTATION VALUES

Hi,

First advice, check Eric's post about posting pictures, if you are on a mobile connection you don't want to do traffic downloading a bmp file with big size, so you will not get an answer so soon.

Second advice is to check the v5automation.chm file in CATIA installation folder, there is an example there how to copy-paste-keep-absolute-position of a product, you can use it to understand more things.

Regards
Fernando

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: HOW TO GET POSITION AND ROTATION VALUES

(OP)
Firts of all thank you a lot dear ferdo.I cared your advices appreciately. Altough I have subscirption his blog, the blog still ask me password and I did not receive any password from.Just an email is sent and it said "EMAIL Subscription Confirmed" but I dont still access.

Secondly I tried to entegrate copy-paste code unfortunately I am unsuccesful about this.I add text file.This file returns "set component is not supported in Visual basic" compile error.How can I figure out?

Regards

RE: HOW TO GET POSITION AND ROTATION VALUES

(OP)
Actually it is confusing.briefly ı try to explain again sorry about amateur student mavement:( I add new one.I understood calculation matrix and inverse but how can I have myInputPart's X,Y,Z values?I mean my target is which I want to have position values I want to access,so I did not entegrate and call in CATMain.If I didnot tell I can try can and give more detail.

RE: HOW TO GET POSITION AND ROTATION VALUES


This is what you are looking for:

CODE --> CATVBA

...

Dim oAxisComponentsArray(11)

prod.Position.GetComponents oAxisComponentsArray

... 

Check the online doc to understand the oAxisComponentsArray(11) values...

Eric N.
indocti discant et ament meminisse periti

RE: HOW TO GET POSITION AND ROTATION VALUES

(OP)
Thank you itsmyjob.I checked v5automation.chm before and until the now I understood that RotX,RotY,RotZ values(it means you know for example:45degrees,0 degrees,90 degrees etc.)I cannot reach by this method.Can you give me any idea for this problem?

RE: HOW TO GET POSITION AND ROTATION VALUES

Well, you will have to do some math as this is what CATIA gives you.

Eric N.
indocti discant et ament meminisse periti

RE: HOW TO GET POSITION AND ROTATION VALUES

(OP)
It is OK itsmyjobs I will struggle about this.I am glad your support.I hope overcome that.
REGARDS

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources