Results 1 to 11 of 11

Thread: How to get object from AutoCAD

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    VBAX Regular
    Joined
    Mar 2007
    Location
    Taipei
    Posts
    15
    Location

    Post

    I desrcibe wrong, I means Circle.
    Assume I put some circel on the drawing, and now I want to know these circle's radius and coordinations on Excel file, how could I do?
    I try a program, but it have to pick up circel one by one, can't select whole at one time. It takes time and sometimes miss some circles...
    And I have to open an Excel file because I want to put these informations on that.(or I don't need that?)


    Sub ShowCirclePoint()
        Dim MyXL As Object      
        Set MyXL = GetObject("D:\My Documents\AutoCAD testing.xls")
        Set xlsheet = MyXL.Worksheets("AutoCAD")
        xlsheet.cells(1, 1) = "No."
        xlsheet.cells(1, 2) = "Easting"
        xlsheet.cells(1, 3) = "Northing"
        xlsheet.cells(1, 4) = "Elevation"
        xlsheet.cells(1, 5) = "Radius"
        Dim objAcadEntity As AcadEntity     
        Dim centerPoint(0 To 2) As Double
        Dim circleObj As AcadCircle
        Dim radius As Double
        Dim cPoint As Variant
        Dim mCir As Double
        For mCir = 1 To 65000
            ThisDrawing.Utility.GetEntity objAcadEntity, varPickedPoint, "Please select Circle"
            If TypeOf objAcadEntity Is AcadCircle Then
                Set circleObj = objAcadEntity
                radius = circleObj.radius
                cPoint = circleObj.center
            End If
            xlsheet.cells(mCir + 1, 1) = mCir
            xlsheet.cells(mCir + 1, 2) = cPoint(0)
            xlsheet.cells(mCir + 1, 3) = cPoint(1)
            xlsheet.cells(mCir + 1, 4) = cPoint(2)
            xlsheet.cells(mCir + 1, 5) = radius
        Next
    End Sub
    Last edited by Aussiebear; 03-20-2025 at 06:31 AM. Reason: Adjusted the code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •