Jump to content

Can't Select an object from model space


Elias
 Share

Recommended Posts

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

 

 

 

 

VBA PL.jpg

VBA ERROR.jpg

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...