Find out if polyline object include Arc and get Arc points

Find out if polyline object include Arc and get Arc points

jalal.mousa
Advocate Advocate
380 Views
1 Reply
Message 1 of 2

Find out if polyline object include Arc and get Arc points

jalal.mousa
Advocate
Advocate

Hi There

i am trying to get Coordinates of polyline to be used later for selection set

but when i have arc it only get me start point and end point of an arc

i am using point array to get all object within selection set but i am missing all objects inside Arc/Circle portion

how i can adjust code to include Arcs within point array

Set Flooringshape1 = Room
Test = True
If TypeOf Flooringshape1 Is AcadCircle Then
Set Floorcircle = Flooringshape
circleCen(0) = Floorcircle.center(0)
circleCen(1) = Floorcircle.center(1)

circleRad = Floorcircle.radius
 
 ElseIf TypeOf Flooringshape1 Is AcadLWPolyline Then
 
 If Flooringshape1.closed = True Then
            Set PL = Flooringshape1
           
            
           sarea = PL.area
           Slength = PL.length
        
          
          ReDim points(UBound(PL.Coordinates) + (UBound(PL.Coordinates) + 1) / 2 + 3) As Double
          ReDim savepoints(UBound(PL.Coordinates) + (UBound(PL.Coordinates) + 1) / 2 + 3) As Double
         Dim Roompoints() As Double
       
          ''dim v As Variant
          
          ' V is the Room 2D coordinates
          v = PL.Coordinates
          End If
        Dim i As Integer
        L = UBound(v)
        
        index = 0
 

 ' Change 2D Coordinates to 3D Z=0
            
            For i = 0 To UBound(v) Step 2
                points(index) = v(i)
                points(index + 1) = v(i + 1)
                points(index + 2) = 0
                
                index = index + 3
            Next
        points(index) = points(0)
        points(index + 1) = points(1)
        points(index + 2) = 0
        
        '3D Coordinates
        savepoints = points
        

End If

 

0 Likes
Accepted solutions (1)
381 Views
1 Reply
Reply (1)
Message 2 of 2

Ed__Jobe
Mentor
Mentor
Accepted solution

It seems that you are trying to flatten the plines. LWPolylines are 2D objects, i.e. the coordinates don't have a Z value. From Help:

"LightweightPolyline object: The variant is an array of 2D points in OCS."

 

You can simply use the FLATTEN command to move them to the WCS. If the points are not in the WCS, you need to transform the coordinates from the OCS to WCS or from the current UCS to WCS.

 

Anyway, the "arcs" in a pline are lines with a bulge factor applied. They do not have a center point. You would need to get the endpoints and using trigonometry, use the bulge factor to get the center point. If you search this forum for "bulge", there are some previous posts. Here's a thread at AUGI that might help.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes