Relations3D Select doesn't work

Phenom
Phenom

I'm trying to edit an exisisting Relation3D of an accourence in an Assembly.

 

I have located the Relation3D in the Assembly Relations3D collection but when I call the "Select" method nothing happens.

 

My purpose is to start command number 39002 after the selection to interactively edit the relation.

 

If select the relation manually it works if I select by API it doesn't.

 

Also the example found in SDK doesn't work:

 

Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgeAssembly.AssemblyDocument
Dim objAxialRel As SolidEdgeAssembly.AxialRelation3d
Const TESTFILE = "T:\vbtests\testcases\Sample.asm"
' Report errors
Const PI = 3.14159265358979
' Create/get the application with specific settings
On Error Resume Next
Set objApp = GetObject(, "SolidEdge.Application")
If Err Then
Err.Clear
Set objApp = CreateObject("SolidEdge.Application")
Set objDoc = objApp.Documents.Add("SolidEdge.AssemblyDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If
Call objDoc.Close
' opening an existing assembly document
Set objDoc = objApp.Documents.Open(TESTFILE)
' getting a particular axial relation in the collection
Set objAxialRel = objDoc.Relations3d.Item(2)
' selecting the relation
Call objAxialRel.Select(Replace:=True)
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objAxialRel = Nothing
End Sub

 

Any help or advise on how to accomplish ?

 

4 REPLIES

Re: Relations3D Select doesn't work

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Put the specific Occurrence into the select set and try the StartCommand() again.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Relations3D Select doesn't work

Phenom
Phenom

jnewell wrote:

Put the specific Occurrence into the select set and try the StartCommand() again.


In this way the command start the creation of a new relation in the specific occurrence.

What I want to do is entering the editing of the existing failed relation.

 

This is my specific code:

 

Dim objApp As SolidEdgeFramework.Application
Dim objAsm As SolidEdgeAssembly.AssemblyDocument

Dim lngGeomType As Long
Dim dblPoint(1 To 3) As Double
Dim dblVector(1 To 3) As Double

Sub Main()

Set objApp = GetObject(, "SolidEdge.Application")
Set objAsm = objApp.ActiveDocument
objApp.Visible = True

For Each Item In objAsm.Relations3d

If Item.Status = 0 Then

If Item.DetailedStatus = 6 Then

Debug.Print Item.Index
Debug.Print Item.Occurrence1.Name
Debug.Print Item.Occurrence2.Name

On Error Resume Next

Call Item.GetGeometry1(GeometryType:=lngGeomType, PointX:=dblPoint(1), PointY:=dblPoint(2), _
PointZ:=dblPoint(3), VectorX:=dblVector(1), VectorY:=dblVector(2), VectorZ:=dblVector(3))

If Err.Number = -2147467259 Then Debug.Print "Geometry 1 missing": Err.Clear

Call Item.GetGeometry2(GeometryType:=lngGeomType, PointX:=dblPoint(1), PointY:=dblPoint(2), _
PointZ:=dblPoint(3), VectorX:=dblVector(1), VectorY:=dblVector(2), VectorZ:=dblVector(3))

If Err.Number = -2147467259 Then Debug.Print "Geometry 2 missing": Err.Clear

On Error GoTo 0

objAsm.SelectSet.RemoveAll
objAsm.SelectSet.RefreshDisplay
objAsm.SelectSet.Add Item.Occurrence1

objApp.StartCommand (39002)

End If

End If

Next Item

Set objAsm = Nothing
Set objApp = Nothing

End Sub

 

Any solution ?

Re: Relations3D Select doesn't work

Phenom
Phenom

I just realized that there is a RelationshipsSelectSet collection, owever I'm not able to add the relation to this collection, the .add method doesn't add it. I did try to also add the occurrence but still doesn't work.

 

the SDK is so poor documented about this properties.

 

Any help ?

 

Thanks

 

Francesco

Re: Relations3D Select doesn't work

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Francesco,

 

Unfortunately, I do not think you are going to be able to accomplish what you are trying to do through automation. As Jason mentioned, the occurrence being edited is the only object that should be in the select set before starting the command. However, the way we determine which relationship is the one to edit does not use the select set and is currently not exposed through the API.

 

Greg