Elias 发表于 2022-7-6 21:05:11

Can't Select an object fr

        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
         
         
         
         
       
       

BIGAL 发表于 2022-7-6 22:34:49

 
        Maybe look carefully at this line what is extra ?
         
        ThisDrawing.Utility.GetEntity CADObject, basePnt, "Select a Light Weight Polyline"""
页: [1]
查看完整版本: Can't Select an object fr