Vb api: how to modify points coordinates?
Hi,
I'm using vba to modify points in a .prt file.
Up to now I can read their coordinates, but I cannot change them. I thought the lines in red would do the job, but VBA seems to not recognize this command...
Sub test()
Dim asynconn As New pfcls.CCpfcAsyncConnection
Dim conn As pfcls.IpfcAsyncConnection
Dim session As pfcls.IpfcBaseSession
Dim i As Integer
Dim model As IpfcModelItemOwner
Dim points As IpfcModelItems
Dim lepoint As IpfcPoint
Dim pointPosition As IpfcPoint3D
Dim PtName As String
Set conn = asynconn.Connect("", "", ".", 5)
Set session = conn.session
Set model = session.CurrentModel()
Set points = model.ListItems(EpfcModelItemType.EpfcITEM_POINT)
Set piece = model
For i = 0 To points.Count - 1
PtName = points(i).GetName
Cells(i + 1, 1) = PtName
Set lepoint = points.Item(i)
Set pointPosition = lepoint.point
points.Item(i).SetName ("toto_" & i)
pointPosition.Set(0, Xvalue)
pointPosition.Set(1, Yvalue)
pointPosition.Set(2, Zvalue)
Next i
For i = 0 To points.Count - 1
PtName = points(i).GetName
Cells(i + 1, 1) = PtName
Set lepoint = points.Item(i)
Set pointPosition = lepoint.point
Cells(i + 1, 2) = pointPosition.Item(0)
Cells(i + 1, 3) = pointPosition.Item(1)
Cells(i + 1, 4) = pointPosition.Item(2)
Next i
conn.Disconnect (2)
End Sub
Anyone with an idea on the subject?
Thanks
Ce message a été modifié par: CHARLES CHARBIT

