l3ob
Aerospace
- Apr 28, 2004
- 56
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
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