JDear Jan Slegr, thank you very much for your help. So, the following code works fine as in the following a simple module:
Public Sub GetAllLinesCoordinates()
crlf = Chr(10) & Chr(13)
Dim oElement As Element
Dim line As LineElement
Dim vertices() As Point3d
Dim NumOfLines As Integer
Dim NumberOfPointsPerFeature() As Integer
Set ee = ActiveModelReference.GraphicalElementCache.Scan
i = 0
Do While ee.MoveNext
If ee.Current.IsLineElement Then
ReDim Preserve NumberOfPointsPerFeature(i) As Integer
Set oElement = ee.Current
End If
If (oElement.IsLineElement) Then
Set line = oElement.AsLineElement
vertices = line.GetVertices()
ReDim a(UBound(vertices)) As Point3d
For j = 0 To UBound(vertices)
a(j).X = Format(vertices(j).X, "0.00")
a(j).Y = Format(vertices(j).Y, "0.00")
a(j).Z = Format(vertices(j).Z, "0.00")
Next j
End If
NumberOfPointsPerFeature(i) = UBound(vertices) + 1
Dim msg, style, Title, Response
msg = ""
For k = 0 To UBound(a)
msg = msg & "X" & CStr(k + 1) & "= " & a(k).X _
& " Y" & CStr(k + 1) & "= " & a(k).Y _
& " Z" & CStr(k + 1) & "= " & a(k).Z & crlf
Next k
Title = "Point Coordinates Of Line No " & Str(i + 1)
style = vbInformation
Response = MsgBox(msg, style, Title)
i = i + 1
Loop
NumOfLines = i
Could above code be faster?
Please give me an other small example of selecting lines by user input not with the
CadInputQueue.SendDataPoint point, command.
Thank you in advance
Public Sub GetAllLinesCoordinates()
crlf = Chr(10) & Chr(13)
Dim oElement As Element
Dim line As LineElement
Dim vertices() As Point3d
Dim NumOfLines As Integer
Dim NumberOfPointsPerFeature() As Integer
Set ee = ActiveModelReference.GraphicalElementCache.Scan
i = 0
Do While ee.MoveNext
If ee.Current.IsLineElement Then
ReDim Preserve NumberOfPointsPerFeature(i) As Integer
Set oElement = ee.Current
End If
If (oElement.IsLineElement) Then
Set line = oElement.AsLineElement
vertices = line.GetVertices()
ReDim a(UBound(vertices)) As Point3d
For j = 0 To UBound(vertices)
a(j).X = Format(vertices(j).X, "0.00")
a(j).Y = Format(vertices(j).Y, "0.00")
a(j).Z = Format(vertices(j).Z, "0.00")
Next j
End If
NumberOfPointsPerFeature(i) = UBound(vertices) + 1
Dim msg, style, Title, Response
msg = ""
For k = 0 To UBound(a)
msg = msg & "X" & CStr(k + 1) & "= " & a(k).X _
& " Y" & CStr(k + 1) & "= " & a(k).Y _
& " Z" & CStr(k + 1) & "= " & a(k).Z & crlf
Next k
Title = "Point Coordinates Of Line No " & Str(i + 1)
style = vbInformation
Response = MsgBox(msg, style, Title)
i = i + 1
Loop
NumOfLines = i
Could above code be faster?
Please give me an other small example of selecting lines by user input not with the
CadInputQueue.SendDataPoint point, command.
Thank you in advance