Please download to get full document.

View again

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
  Sub Minhtan() On Error GoTo Minhtan Dim LWPolyline As AcadLWPolyline Dim Pointlist() As Double Dim Firstpt As Variant Dim Temppnt As Variant Dim Nextpnt As Variant Firstpt = ThisDrawing.Utility.GetPoint(, Pick the first point: ) ReDim Preserve Pointlist(1) As Double Pointlist(0) = Firstpt(0) Pointlist(1) = Firstpt(1) Temppnt = Firstpt Dim i As Integer i = 1 Do While Err.Number = 0 Nextpnt = ThisDrawing.Utility.GetPoint(Temppnt, pick the next point: ) i = i + 2 ReDim Preserve Pointlist(i) As Do
  Sub Minhtan() On Error GoTo Minhtan Dim LWPolyline As AcadLWPolyline Dim Pointlist() As Double Dim Firstpt As Variant Dim Temppnt As Variant Dim Nextpnt As Variant Firstpt = ThisDrawing.Utility.GetPoint(, Pick the first point: ) ReDim Preserve Pointlist(1) As Double Pointlist(0) = Firstpt(0) Pointlist(1) = Firstpt(1) Temppnt = Firstpt Dim i As Integer i = 1 Do While Err.Number = 0 Nextpnt = ThisDrawing.Utility.GetPoint(Temppnt, pick the next point: ) i = i + 2 ReDim Preserve Pointlist(i) As Double Pointlist(i - 1) = Nextpnt(0) Pointlist(i) = Nextpnt(1) Temppnt = Nextpnt LoopMinhtan: ThisDrawing.Utility.InitializeUserInput 1, Yes No  Dim strKword As String strKword = ThisDrawing.Utility.GetKeyword( Close the Polyline?[Yes/No] ) If UBound(Pointlist) > 1 Then 'Add Polyline in ModelSpace Set LWPolyline = ThisDrawing.ModelSpace.AddLightWeightPolyline(Pointlist) If strKword = Yes Then LWPolyline.Closed = True End If 'Add Text with No + Area + length Dim TextObj As AcadText 'Khai bao 2 diem de lay goc quay cho Text Dim P1(2) As Double Dim P2(2) As Double P1(0) = Pointlist(0): P1(1) = Pointlist(1) P2(0) = Pointlist(2): P2(1) = Pointlist(3) Dim TextAngle As Double TextAngle = ThisDrawing.Utility.AngleFromXAxis(P1, P2) Dim strArea As String, strLength As String strLength = Round(LWPolyline.Length / 1000, 2) If LWPolyline.Closed = True Then strArea = Round(LWPolyline.Area / 1000000, 2) Else strArea = 0  End If Dim strNo As String strNo = ThisDrawing.Utility.GetString(False, Please Enter the No. of Polyline: ) 'Chuoi can ghi vao trong ban ve sau khi ve Polyline thanh cong Dim strText As String strText = strNo & - A: & strArea & (m2) + L: & strLength & (m)    'Tao text Set TextObj = ThisDrawing.ModelSpace.AddText(strText, P1, 50) TextObj.Rotate P1, TextAngle Update End If Err.ClearEnd Sub
Related Search
Similar documents
View more
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks