Dam chu C
Dim duongbao As AcadLWPolyline
Dim thep As AcadLWPolyline
Dim diem1(0 To 17) As Double
Dim diem2(0 To 7) As Double
Dim diema(0 To 2) As Double
Dim diemb(0 To 2) As Double
Dim diemxoay(0 To 2) As Double
Dim gocxoay As Double
Dim kichthuoc, kichthuoc1, kichthuoc2, kichthuoc3, kichthuoc4 As AcadDimAligned
Dim doixung1, doixung2, doixung3, doixung4, doixung5, doixung6, doixung7 As AcadLWPolyline
Private Sub cmdKichThuoc_Click()
Dim kt As AcadDimStyle
Set kt = ThisDrawing.DimStyles.Add("kt")
ThisDrawing.SetVariable "DIMTIH", 0
ThisDrawing.SetVariable "DIMSCALE", 1
ThisDrawing.SetVariable "DIMTIH", 0
ThisDrawing.SetVariable "DIMDEC", 1
ThisDrawing.SetVariable "DIMTAD", 1
kt.CopyFrom ThisDrawing
ThisDrawing.ActiveDimStyle = kt
Application.Update
Dim d1(0 To 2) As Double
Dim d2(0 To 2) As Double
Dim d3(0 To 2) As Double
d1(0) = diem1(2)
d1(1) = diem1(3)
d1(2) = 0
d2(0) = diem1(4)
d2(1) = diem1(5)
d2(2) = 0
d3(0) = diem1(2) - 2
d3(1) = diem1(3) - 2
d3(2) = 0
Set kichthuoc = ThisDrawing.ModelSpace.AddDimAligned(d1, d2, d3)
kichthuoc.color = acMagenta
kichthuoc.Update
Dim d4(0 To 2) As Double
Dim d5(0 To 2) As Double
Dim d6(0 To 2) As Double
d4(0) = diem1(6)
d4(1) = diem1(7)
d4(2) = 0
d5(0) = diem1(8)
d5(1) = diem1(9)
d5(2) = 0
d6(0) = diem1(2) + 2
d6(1) = diem1(3) + 6
d6(2) = 0
Set kichthuoc1 = ThisDrawing.ModelSpace.AddDimAligned(d4, d5, d6)
kichthuoc1.color = acMagenta
kichthuoc1.Update
Dim d7(0 To 2) As Double
Dim d8(0 To 2) As Double
Dim d9(0 To 2) As Double
d7(0) = diem1(8)
d7(1) = diem1(9)
d7(2) = 0
d8(0) = diem1(10)
d8(1) = diem1(11)
d8(2) = 0
d9(0) = diem1(8) + 4
d9(1) = diem1(9) + 2
d9(2) = 0
Set kichthuoc2 = ThisDrawing.ModelSpace.AddDimAligned(d7, d8, d9)
kichthuoc2.color = acMagenta
kichthuoc2.Update
Dim d10(0 To 2) As Double
Dim d11(0 To 2) As Double
Dim d12(0 To 2) As Double
d10(0) = diem1(0)
d10(1) = diem1(1)
d10(2) = 0
d11(0) = diem1(2)
d11(1) = diem1(3)
d11(2) = 0
d12(0) = diem1(2) - 2
d12(1) = diem1(3) + 2
d12(2) = 0
Set kichthuoc3 = ThisDrawing.ModelSpace.AddDimAligned(d10, d11, d12)
kichthuoc3.color = acMagenta
kichthuoc3.Update
Dim d13(0 To 2) As Double
Dim d14(0 To 2) As Double
Dim d15(0 To 2) As Double
d13(0) = diem1(0)
d13(1) = diem1(1)
d13(2) = 0
d14(0) = diem1(0) + txtt.Text
d14(1) = diem1(1)
d14(2) = 0
d15(0) = diem1(2) + 2
d15(1) = diem1(3) + 6
d15(2) = 0
Set kichthuoc4 = ThisDrawing.ModelSpace.AddDimAligned(d13, d14, d15)
kichthuoc4.color = acMagenta
kichthuoc4.Update
End Sub
Private Sub cmdVehinh2_Click()
diema(0) = txtXa.Text
diema(1) = txtYa.Text
diema(2) = 0
diemb(0) = txtXb.Text
diemb(1) = txtYb.Text
diemb(2) = 0
On Error Resume Next
Set doixung1 = duongbao.Mirror(diema, diemb)
Set doixung2 = thep.Mirror(diema, diemb)
Set doixung3 = kichthuoc.Mirror(diema, diemb)
Set doixung4 = kichthuoc1.Mirror(diema, diemb)
Set doixung5 = kichthuoc2.Mirror(diema, diemb)
Set doixung6 = kichthuoc3.Mirror(diema, diemb)
Set doixung7 = kichthuoc4.Mirror(diema, diemb)
doixung1.Update
doixung2.Update
doixung3.Update
doixung4.Update
doixung5.Update
doixung6.Update
doixung7.Update
Application.Update
End Sub
Private Sub cmdVehinh1_Click()
diem1(0) = txtX.Text: diem1(1) = txtY.Text
diem1(2) = diem1(0): diem1(3) = diem1(1) - txth
diem1(4) = diem1(2) + txtBd: diem1(5) = diem1(3)
diem1(6) = diem1(4): diem1(7) = diem1(5) + txth
diem1(8) = diem1(6) - txtb: diem1(9) = diem1(7)
diem1(10) = diem1(8): diem1(11) = diem1(9) - txth + txta
diem1(12) = diem1(10) - txtBd + 2 * txtb: diem1(13) = diem1(11)
diem1(14) = diem1(12): diem1(15) = diem1(13) + txth - txta
diem1(16) = diem1(0): diem1(17) = diem1(1)
Set duongbao = ThisDrawing.ModelSpace.AddLightWeightPolyline(diem1)
duongbao.color = acGreen
diem2(0) = diem1(0) + txtt.Text: diem2(1) = diem1(1) - txtt1.Text
diem2(2) = diem2(0): diem2(3) = diem2(1) + txtt1 + txtt - txth
diem2(4) = diem2(2) + txtBd - 2 * txtt: diem2(5) = diem2(3)
diem2(6) = diem2(4): diem2(7) = diem2(5) + txth - 2 * txtt
Set thep = ThisDrawing.ModelSpace.AddLightWeightPolyline(diem2)
thep.color = acRed
ZoomAll
End Sub
Private Sub cmdXoay_Click()
diemxoay(0) = txtXx.Text
diemxoay(1) = txtYx.Text
diemxoay(2) = 0
gocxoay = 3.1415926535 * txtGoc / 180
duongbao.Rotate diemxoay, gocxoay
thep.Rotate diemxoay, gocxoay
kichthuoc.Rotate diemxoay, gocxoay
kichthuoc1.Rotate diemxoay, gocxoay
kichthuoc2.Rotate diemxoay, gocxoay
kichthuoc3.Rotate diemxoay, gocxoay
kichthuoc4.Rotate diemxoay, gocxoay
kichthuoc.Update
kichthuoc1.Update
kichthuoc2.Update
kichthuoc3.Update
kichthuoc4.Update
duongbao.Update
thep.Update
Application.Update
End Sub
Bạn đang đọc truyện trên: Truyen247.Pro