Elias Posted September 29, 2020 Posted September 29, 2020 Hi there, I find the code that can help me to select an object from Model Space but it gives me an error I tried to solve it but I failed can you please help me. Kindly find the attached pictures to be more clear. Code: Private Sub CommandButton1_Click() Dim CADObject As AcadLWPolyline Dim i As Integer Dim x As Double, y As Double Open "D:\ExtractCoordinatesOfALWPolylineLWPolylineCordinates.txt" For Output As #1 Dim basePnt As Variant ThisDrawing.Utility.GetEntity CADObject, basePnt, "Select a Light Weight Polyline""" Dim Cords As Variant Cords = CADObject.Coordinates For i = LBound(Cords) To UBound(Cords) Step 2 x = Format(CADObject.Coordinates(i), "0.000") y = Format(CADObject.Coordinates(i + 1), "0.000") Print #1, x; y Next i Dim length As Double length = Format(CADObject.length, "0.000") Print #1, vbCrLf; "Length; of; the; Selected; LW; polyline Is "; length Print #1, vbCrLf; "Number; of; Vertices; of; the; Selected; polyline Is "; (UBound(Cords) + 1) / 2 Close (1) End Sub Quote
BIGAL Posted September 30, 2020 Posted September 30, 2020 Maybe look carefully at this line what is extra ? ThisDrawing.Utility.GetEntity CADObject, basePnt, "Select a Light Weight Polyline""" Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.