Hello All,
I'm trying to create a ployline from a text file. I use a similar code to create lines from point to point. What is missing in this code? It appears to only create the first point in the file.
Do While Not EOF(1)
Input #1, number, XCOORD, YCOORD, ZCOORD, code
Set myPoints = Library.CreatePoints
Set pt = Library.CreatePoint(XCOORD, YCOORD, ZCOORD)
myPoints.Add
myPoints(myPoints.Count).x = pt.x
myPoints(myPoints.Count).y = pt.y
myPoints(myPoints.Count).z = pt.z
Loop
Close #1
Set myPline = ThisDocument.ModelSpace.AddPolyline(myPoints)
myPline.Update
ThisDocument.ActiveViewport.ZoomExtents
thanks MikeC
#2
MikeC,
The problem may be 'Z' coordinates greater than zero in the text file.
You would need a 3DPolyline to be able to draw these.
I have created some VBA code as an example:
Sub TestPLine()
Dim myPLine As Polyline3D
Dim myPoints As Points
Dim x As Double
Dim y As Double
Dim z As Double
Dim I As Integer
'Start Values
x = 1
y = 2
z = 3
Set myPoints = Library.CreatePoints
'Loop Here
Do Until I = 10
myPoints.Add
myPoints(myPoints.Count).x = x
myPoints(myPoints.Count).y = y
myPoints(myPoints.Count).z = z
x = x + 10
y = y + 20
z = z + 30
I = I + 1
Loop
' Create 3D Polyline
Set myPLine = ThisDocument.ModelSpace.Add3DPoly(myPoints)
myPLine.Update
End Sub
Regards
John Finlay
The problem may be 'Z' coordinates greater than zero in the text file.
You would need a 3DPolyline to be able to draw these.
I have created some VBA code as an example:
Sub TestPLine()
Dim myPLine As Polyline3D
Dim myPoints As Points
Dim x As Double
Dim y As Double
Dim z As Double
Dim I As Integer
'Start Values
x = 1
y = 2
z = 3
Set myPoints = Library.CreatePoints
'Loop Here
Do Until I = 10
myPoints.Add
myPoints(myPoints.Count).x = x
myPoints(myPoints.Count).y = y
myPoints(myPoints.Count).z = z
x = x + 10
y = y + 20
z = z + 30
I = I + 1
Loop
' Create 3D Polyline
Set myPLine = ThisDocument.ModelSpace.Add3DPoly(myPoints)
myPLine.Update
End Sub
Regards
John Finlay
Create polyline from file
#3John,
After looking at your code i moved "set mypoints=library.createpoints"
out of the do loop. works as planned now.
Thanks MikeC
After looking at your code i moved "set mypoints=library.createpoints"
out of the do loop. works as planned now.
Thanks MikeC