×
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

Help>> How do I get the Object from a Reference

Help>> How do I get the Object from a Reference

Help>> How do I get the Object from a Reference

(OP)
I've found that I get different results depending if I select the object, say a point, from the tree compared to selecting from space. In the following script, if I select the point from the tree, I get the point name, the type is some kind of a point, and I get the coordinates. However, if I select the same point in space, I get a CATIAReference1 name, Reference as the type, and the GetCoordinates fails.


I know that you can make a Reference from an Object.
How do I retrieve the Object from the reference?

I also found that if the point is an intersect point in the tree, GetCoordinates fails....
How do I use an intersect as a point for Coordinates?

Sub CATMain()
Set CatDocs = Catia.Documents
Set ActiveDoc = CATIA.ActiveDocument
Set Select1 = ActiveDoc.selection
Dim InputType(0)
Dim Orig(2)
InputType(0) = "AnyObject"
Dim yesOrNo

do
Select1.clear()
str = Select1.SelectElement2(InputType,"Please select an object",false)
msgbox Select1.Item(1).value.name
msgbox typename (Select1.Item(1).value)
Select1.Item(1).value.GetCoordinates(Orig)

msgbox Orig(0)&", " & Orig(1)&", " & Orig(2)

If Result = "Cancel" Then
        MsgBox ("Command Canceled")
    Exit Sub
End If

yesOrNo = msgbox("Would you like to continue selecting objects?",4,"Selection Option")

If (yesOrNo = 7) then
str = "Cancel"
End If

Loop While str = "Normal"

End Sub

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