theing
New member
- Mar 5, 2014
- 18
Good afternoon,
i have the following segment of code,
What i am trying to do, is to obtain the coordinates of each line, but while counting it gave me the number of lines, but when inserting in the vector lin, it is empty,
maybe i am missing something and i dont seeit, hope you can help me with this.
thank you
Set partDocument1 = CATIA.ActiveDocument
Set selection1 = partDocument1.Selection
selection1.Clear
Set part1 = partDocument1.Part
Set hybridBodies1 = part1.HybridBodies
Set hybridBody1 = hybridBodies1.Item("Geometrical Set.1")
selection1.Add hybridBody1
CATIA.ActiveDocument.Selection.Search("t:Line,sel")
lines = CATIA.ActiveDocument.Selection.count
ReDim lin(lines + 1)
For l = 1 To lines
Set lin(l) = CATIA.ActiveDocument.Selection.Item(l).Value
msgbox lin(l)
Next
for p = 0 to lin - 1
CATIA.ActiveDocument.Selection.Clear
CATIA.ActiveDocument.Selection.Add (lin(p))
Set oPartDoc = CATIA.ActiveDocument.Part
Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench")
Set oSel = CATIA.ActiveDocument.Selection
On Error Resume Next
Set oRef = oSel.Item(1).Value
oRef.GetPointsOnCurve (coord)
xi = coord(0)
yi = coord(1)
zi = coord(2)
xf = coord(3)
yf = coord(4)
zf = coord(5)
msgbox xi
msgbox yi
msgbox zi
msgbox xf
msgbox yf
msgbox zf
Next
i have the following segment of code,
What i am trying to do, is to obtain the coordinates of each line, but while counting it gave me the number of lines, but when inserting in the vector lin, it is empty,
maybe i am missing something and i dont seeit, hope you can help me with this.
thank you
Set partDocument1 = CATIA.ActiveDocument
Set selection1 = partDocument1.Selection
selection1.Clear
Set part1 = partDocument1.Part
Set hybridBodies1 = part1.HybridBodies
Set hybridBody1 = hybridBodies1.Item("Geometrical Set.1")
selection1.Add hybridBody1
CATIA.ActiveDocument.Selection.Search("t:Line,sel")
lines = CATIA.ActiveDocument.Selection.count
ReDim lin(lines + 1)
For l = 1 To lines
Set lin(l) = CATIA.ActiveDocument.Selection.Item(l).Value
msgbox lin(l)
Next
for p = 0 to lin - 1
CATIA.ActiveDocument.Selection.Clear
CATIA.ActiveDocument.Selection.Add (lin(p))
Set oPartDoc = CATIA.ActiveDocument.Part
Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench")
Set oSel = CATIA.ActiveDocument.Selection
On Error Resume Next
Set oRef = oSel.Item(1).Value
oRef.GetPointsOnCurve (coord)
xi = coord(0)
yi = coord(1)
zi = coord(2)
xf = coord(3)
yf = coord(4)
zf = coord(5)
msgbox xi
msgbox yi
msgbox zi
msgbox xf
msgbox yf
msgbox zf
Next