Trai xây dựng làm thơ trên giàn giáo
Lấy cốp pha làm nơi đỡ tình yêu
Dùng xi măng gắn những lần hờn dỗi
Lẫn cả bê tông trong những cái hôn chiều
!!!!!!!!! PANADOL!!!!!!!!!!!!!!!



 
IndexPortal*CalendarGalleryTrợ giúpTìm kiếmThành viênNhómĐăng kýĐăng Nhập
Diễn đàn SVXD
CẢNH BÁO CÁC HÀNH VI SPAM
Sun Feb 13, 2011 7:54 am by admin
khi lập ra diễn đàn này tôi chỉ muốn nó là một kênh thông tin chia sẻ học tập và giải trí .và không có ý định biến nó thành một trang báo mạng .nên …

Comments: 0
Latest topics
Liên kết đến web trường
NÓC NHÀ VIỆT
Diễn đàn lớp 53KD3
Top posters
admin (263)
 
milulayb (256)
 
mr_khanh (244)
 
phongvjp36 (211)
 
lechicuong (184)
 
rukawa (136)
 
whitehorse5790 (118)
 
mR_LaLa (101)
 
Tony Ruan (69)
 
lantieuthu (58)
 
December 2016
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 
CalendarCalendar
Poll
Diễn đàn SVXD

Share | 
 

 cáh làm VBA

Xem chủ đề cũ hơn Xem chủ đề mới hơn Go down 
Tác giảThông điệp
a_ca
nhân viên thử việc


Tổng số bài gửi : 21
Points : 43

Bài gửiTiêu đề: cáh làm VBA   Sun Oct 24, 2010 6:07 pm

cáh làm là chiu khó lấy một bản vẽ rồi move nó về tọa độ (0,0) rùi có mấy dòng lệnh cóp lại chỉ là mấy dòng lệnh pline và line,sau đó từ trong bản vẽ cad lấy tọa độ tuyệt đối của từng điểm,chịu khó mà làm đi để còn thi nữa,hiểu một bài thì làm mấy bài kia tương tự thôi,mai ai có bài thì mang lên sớm để mấy đứa copy nộp,ai biết làm rùi thì cố gắng làm mấy bài chưa up lên để mọi người có bài nộp nha!
chịu khó ngồi mò đi,ngồi cả buổi chiều mà mới biết làm như thế nào thui




Bai so 1




'Khai bao cac bien layer
Dim kichthuoc As AcadLayer
Dim cotdai As AcadLayer
Dim vienmong As AcadLayer
Dim thep As AcadLayer
Dim thep1 As AcadLayer
Dim thepngang As AcadLayer
Dim truc As AcadLayer
Dim an As AcadLayer
Dim netdut As AcadLayer
'Khai bao toa do ban dau
Dim px As Double
Dim py As Double
'Khai bao bien cua hatch
Dim hatchobj As AcadHatch
Dim lopp(0 To 0) As AcadEntity
'Khai bao 2 diem cua mirror
Dim mr1(0 To 2) As Double
Dim mr2(0 To 2) As Double
'Khai bao cau Array
Dim sohang As Double
Dim socot As Double
Dim kch As Double
Dim kcc As Double
Dim lever As Double
Dim lever2 As Double
'Khai Bao SelectionSet
Dim sset As AcadSelectionSet



'********************************************
'Sub Ve Hinh
'********************************************
Sub vehinh2()

'********************************************
'VE MAT DUNG MONG COC BTCT
'********************************************


taolayer 'Khoi tao layer
px = Val(txtx) 'gan toa do x
py = Val(txty) 'gan toa do y
ThisDrawing.ActiveLayer = vienmong 'doi layer hien hanh
'Ve vua lot bt
Dim pline1 As AcadLWPolyline
've pline
Set pline1 = Vehinh.duongpline(px - 1450, py, px - 1450, py + 100, px + 1450, py + 100, px + 1450, py)
pline1.Closed = True 'Dong pline
Set lopp(0) = pline1 'Gan pline vao obj de to
ThisDrawing.ActiveLayer = kichthuoc 'doi layer
'To ki hieu vua cho pline
taohatch "AR-CONC"
hatchobj.AppendOuterLoop (lopp)
hatchobj.PatternScale = 1
hatchobj.PatternScale = hatchobj.PatternScale + 20 'Thay doi ty le
hatchobj.Evaluate 'Cap nhap thay doi
Application.Update
ThisDrawing.ActiveLayer = vienmong 'Doi layer
've duong bao ngoai
Set pline1 = Vehinh.duongpline(px - 1350, py + 100, px - 1350, py + 1000, px - 400, py + 1000, px - 400, py + 2000)
'lay doi xung sang nua ben phai
Dim mirro1 As AcadLWPolyline
mr1(0) = px
mr1(1) = py
mr1(2) = 0
mr2(0) = px
mr2(1) = py + 2000
mr2(2) = 0
Set mirro1 = pline1.Mirror(mr1, mr2)
Dim line1 As AcadLine
Set line1 = Vehinh.duongthang(px - 400, py + 2000, px + 400, py + 2000)
ThisDrawing.ActiveLayer = thep1 'Doi layer
'Ve duong thep ben trong
Set pline1 = Vehinh.duongpline(px - 1300, py + 200, px - 1300, py + 950, px + 1300, py + 950, px + 1300, py + 200)
pline1.Closed = True
ThisDrawing.ActiveLayer = vienmong
've cac doan dau coc ben tren vua lot
Dim mirro2 As AcadLine
Set line1 = Vehinh.duongthang(px - 125, py + 100, px - 125, py + 200)
Set mirro2 = line1.Mirror(mr1, mr2)
Set line1 = Vehinh.duongthang(px - 1225, py + 100, px - 1225, py + 200)
Set mirro2 = line1.Mirror(mr1, mr2)
Set line1 = Vehinh.duongthang(px - 975, py + 100, px - 975, py + 200)
Set mirro2 = line1.Mirror(mr1, mr2)
ThisDrawing.ActiveLayer = thep
Set pline1 = Vehinh.duongpline(px - 700, py + 250, px - 350, py + 250, px - 350, py + 2500, px - 280, py + 2400)
Set mirro1 = pline1.Mirror(mr1, mr2)
ThisDrawing.ActiveLayer = kichthuoc
'Ve cac thep ngang ky hieu hinh tron
Dim cirle1 As AcadCircle
Set cirle1 = Vehinh.duongtron(px - 1275, py + 225, 25) 've hinh tron o goc trai ben duoi
Set lopp(0) = cirle1
taohatch "SOLID" 'Chon mau to la SOILD
hatchobj.AppendOuterLoop (lopp) 'To kin hinh tron
sohang = 1
socot = 14
kch = 1
kcc = 198
lever = 1
lever2 = 1
Dim arrayobj1 As Variant
arrayobj1 = hatchobj.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2) 'Dung Array de ve cac hinh con lai
mr1(0) = px - 1000
mr1(1) = py + 575
mr2(0) = px + 1000
mr2(1) = py + 575
Dim mirro3 As AcadHatch
Set mirro3 = hatchobj.Mirror(mr1, mr2) 'lay doi xung len phia tren
arrayobj1 = mirro3.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2) 'array hinh vua lay doi xung
'Doi toa do 2 diem doi xung
mr1(1) = py + 400
mr2(1) = py + 400
Set mirro3 = hatchobj.Mirror(mr1, mr2) 'Lay doi xung o giua (ben trai)
'Doi toa do 2 diem doi xung
mr1(0) = px
mr1(1) = py
mr1(2) = 0
mr2(0) = px
mr2(1) = py + 2000
mr2(2) = 0
Set mirro3 = mirro3.Mirror(mr1, mr2) 'lay doi xung sang phai (hinh tron o giua)
've cac thep dau coc = ve cac duong line ben trai quay 1 goc 10 do roi lay doi xung sang phai
ThisDrawing.ActiveLayer = vienmong
Set line1 = Vehinh.duongthang(px - 75, py + 200, px - 75, py + 600) 'Ve duong thang
Dim goc As Double
goc = 10 * 3.1416 / 180
Dim ropoint(0 To 2) As Double
ropoint(0) = px - 75
ropoint(1) = py + 200
ropoint(2) = 0
line1.Rotate ropoint, goc 'Quay
Set mirro2 = line1.Mirror(mr1, mr2) 'Lay doi xung
Set line1 = Vehinh.duongthang(px - 1175, py + 200, px - 1175, py + 600)
ropoint(0) = px - 1175
line1.Rotate ropoint, goc
Set mirro2 = line1.Mirror(mr1, mr2)
Set line1 = Vehinh.duongthang(px - 1025, py + 200, px - 1025, py + 600)
ropoint(0) = px - 1025
line1.Rotate ropoint, -goc
Set mirro2 = line1.Mirror(mr1, mr2)

ThisDrawing.ActiveLayer = cotdai 'doi layer de ve cot dai
Set line1 = Vehinh.duongthang(px - 350, py + 250 + 200, px + 350, py + 250 + 200) 've cot dai duoi cung
sohang = 8
socot = 1
kch = 200
kcc = 1
arrayobj1 = line1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2) 'array cot dai do thanh nhung cai khac
ThisDrawing.ActiveLayer = vienmong
'Ve cac doan coc duoi cung
Set pline1 = Vehinh.duongpline(px - 125, py - 800, px - 25, py - 800, px, py - 750, px, py - 850)
Dim pline2 As AcadLWPolyline
Set pline2 = Vehinh.duongpline(px + 125, py - 800, px + 25, py - 800, px, py - 850, px, py - 750)
Set line1 = Vehinh.duongthang(px - 125, py - 800, px - 125, py)
Dim line2 As AcadLine

mr1(0) = px + 550
mr1(1) = py - 1000
mr2(0) = px + 550
mr2(1) = py
Set mirro1 = pline1.Mirror(mr1, mr2)
Set mirro1 = pline2.Mirror(mr1, mr2)
Set mirro2 = line1.Mirror(mr1, mr2)
Set line2 = Vehinh.duongthang(px + 125, py - 800, px + 125, py)
Set mirro2 = line2.Mirror(mr1, mr2)
mr1(0) = px - 550
mr2(0) = px - 550
Set mirro1 = pline1.Mirror(mr1, mr2)
Set mirro1 = pline2.Mirror(mr1, mr2)
Set mirro2 = line1.Mirror(mr1, mr2)
Set mirro2 = line2.Mirror(mr1, mr2)
Set line1 = Vehinh.duongthang(px - 1450, py, px - 1950, py)
ThisDrawing.ActiveLayer = kichthuoc
'Ve mui ten ben duoi
Set line1 = Vehinh.duongthang(px - 1500, py + 100, px - 1950, py + 100)
Set line1 = Vehinh.duongthang(px - 1725, py + 100, px - 1725, py + 400)
Set mirro2 = line1.Mirror(mr1, mr2)
Set pline1 = Vehinh.duongpline(px - 1725, py + 100, px - 1775, py + 180, px - 1725, py + 180, px - 1725, py + 160)
pline1.Closed = True
Set lopp(0) = pline1
taohatch "SOLID"
hatchobj.AppendOuterLoop (lopp)
Set pline1 = Vehinh.duongpline(px - 1725, py + 100, px - 1675, py + 180, px - 1725, py + 180, px - 1725, py + 100)
Set line1 = Vehinh.duongthang(px - 1500, py + 225, px - 1800, py + 225)
ghichu -1720, 320, "-1.4", 400
'Ve mat dat
ThisDrawing.ActiveLayer = vienmong
Set line1 = Vehinh.duongthang(px - 2000, py + 1500, px - 400, py + 1500)
Set line1 = Vehinh.duongthang(px + 1600, py + 1500, px + 400, py + 1500)
ThisDrawing.ActiveLayer = an
Set pline1 = Vehinh.duongpline(px - 400, py + 1500, px - 1550, py + 1500, px - 1550, py + 1350, px - 400, py + 1350)
pline1.Closed = True
ThisDrawing.ActiveLayer = kichthuoc
Set lopp(0) = pline1
taohatch "ANSI37"
hatchobj.AppendOuterLoop (lopp)
hatchobj.PatternScale = hatchobj.PatternScale + 400
hatchobj.Evaluate
an.LayerOn = False
mr1(0) = px
mr1(1) = py
mr2(0) = px
mr2(1) = py + 2000
Set mirro3 = hatchobj.Mirror(mr1, mr2)
'Ve mui ten ben tren
Set line1 = Vehinh.duongthang(px - 1725, py + 1500, px - 1725, py + 1800)
Set pline1 = Vehinh.duongpline(px - 1725, py + 1500, px - 1775, py + 1580, px - 1725, py + 1580, px - 1725, py + 1510)
pline1.Closed = True
Set lopp(0) = pline1
taohatch "SOLID"
hatchobj.AppendOuterLoop (lopp)
Set pline1 = Vehinh.duongpline(px - 1725, py + 1500, px - 1675, py + 1580, px - 1725, py + 1580, px - 1725, py + 1500)
Set line1 = Vehinh.duongthang(px - 1500, py + 1500 + 125, px - 1800, py + 1625)
ghichu -1720, 1725, "%%p0.00", 400
'Ve duong chi cot dai
Set line1 = Vehinh.duongthang(px + 175, py + 420, px + 175, py + 2200)
Set line1 = Vehinh.duongthang(px + 175, py + 2200, px + 800, py + 2200)
Set line1 = Vehinh.duongthang(px + 175, py + 420, px + 175, py + 480)
goc = 60 * 3.1416 / 180
ropoint(0) = px + 175
ropoint(1) = py + 450
line1.Rotate ropoint, goc
arrayobj1 = line1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
Set cirle1 = Vehinh.duongtron(px + 900, py + 2200, 100)
ghichu 860, 2250, "2", 500
ghichu 360, 2300, "%%c8a200", 400
'Chu thich cot thep doc
Set line1 = Vehinh.duongthang(px - 350, py + 1700, px + 800, py + 1700)
Set cirle1 = Vehinh.duongtron(px + 900, py + 1700, 100)
ghichu 860, 1750, "1", 500
ghichu 500, 1800, "4%%c16", 400
'Ghi chu cot thep ngang
Set line1 = Vehinh.duongthang(px + 500, py + 950, px + 500, py + 1150)
Set line1 = Vehinh.duongthang(px + 700, py + 950, px + 700, py + 1150)
Set line1 = Vehinh.duongthang(px + 500, py + 1150, px + 1100, py + 1150)
Set cirle1 = Vehinh.duongtron(px + 1200, py + 1150, 100)
ghichu 1160, 1200, "5", 500
ghichu 630, 1250, "%%c10a200", 400
'ghi cot thep khung
Set line1 = Vehinh.duongthang(px - 600, py + 950, px - 800, py + 1150)
Set line1 = Vehinh.duongthang(px - 800, py + 1150, px - 1200, py + 1150)
Set cirle1 = Vehinh.duongtron(px - 1300, py + 1150, 100)
ghichu -1350, 1200, "6", 500
ghichu -1200, 1250, "%%c10a200", 400
'Ghi cot thep ngang phia duoi
Set line1 = Vehinh.duongthang(px - 90, py + 200, px - 200, py - 200)
Set line1 = Vehinh.duongthang(px - 290, py + 200, px - 200, py - 200)
Set line1 = Vehinh.duongthang(px - 200, py - 200, px - 800, py - 200)
Set cirle1 = Vehinh.duongtron(px - 900, py - 200, 100)
ghichu -950, -150, "4", 500
ghichu -800, -100, "14%%c12a200", 400
'ghi thep khung duoi
Set line1 = Vehinh.duongthang(px + 200, py + 200, px + 300, py - 200)
Set line1 = Vehinh.duongthang(px + 300, py - 200, px + 700, py - 200)
Set cirle1 = Vehinh.duongtron(px + 800, py - 200, 100)
ghichu 760, -150, "3", 500
ghichu 300, -100, "11%%c16a140", 300
'ghi lop betong
Set line1 = Vehinh.duongthang(px - 1200, py + 50, px - 1350, py - 200)
Set line1 = Vehinh.duongthang(px - 1350, py - 200, px - 1900, py - 200)
ghichu -1900, -100, "Lop BT Lot", 400
'ghi chu thep
Set line1 = Vehinh.duongthang(px - 1220, py + 400, px - 1500, py + 700)
Set line1 = Vehinh.duongthang(px - 1500, py + 700, px - 2200, py + 700)
ghichu -2200, 800, "Thep Dau Coc", 400
ghichu -2200, 690, "Bang cach dap", 400
ghichu -2200, 590, "vo dau coc", 400
'Ghi Kich thuoc mat dung
Dim dimste As AcadDimStyle
Set dimste = ThisDrawing.DimStyles.Add("1-30")
ThisDrawing.SetVariable "DIMBLK", "OBLIQUE"
ThisDrawing.SetVariable "DIMDEC", 0
ThisDrawing.SetVariable "DIMSCALE", 500
ThisDrawing.SetVariable "DIMTAD", 1
ThisDrawing.SetVariable "DIMTIH", 0
ThisDrawing.SetVariable "DIMTOH", 1
dimste.CopyFrom ThisDrawing
ThisDrawing.ActiveDimStyle = dimste
Dim ktt As AcadDimAligned
Set ktt = ghikichthuoc.kichthuoc(px + 1450, py, px + 1450, py + 100, 100, 0)
Set ktt = ghikichthuoc.kichthuoc(px + 1450, py + 100, px + 1450, py + 200, 100, 0)
Set ktt = ghikichthuoc.kichthuoc(px + 1450, py + 200, px + 1450, py + 1000, 100, 0)
Set ktt = ghikichthuoc.kichthuoc(px + 1650, py + 200, px + 1650, py + 1000, 100, 0)
Set ktt = ghikichthuoc.kichthuoc(px + 1850, py + 200, px + 1850, py + 1500, 100, 0)
Set ktt = ghikichthuoc.kichthuoc(px + 1650, py + 1000, px + 1650, py + 1500, 100, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 400, py + 1500, px - 400, py + 2000, -100, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 400, py + 2000, px - 400, py + 2500, -100, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 350, py + 250, px - 700, py + 250, 0, 100)
Set ktt = ghikichthuoc.kichthuoc(px + 350, py + 250, px + 700, py + 250, 0, 100)
Set ktt = ghikichthuoc.kichthuoc(px - 1025, py + 200, px - 1025, py + 600, -100, 0)
goc = 10 * 3.1416 / 180
ropoint(0) = px - 1025
ropoint(1) = py + 200
ktt.Rotate ropoint, -goc
'Ve duong truc chinh
ThisDrawing.ActiveLayer = truc
Set line1 = Vehinh.duongthang(px, py - 800, px, py + 2300)
line1.LinetypeScale = 10
Dim linetype As String
linetype = "ACAD_ISO04W100"
On Error Resume Next
ThisDrawing.Linetypes.Load linetype, "acad.lin"
Dim lineobj As AcadLineType
Set lineobj = ThisDrawing.Linetypes("ACAD_ISO04W100")
truc.linetype = "ACAD_ISO04W100"



'********************************************
'VE MAT BANG MONG COC BTCT
'********************************************


py = py - 2050
ThisDrawing.ActiveLayer = vienmong
Dim lopp2(0 To 1) As AcadEntity
Set pline1 = Vehinh.duongpline(px + 1450, py - 850, px - 1450, py - 850, px - 1450, py + 850, px + 1450, py + 850)
pline1.Closed = True
Set lopp2(0) = pline1
Set pline2 = Vehinh.duongpline(px + 1350, py - 750, px - 1350, py - 750, px - 1350, py + 750, px + 1350, py + 750)
pline2.Closed = True
Set lopp2(1) = pline2
taohatch "SOLID"
hatchobj.AppendOuterLoop lopp2
hatchobj.AppendInnerLoop lopp2
hatchobj.PatternScale = 1
hatchobj.PatternScale = hatchobj.PatternScale + 20
hatchobj.Evaluate
'Ve truc toa do
ThisDrawing.ActiveLayer = truc
Set line1 = Vehinh.duongthang(px, py + 900, px, py - 1000)
line1.LinetypeScale = 10
Set line1 = Vehinh.duongthang(px - 1500, py, px + 1500, py)
line1.LinetypeScale = 10
'Ve cot giua
ThisDrawing.ActiveLayer = vienmong
Set pline1 = Vehinh.duongpline(px + 400, py - 300, px - 400, py - 300, px - 400, py + 300, px + 400, py + 300)
pline1.Closed = True
Dim offset As Variant
offset = pline1.offset(50)
offset(0).color = acBlue
ThisDrawing.ActiveLayer = kichthuoc
Set line1 = Vehinh.duongthang(px - 350, py - 250, px + 350, py + 250)
Set line1 = Vehinh.duongthang(px - 350, py + 250, px + 350, py - 250)
Set cirle1 = Vehinh.duongtron(px - 325, py - 225, 25)
Set lopp(0) = cirle1
taohatch "SOILD"
hatchobj.AppendOuterLoop (lopp)
hatchobj.Evaluate
mr1(0) = px
mr1(1) = py - 300
mr2(0) = px
mr2(1) = py + 300
Set mirro3 = hatchobj.Mirror(mr1, mr2)
mr1(0) = px - 400
mr1(1) = py
mr2(0) = px + 400
mr2(1) = py
Set mirro3 = mirro3.Mirror(mr1, mr2)
Set mirro3 = hatchobj.Mirror(mr1, mr2)
'Ve mat bang coc
ThisDrawing.ActiveLayer = netdut
linetype = "HIDDEN2"
On Error Resume Next
ThisDrawing.Linetypes.Load linetype, "acad.lin"
netdut.linetype = "HIDDEN2"
Set pline1 = Vehinh.duongpline(px - 1225, py - 625, px - 1225, py - 375, px - 975, py - 375, px - 975, py - 625)
pline1.Closed = True
pline1.LinetypeScale = 500
ThisDrawing.ActiveLayer = truc
Set line1 = Vehinh.duongthang(px - 1100, py - 650, px - 1100, py - 350)
line1.LinetypeScale = 10
Set line2 = Vehinh.duongthang(px - 1250, py - 500, px - 950, py - 500)
line2.LinetypeScale = 10
sohang = 2
socot = 3
kch = 1000
kcc = 1100
arrayobj1 = pline1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
arrayobj1 = line1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
arrayobj1 = line2.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
'Ve thep
ThisDrawing.ActiveLayer = an
Set pline1 = Vehinh.duongpline(px + 200, py - 730, px + 600, py - 300, px + 1330, py, px + 1330, py - 730)
pline1.Closed = True
Set lopp(0) = pline1
ThisDrawing.ActiveLayer = thep1
taohatch "NET"
hatchobj.AppendOuterLoop (lopp)
hatchobj.PatternScale = 1
hatchobj.PatternScale = hatchobj.PatternScale + 1600
hatchobj.Evaluate
Set line1 = Vehinh.duongthang(px + 210, py - 710, px + 1330, py - 710)
Set line1 = Vehinh.duongthang(px + 1310, py - 10, px + 1310, py - 730)
'Ghi chu thep
ThisDrawing.ActiveLayer = kichthuoc
Set pline1 = Vehinh.duongpline(px + 200, py - 730, px + 600, py - 300, px + 1330, py, px + 1330, py)
Set line1 = Vehinh.duongthang(px + 1270, py - 100, px + 1270, py - 700)
Set line1 = Vehinh.duongthang(px + 1270, py - 520, px + 1270, py - 580)
ropoint(0) = px + 1270
ropoint(1) = py - 550
goc = 60 * 3.1416 / 180
line1.Rotate ropoint, goc
sohang = 3
socot = 1
kch = 200
kcc = 1
arrayobj1 = line1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
Set line1 = Vehinh.duongthang(px + 1270, py - 250, px + 2070, py - 250)
Set cirle1 = Vehinh.duongtron(px + 2170, py - 250, 100)
ghichu 2120, -200, "3", 500
ghichu 1470, -150, "11%%c16a140", 400
Set line1 = Vehinh.duongthang(px + 300, py - 650, px + 1250, py - 650)
Set line1 = Vehinh.duongthang(px + 370, py - 650, px + 430, py - 650)
ropoint(0) = px + 400
ropoint(1) = py - 650
line1.Rotate ropoint, -goc
sohang = 1
socot = 5
kch = 1
kcc = 200
arrayobj1 = line1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
Set line1 = Vehinh.duongthang(px + 700, py - 650, px + 700, py - 1100)
Set line1 = Vehinh.duongthang(px + 700, py - 1100, px, py - 1100)
Set cirle1 = Vehinh.duongtron(px - 100, py - 1100, 100)
ghichu -150, -1050, "4", 500
ghichu 10, -1000, "14%%c12a200", 400
Set line1 = Vehinh.duongthang(px, py, px + 150, py + 350)
Set line1 = Vehinh.duongthang(px + 150, py + 350, px + 550, py + 350)
Set cirle1 = Vehinh.duongtron(px + 650, py + 350, 100)
ghichu 620, 400, "1", 500
ghichu 250, 450, "4%%c16", 400
Set line1 = Vehinh.duongthang(px - 150, py + 250, px - 300, py + 350)
Set line1 = Vehinh.duongthang(px - 300, py + 350, px - 700, py + 350)
Set cirle1 = Vehinh.duongtron(px - 800, py + 350, 100)
ghichu -830, 400, "2", 500
ghichu -690, 450, "%%c8a200", 400
'Ghi kich thuoc
'O nho
Set ktt = ghikichthuoc.kichthuoc(px - 400, py - 300, px - 400, py + 300, -200, 0) 'nam doc
Set ktt = ghikichthuoc.kichthuoc(px - 400, py - 300, px + 400, py - 300, 0, -200) 'nam ngang
'Nam ngang tu trai sang tu tren xuong
Set ktt = ghikichthuoc.kichthuoc(px - 1450, py - 1150, px - 1350, py - 1150, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px - 1350, py - 1150, px - 1100, py - 1150, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px - 1100, py - 1150, px, py - 1150, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px + 1450, py - 1150, px + 1350, py - 1150, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px + 1350, py - 1150, px + 1100, py - 1150, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px + 1100, py - 1150, px, py - 1150, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px - 1350, py - 1350, px + 1350, py - 1350, 0, -200)
'nam doc tu duoi len tu phai sang
Set ktt = ghikichthuoc.kichthuoc(px - 1450, py - 850, px - 1450, py - 750, -200, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 1450, py - 750, px - 1450, py - 500, -200, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 1450, py - 500, px - 1450, py, -200, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 1450, py + 850, px - 1450, py + 750, -200, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 1450, py + 750, px - 1450, py + 500, -200, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 1450, py + 500, px - 1450, py, -200, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 1650, py - 850, px - 1650, py + 850, -200, 0)


'********************************************
'VE MAT CHI TIET COC BTCT
'********************************************
'Thay doi diem bat dau
px = Val(txtx) - 6050
py = Val(txty) + 700
ThisDrawing.ActiveLayer = vienmong 'Thay doi layer hien hanh
'Ve doan coc c1 phan dau coc
Set line1 = Vehinh.duongthang(px + 3130, py, px + 50, py)
offset = line1.offset(-20)
offset(0).color = acCyan
mr1(0) = px - 1000
mr1(1) = py + 125
mr2(0) = px + 1000
mr2(1) = py + 125
Dim mr3(0 To 2) As Double
Dim mr4(0 To 2) As Double
mr3(0) = px - 1000
mr3(1) = py - 1000
mr4(0) = px + 1000
mr4(1) = py - 1000
mr3(2) = 0
mr4(2) = 0
Dim mr5(0 To 2) As Double
Dim mr6(0 To 2) As Double
mr5(0) = px
mr5(1) = py + 1000
mr6(0) = px
mr6(1) = py - 1000
mr5(2) = 0
mr6(2) = 0
Set mirro2 = line1.Mirror(mr1, mr2)
Set mirro2 = offset(0).Mirror(mr1, mr2)
ThisDrawing.ActiveLayer = cotdai
Set line1 = Vehinh.duongthang(px + 3130, py, px + 3130, py + 250)
ThisDrawing.ActiveLayer = thep1
Set line1 = Vehinh.duongthang(px + 3130, py + 20, px + 3250, py + 20)
Set mirro2 = line1.Mirror(mr1, mr2)
Set line1 = Vehinh.duongthang(px + 3250, py + 10, px + 3250, py + 240)
ThisDrawing.ActiveLayer = cotdai
Set line1 = Vehinh.duongthang(px + 3130, py + 20, px + 3130, py + 210 + 20)
sohang = 1
socot = 5
kch = 1
kcc = -50
arrayobj1 = line1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
socot = 7
kcc = -100
Dim arrayobj2 As Variant
arrayobj2 = arrayobj1(3).ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
socot = 12
kcc = -200
arrayobj2 = arrayobj2(5).ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
ThisDrawing.ActiveLayer = kichthuoc
Set line1 = Vehinh.duongthang(px + 2850, py + 125, px + 2310, py + 125)
Set line1 = Vehinh.duongthang(px + 2330, py + 100, px + 2330, py + 150)
ropoint(0) = px + 2330
ropoint(1) = py + 125
goc = 60 * 3.1416 / 180
line1.Rotate ropoint, -goc
sohang = 1
socot = 6
kcc = 100
arrayobj1 = line1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
Set line1 = Vehinh.duongthang(px + 130 + 180, py + 125, px + 130 + 200 + 420, py + 125)
Set line1 = Vehinh.duongthang(px + 130 + 200, py + 100, px + 130 + 200, py + 150)
ropoint(0) = px + 130 + 200
ropoint(1) = py + 125
line1.Rotate ropoint, -goc
socot = 3
kcc = 200
arrayobj1 = line1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
Set line1 = Vehinh.duongthang(px + 3130, py + 10, px + 3250, py + 10)
Set mirro2 = line1.Mirror(mr1, mr2)
Application.Update
ZoomAll
taoselecyion px, py - 50, px + 3300, py + 260
Dim Enty As AcadEntity
For Each Enty In sset
Set mirro2 = Enty.Mirror(mr3, mr4)
Next Enty
sset.Clear
Application.Update
taoselecyion px, py - 2300, px + 3300, py - 1950
For Each Enty In sset
Set mirro2 = Enty.Mirror(mr5, mr6)
Next Enty
've cham tron
Set cirle1 = Vehinh.duongtron(px + 3120, py + 30, 10)
taohatch "SOLID"
Set lopp(0) = cirle1
hatchobj.AppendOuterLoop (lopp)
sohang = 5
socot = 5
kch = 47
kcc = -50
arrayobj1 = hatchobj.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
mr3(1) = py - 1000 - 95
mr4(1) = py - 1000 - 95
Set mirro3 = hatchobj.Mirror(mr3, mr4)
arrayobj1 = mirro3.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)

Set mirro3 = mirro3.Mirror(mr5, mr6)
kcc = 50
arrayobj1 = mirro3.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
'To hatch dau coc
ThisDrawing.ActiveLayer = an
Set pline1 = Vehinh.duongpline(px + 3130, py + 10, px + 3130, py + 20, px + 3250, py + 20, px + 3250, py + 10)
pline1.Closed = True
Set lopp(0) = pline1
ThisDrawing.ActiveLayer = kichthuoc
taohatch "ANSI31"
hatchobj.AppendOuterLoop (lopp)
hatchobj.PatternScale = 1
hatchobj.PatternScale = hatchobj.PatternScale + 100
hatchobj.Evaluate
Set mirro3 = hatchobj.Mirror(mr1, mr2)
mr3(1) = py - 1000
mr4(1) = py - 1000
Set mirro3 = hatchobj.Mirror(mr3, mr4)
Dim mr7(0 To 2) As Double
Dim mr8(0 To 2) As Double
mr7(0) = px + 1000
mr7(1) = py - 2000 - 125
mr8(0) = px - 1000
mr8(1) = py - 2000 - 125
mr7(2) = 0
mr8(2) = 0
Dim mirro4 As AcadHatch
Set mirro4 = mirro3.Mirror(mr7, mr8)
Set mirro3 = mirro3.Mirror(mr5, mr6)
Set mirro3 = mirro3.Mirror(mr7, mr8)
'Ve cac duong cat dai
ThisDrawing.ActiveLayer = vienmong
Set pline1 = Vehinh.duongpline(px - 50, py - 50, px - 50, py + 100, px - 10, py + 125, px - 90, py + 125)
Set pline2 = Vehinh.duongpline(px - 50, py + 300, px - 50, py + 150, px - 90, py + 125, px - 10, py + 125)
Set mirro1 = pline1.Mirror(mr5, mr6)
Set mirro1 = pline2.Mirror(mr5, mr6)
Set mirro1 = pline1.Mirror(mr3, mr4)
Set mirro1 = mirro1.Mirror(mr5, mr6)
Set mirro1 = pline2.Mirror(mr3, mr4)
Set mirro1 = mirro1.Mirror(mr5, mr6)
'Ve cac thep nho len tu trai sang hinh tren
Set pline1 = Vehinh.duongpline(px + 1180, py + 40, px + 1155, py + 40, px + 1155, py + 20, px + 1290, py + 20)
Set line1 = Vehinh.duongthang(px + 1290, py + 20, px + 1290, py + 275)
mr3(0) = px + 1340
mr3(1) = py
mr4(0) = px + 1340
mr4(1) = py + 275
Set mirro1 = pline1.Mirror(mr3, mr4)
Set mirro2 = line1.Mirror(mr3, mr4)
Dim arc1 As AcadArc
Set arc1 = Vehinh.cungtron(px + 1340, py + 275, 50, 0, 180)
mr3(0) = px + 1620
mr3(1) = py
mr4(0) = px + 1620
mr4(1) = py + 275
Set mirro1 = mirro1.Mirror(mr3, mr4)
Set mirro2 = mirro2.Mirror(mr3, mr4)
Dim mirroarc As AcadArc
Set mirroarc = arc1.Mirror(mr3, mr4)
mr3(0) = px + 1900
mr3(1) = py
mr4(0) = px + 1900
mr4(1) = py + 275
Set mirro1 = mirro1.Mirror(mr3, mr4)
Set mirro2 = mirro2.Mirror(mr3, mr4)

'Ve thep nho len phan c2
Set pline1 = Vehinh.duongpline(px + 1180, py - 2250 + 40, px + 1155, py - 2210, px + 1155, py - 2230, px + 1290, py - 2230)
Set line1 = Vehinh.duongthang(px + 1290, py - 2230, px + 1290, py + 275 - 2250)
mr3(0) = px + 1340
mr3(1) = py
mr4(0) = px + 1340
mr4(1) = py + 275
Set mirro1 = pline1.Mirror(mr3, mr4)
Set mirro2 = line1.Mirror(mr3, mr4)

Set arc1 = Vehinh.cungtron(px + 1340, py + 275 - 2250, 50, 0, 180)
mr3(0) = px + 1620
mr3(1) = py
mr4(0) = px + 1620
mr4(1) = py + 275
Set mirro1 = mirro1.Mirror(mr3, mr4)
Set mirro2 = mirro2.Mirror(mr3, mr4)

Set mirroarc = arc1.Mirror(mr3, mr4)
mr3(0) = px + 1900
mr3(1) = py
mr4(0) = px + 1900
mr4(1) = py + 275
Set mirro1 = mirro1.Mirror(mr3, mr4)
Set mirro2 = mirro2.Mirror(mr3, mr4)
'Ve phan ben trai thep c1
Set line1 = Vehinh.duongthang(px - 50, py, px - 3250, py)
offset = line1.offset(-20)
offset(0).color = acCyan
Set mirro2 = line1.Mirror(mr1, mr2)
Set mirro2 = offset(0).Mirror(mr1, mr2)
'Ve mui nhon
Set pline1 = Vehinh.duongpline(px - 3250, py, px - 3500, py + 75, px - 3500, py + 175, px - 3250, py + 250)
offset = pline1.offset(20)
offset(0).color = acCyan
've cot dai mui nhon
ThisDrawing.ActiveLayer = cotdai
Set line1 = Vehinh.duongthang(px - 3480, py + 125, px - 3450, py + 80)
Set line1 = Vehinh.duongthang(px - 3450, py + 80, px - 3420, py + 180)
Set line1 = Vehinh.duongthang(px - 3420, py + 180, px - 3370, py + 60)
Set line1 = Vehinh.duongthang(px - 3370, py + 60, px - 3320, py + 210)
Set line1 = Vehinh.duongthang(px - 3320, py + 210, px - 3250, py + 20)
Set line1 = Vehinh.duongthang(px - 3250, py + 20, px - 3250, py + 230)
'Ve cot dai phan than
sohang = 1
socot = 7
kch = 1
kcc = 100
arrayobj1 = line1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
socot = 13
kcc = 200
arrayobj1 = arrayobj1(5).ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
'Ve mui nhon cua coc
ThisDrawing.ActiveLayer = kichthuoc
Set line1 = Vehinh.duongthang(px - 3500, py + 87.5, px - 3550, py + 87.5)
Set mirro2 = line1.Mirror(mr1, mr2)
Set line1 = Vehinh.duongthang(px - 3550, py + 87.5, px - 3550, py + 162.5)
Set line1 = Vehinh.duongthang(px - 3500, py + 100, px - 3550, py + 100)
Set mirro2 = line1.Mirror(mr1, mr2)
ThisDrawing.ActiveLayer = thep1
Set line1 = Vehinh.duongthang(px - 3600, py + 125, px - 3050, py + 125)
ThisDrawing.ActiveLayer = kichthuoc
Set cirle1 = Vehinh.duongtron(px - 3375, py + 125, 250)
'Ve thep nho ben trai-c1
ThisDrawing.ActiveLayer = vienmong
Set pline1 = Vehinh.duongpline(px - 2035, py + 40, px - 2060, py + 40, px - 2060, py + 20, px - 1950, py + 20)
Set line1 = Vehinh.duongthang(px - 1950, py + 20, px - 1950, py + 275)
mr3(0) = px - 1900
mr3(1) = py
mr4(0) = px - 1900
mr4(1) = py + 300
Set mirro1 = pline1.Mirror(mr3, mr4)
Set mirro2 = line1.Mirror(mr3, mr4)
Set arc1 = Vehinh.cungtron(px - 1900, py + 275, 50, 0, 180)
've thep nho ben trai-c2
Set pline1 = Vehinh.duongpline(px - 2035, py - 2210, px - 2060, py - 2210, px - 2060, py - 2230, px - 1950, py - 2230)
Set line1 = Vehinh.duongthang(px - 1950, py - 2230, px - 1950, py - 1975)
mr3(0) = px - 1900
mr3(1) = py
mr4(0) = px - 1900
mr4(1) = py + 300
Set mirro1 = pline1.Mirror(mr3, mr4)
Set mirro2 = line1.Mirror(mr3, mr4)
Set arc1 = Vehinh.cungtron(px - 1900, py - 1975, 50, 0, 180)
'Ghi chu thep
ThisDrawing.ActiveLayer = kichthuoc
Set line1 = Vehinh.duongthang(px + 3070, py + 220, px + 3150, py + 300)
Set line1 = Vehinh.duongthang(px + 3150, py + 300, px + 3700, py + 300)
Set cirle1 = Vehinh.duongtron(px + 3800, py + 300, 100)
ghichu 3740, 350, "3", 500
ghichu 3130, 400, "5 Luoi Thep", 400
ghichu 3400, 280, "a50", 400
Set line1 = Vehinh.duongthang(px + 2380, py + 125, px + 2500, py - 200)
Set line1 = Vehinh.duongthang(px + 2500, py - 200, px + 2900, py - 200)
Set cirle1 = Vehinh.duongtron(px + 3000, py - 200, 100)
ghichu 2975, -150, "2", 500
ghichu 2400, -220, "6%%c6a100", 400
Set line1 = Vehinh.duongthang(px + 430, py + 125, px + 500, py - 200)
Set line1 = Vehinh.duongthang(px + 500, py - 200, px + 1200, py - 200)
Set cirle1 = Vehinh.duongtron(px + 1300, py - 200, 100)
ghichu 1275, -150, "2", 500
ghichu 700, -100, "%%c6a200", 400
Set line1 = Vehinh.duongthang(px + 1390, py + 276, px + 1400, py + 400)
Set line1 = Vehinh.duongthang(px + 1400, py + 400, px + 1600, py + 400)
Set cirle1 = Vehinh.duongtron(px + 1700, py + 400, 100)
ghichu 1675, 450, "4", 500
ghichu 1400, 500, "%%c14", 400


Set line1 = Vehinh.duongthang(px + 1950, py + 276, px + 2000, py + 400)
Set line1 = Vehinh.duongthang(px + 2000, py + 400, px + 2300, py + 400)
Set cirle1 = Vehinh.duongtron(px + 2400, py + 400, 100)
ghichu 2375, 450, "4", 500
ghichu 2000, 500, "%%c14", 400
Set line1 = Vehinh.duongthang(px - 950, py + 230, px - 950, py - 200)
Set line1 = Vehinh.duongthang(px - 950, py - 200, px - 550, py - 200)
Set cirle1 = Vehinh.duongtron(px - 450, py - 200, 100)
ghichu -475, -150, "1", 500
ghichu -930, -100, "4%%c16", 400
Set line1 = Vehinh.duongthang(px - 1850, py + 275, px - 1600, py + 400)
Set line1 = Vehinh.duongthang(px - 1600, py + 400, px - 1300, py + 400)
Set cirle1 = Vehinh.duongtron(px - 1200, py + 400, 100)
ghichu -1225, 450, "4", 500
ghichu -1500, 500, "%%c14", 400


Set line1 = Vehinh.duongthang(px - 750, py + 125, px - 220, py + 125)
Set line1 = Vehinh.duongthang(px - 250, py + 105, px - 250, py + 145)
ropoint(0) = px - 250
ropoint(1) = py + 125
goc = 60 * 3.1416 / 180
line1.Rotate ropoint, goc
sohang = 1
socot = 3
kcc = -200
kch = 1
arrayobj1 = line1.ArrayRectangular(sohang, socot, lever, kch, kcc, lever2)
Set line1 = Vehinh.duongthang(px - 400, py + 125, px - 400, py + 400)
Set line1 = Vehinh.duongthang(px - 400, py + 400, px + 100, py + 400)
Set cirle1 = Vehinh.duongtron(px + 200, py + 400, 100)
ghichu 175, 450, "2", 500
ghichu -400, 500, "%%c6a200", 400
Set line1 = Vehinh.duongthang(px - 3000, py + 125, px - 2600, py + 125)
Set line1 = Vehinh.duongthang(px - 2800, py + 125, px - 2800, py + 400)
Set line1 = Vehinh.duongthang(px - 2800, py + 400, px - 2200, py + 400)
Set cirle1 = Vehinh.duongtron(px - 2100, py + 400, 100)
ghichu -2100, 450, "2", 500
ghichu -2800, 500, "6%%c6a100", 400


Set line1 = Vehinh.duongthang(px - 3575, py + 125, px - 3700, py + 200)
Set line1 = Vehinh.duongthang(px - 3700, py + 200, px - 3900, py + 200)
Set cirle1 = Vehinh.duongtron(px - 4000, py + 200, 100)
ghichu -4025, 250, "5", 500
ghichu -3890, 300, "%%c22", 400
Set line1 = Vehinh.duongthang(px - 3425, py + 175, px - 3500, py + 500)
Set line1 = Vehinh.duongthang(px - 3500, py + 500, px - 3700, py + 500)
Set cirle1 = Vehinh.duongtron(px - 3800, py + 500, 100)
ghichu -3825, 550, "6", 500
ghichu -3690, 600, "%%c6", 400
'Ghi phan c2
py = py - 2250
Set line1 = Vehinh.duongthang(px + 3070, py + 220, px + 3150, py + 300)
Set line1 = Vehinh.duongthang(px + 3150, py + 300, px + 3700, py + 300)
Set cirle1 = Vehinh.duongtron(px + 3800, py + 300, 100)
ghichu 3740, 350, "3", 500
ghichu 3130, 400, "5 Luoi Thep", 400
ghichu 3400, 280, "a50", 400
Set line1 = Vehinh.duongthang(px + 2380, py + 125, px + 2500, py - 200)
Set line1 = Vehinh.duongthang(px + 2500, py - 200, px + 2900, py - 200)
Set cirle1 = Vehinh.duongtron(px + 3000, py - 200, 100)
ghichu 2975, -150, "2", 500
ghichu 2400, -220, "6%%c6a100", 400
Set line1 = Vehinh.duongthang(px + 430, py + 125, px + 500, py - 200)
Set line1 = Vehinh.duongthang(px + 500, py - 200, px + 1200, py - 200)
Set cirle1 = Vehinh.duongtron(px + 1300, py - 200, 100)
ghichu 1275, -150, "2", 500
ghichu 700, -100, "%%c6a200", 400
Set line1 = Vehinh.duongthang(px + 1390, py + 276, px + 1400, py + 400)
Set line1 = Vehinh.duongthang(px + 1400, py + 400, px + 1600, py + 400)
Set cirle1 = Vehinh.duongtron(px + 1700, py + 400, 100)
ghichu 1675, 450, "4", 500
ghichu 1400, 500, "%%c14", 400
Set line1 = Vehinh.duongthang(px + 1950, py + 276, px + 2000, py + 400)
Set line1 = Vehinh.duongthang(px + 2000, py + 400, px + 2300, py + 400)
Set cirle1 = Vehinh.duongtron(px + 2400, py + 400, 100)
ghichu 2375, 450, "4", 500
ghichu 2000, 500, "%%c14", 400
Set line1 = Vehinh.duongthang(px - 950, py + 230, px - 950, py - 200)
Set line1 = Vehinh.duongthang(px - 950, py - 200, px - 550, py - 200)
Set cirle1 = Vehinh.duongtron(px - 450, py - 200, 100)
ghichu -475, -150, "1", 500
ghichu -930, -100, "4%%c16", 400
Set line1 = Vehinh.duongthang(px - 1850, py + 275, px - 1600, py + 400)
Set line1 = Vehinh.duongthang(px - 1600, py + 400, px - 1300, py + 400)
Set cirle1 = Vehinh.duongtron(px - 1200, py + 400, 100)
ghichu -1225, 450, "4", 500
ghichu -1500, 500, "%%c14", 400
Set line1 = Vehinh.duongthang(px - 400, py + 125, px - 400, py + 400)
Set line1 = Vehinh.duongthang(px - 400, py + 400, px + 100, py + 400)
Set cirle1 = Vehinh.duongtron(px + 200, py + 400, 100)
ghichu 175, 450, "2", 500
ghichu -400, 500, "%%c6a200", 400
Set line1 = Vehinh.duongthang(px - 3000, py + 125, px - 2600, py + 125)
Set line1 = Vehinh.duongthang(px - 2800, py + 125, px - 2800, py + 400)
Set line1 = Vehinh.duongthang(px - 2800, py + 400, px - 2200, py + 400)
Set cirle1 = Vehinh.duongtron(px - 2100, py + 400, 100)
ghichu -2100, 450, "2", 500
ghichu -2800, 500, "6%%c6a100", 400

Set line1 = Vehinh.duongthang(px - 3070, py + 220, px - 3150, py + 400)
Set line1 = Vehinh.duongthang(px - 3150, py + 400, px - 3700, py + 400)
Set cirle1 = Vehinh.duongtron(px - 3800, py + 400, 100)
ghichu -3825, 450, "3", 500
ghichu -3690, 500, "4 Luoi Thep", 400
ghichu -3500, 380, "a50", 400

Set line1 = Vehinh.duongthang(px + 3190, py + 15, px + 3200, py - 200)
Set line1 = Vehinh.duongthang(px + 3200, py - 200, px + 3900, py - 200)
Set cirle1 = Vehinh.duongtron(px + 4000, py - 200, 100)
ghichu 3975, -150, "7", 500
ghichu 3300, -100, "Thep Ban", 400
ghichu 3200, -220, "220x120x10", 400

'Ghi kich thuoc cot c2
Set ktt = ghikichthuoc.kichthuoc(px + 3250, py - 250, px + 3130, py - 250, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px - 3250, py - 250, px - 3130, py - 250, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px - 3130, py - 250, px + 3130, py - 250, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px + 3250, py - 400, px - 3250, py - 400, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px - 3250, py + 230, px - 3250, py + 20, -200, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 3250, py + 250, px - 3250, py, -400, 0)
Set ktt = ghikichthuoc.kichthuoc(px + 3250, py + 500, px + 1900, py + 500, 0, 200)
Set ktt = ghikichthuoc.kichthuoc(px + 1900, py + 500, px + 1340, py + 500, 0, 200)
Set ktt = ghikichthuoc.kichthuoc(px + 1340, py + 500, px - 1900, py + 500, 0, 200)
Set ktt = ghikichthuoc.kichthuoc(px - 1900, py + 500, px - 3250, py + 500, 0, 200)
Set ktt = ghikichthuoc.kichthuoc(px + 1290, py + 250, px + 1290, py + 300, -100, 0)
'Ghi kich thuoc cot c1
py = py + 2250
Set ktt = ghikichthuoc.kichthuoc(px + 3250, py - 250, px + 3130, py - 250, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px - 3250, py - 250, px - 3130, py - 250, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px - 3130, py - 250, px + 3130, py - 250, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px + 3250, py - 400, px - 3250, py - 400, 0, -200)

Set ktt = ghikichthuoc.kichthuoc(px + 3250, py + 500, px + 1900, py + 500, 0, 200)
Set ktt = ghikichthuoc.kichthuoc(px + 1900, py + 500, px + 1340, py + 500, 0, 200)
Set ktt = ghikichthuoc.kichthuoc(px + 1340, py + 500, px - 1900, py + 500, 0, 200)
Set ktt = ghikichthuoc.kichthuoc(px - 1900, py + 500, px - 3250, py + 500, 0, 200)
Set ktt = ghikichthuoc.kichthuoc(px + 1290, py + 250, px + 1290, py + 300, -100, 0)
Set ktt = ghikichthuoc.kichthuoc(px - 3550, py, px - 3500, py, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px - 3550, py, px - 3600, py, 0, -200)
Set ktt = ghikichthuoc.kichthuoc(px - 3250, py + 250, px - 3050, py + 250, 0, 300)



'Ve Duong Bao Ngoai
Set pline1 = Vehinh.duongpline(px - 4200, py - 5000, px - 4200, py + 2300, px + 8400, py + 2300, px + 8400, py - 5000)
pline1.Closed = True
Set pline1 = Vehinh.duongpline(px - 4200, py - 5000, px - 4200, py - 3500, px + 3250, py - 3500, px + 3250, py - 5000)

End Sub

'********************************************
'Sub tao SelectionSet
'********************************************
Sub taoselecyion(setx1 As Double, sety1 As Double, setx2 As Double, sety2 As Double)
Dim mode As Integer
On Error Resume Next
Set sset = ThisDrawing.SelectionSets("sset1")
If Err <> 0 Then
Err.Clear
Set sset = ThisDrawing.SelectionSets.Add("sset1")
Else
sset.Clear
End If
Dim setpoint1(0 To 2) As Double
Dim setpoint2(0 To 2) As Double
setpoint1(0) = setx1
setpoint1(1) = sety1
setpoint1(2) = 0
setpoint2(0) = setx2
setpoint2(1) = sety2
setpoint2(2) = 0
mode = 1
sset.Select mode, setpoint1, setpoint2
End Sub


'********************************************
'Sub tao hatch
'********************************************

Sub taohatch(name As String)
Dim ptname As String
Dim pttype As Long
Dim bass As Boolean
ptname = name
pttype = 0
bass = True
Set hatchobj = ThisDrawing.ModelSpace.AddHatch(pttype, ptname, bass)

End Sub


'********************************************
'Khoi tao cac layer cho ban ve
'********************************************
Sub taolayer()
Set kichthuoc = ThisDrawing.Layers.Add("kichthuoc")
Set cotdai = ThisDrawing.Layers.Add("cotdai")
cotdai.color = acBlue
Set vienmong = ThisDrawing.Layers.Add("vienmong")
vienmong.color = acGreen
Set thep = ThisDrawing.Layers.Add("thep")
thep.color = acYellow
Set thep1 = ThisDrawing.Layers.Add("thep1")
thep1.color = acCyan
Set thepngang = ThisDrawing.Layers.Add("thepngang")
Set truc = ThisDrawing.Layers.Add("truc")
truc.color = acRed


Set an = ThisDrawing.Layers.Add("an")
Set netdut = ThisDrawing.Layers.Add("netdut")
End Sub

'********************************************
'Ve Hinh
'********************************************

Private Sub CommandButton1_Click()
vehinh2
Label2.Caption = " Hoan Thanh..."
Application.Update
ZoomAll
End Sub

'********************************************
'Nua Bat Diem
'********************************************
Private Sub CommandButton2_Click()
frmmain.Hide 'An Form
Dim toado As Variant
toado = ThisDrawing.Utility.GetPoint(, "Chon 1 diem") 'Dung getpoint de lay toa do
txtx = toado(0) 'gan vao 2 o textbox
txty = toado(1)
frmmain.Show 'Hien Form
End Sub

'********************************************
'Chuong Trinh Con Xoa Toan man Hinh
'********************************************
Sub deleteall()
Dim deleteall As AcadSelectionSet
Dim mode2 As Integer
On Error Resume Next
Set deleteall = ThisDrawing.SelectionSets("deletea")
If Err <> 0 Then
Err.Clear
Set deleteall = ThisDrawing.SelectionSets.Add("deletea")
Else
deleteall.Clear
End If
mode2 = 5
deleteall.Select mode2
Dim list As AcadEntity
For Each list In deleteall
list.Delete
Next list
End Sub

Private Sub CommandButton3_Click()
If Not (ThisDrawing.Saved) Then

ThisDrawing.SaveAs ("KCMong Coc BTCT.dwg")
Else
ThisDrawing.Save
End If
End Sub

'********************************************
'Nut Xoa
'********************************************
Private Sub CommandButton4_Click()
deleteall
Application.Update
ZoomAll
End Sub

'********************************************
'Chuong Trinh Con Dung De Viet Chu
'********************************************
Sub ghichu(txta As Double, txtb As Double, texts As String, tlchu As Double)
Dim tpefara As String
Dim bod As Boolean
Dim itali As Boolean
Dim char As Long
Dim pit As Long
ThisDrawing.ActiveTextStyle.GetFont tpefara, bod, itali, char, pit
bod = True
tpefara = "Arial"
ThisDrawing.ActiveTextStyle.SetFont tpefara, bod, itali, char, pit
Dim mtext As AcadMText
Dim txtstring As String
Dim txtpoint(0 To 2) As Double
txtpoint(0) = px + txta
txtpoint(1) = py + txtb
txtpoint(2) = 0
Dim txthigh As Double
txthigh = 100
txtstring = texts
Set mtext = ThisDrawing.ModelSpace.AddMText(txtpoint, txthigh, txtstring)
Dim txttl As Double
txttl = tlchu
mtext.ScaleEntity txtpoint, txttl
End Sub

'********************************************
'An Hien Form
'********************************************

Private Sub CommandButton5_Click()
frmmain.Hide
Dim gettxt As String
gettxt = ThisDrawing.Utility.GetString(False, "Hien chuong trinh (Y/N) :")
If gettxt = "Y" Or gettxt = "y" Then
frmmain.Show
Else
Exit Sub
End If
End Sub


Private Sub Frame1_Click()

End Sub

'********************************************
'The End - Dai Hoc XD Ha Noi - Khoa cong Nghe Thong Tin
'********************************************
Private Sub UserForm_Click()

End Sub
Cac chuong trinh con

Function duongthang(x1 As Double, y1 As Double, x2 As Double, y2 As Double)
Dim point1(0 To 2) As Double
Dim point2(0 To 2) As Double
point1(0) = x1
point1(1) = y1
point1(2) = 0
point2(0) = x2
point2(1) = y2
point2(2) = 0
Dim line As AcadLine
Set line = ThisDrawing.ModelSpace.AddLine(point1, point2)
Set duongthang = line
End Function

Function duongpline(x3 As Double, y3 As Double, x4 As Double, y4 As Double, x5 As Double, y5 As Double, x6 As Double, y6 As Double)
Dim point(0 To 7) As Double
Dim pline As AcadLWPolyline
point(0) = x3
point(1) = y3
point(2) = x4
point(3) = y4
point(4) = x5
point(5) = y5
point(6) = x6
point(7) = y6
Set pline = ThisDrawing.ModelSpace.AddLightWeightPolyline(point)
Set duongpline = pline
End Function

Function duongtron(tam1 As Double, tam2 As Double, bakinh As Double)
Dim tam(0 To 2) As Double
Dim radian As Double
tam(0) = tam1
tam(1) = tam2
tam(2) = 0
radian = bakinh
Dim circe As AcadCircle
Set circe = ThisDrawing.ModelSpace.AddCircle(tam, radian)
Set duongtron = circe

End Function


Function cungtron(arcx As Double, arcy As Double, bankinhcung As Double, gocbatdau As Double, goccuoi As Double)
Dim tamcungtron(0 To 2) As Double
Dim bankinh As Double
Dim gocdau As Double
Dim goccungcuoi As Double
tamcungtron(0) = arcx
tamcungtron(1) = arcy
tamcungtron(2) = 0
bankinh = bankinhcung
gocdau = gocbatdau * 3.1416 / 180
goccungcuoi = goccuoi * 3.1416 / 180
Dim arc As AcadArc
Set arc = ThisDrawing.ModelSpace.AddArc(tamcungtron, bankinh, gocdau, goccungcuoi)
Set cungtron = arc
End Function





Bai so 4


Dim ofset As Variant
Dim t As Variant
Option Explicit


Private Sub CMD_dung_Click()
End
End Sub

Private Sub CMD_tiep_Click()
Dim layer1 As AcadLayer
Set layer1 = ThisDrawing.Layers.Add("thep")
layer1.color = acRed
Dim layer2 As AcadLayer
Set layer2 = ThisDrawing.Layers.Add("cot")
layer2.color = acGreen
Dim I(0 To 2) As Double
Dim b As Double, h As Double, s As Double
I(0) = txtx
I(1) = txty
b = txtb
h = txth
t = txtt
s = txts
Dim pline1 As AcadLWPolyline
Set pline1 = vehinh.pline(I(0) - b, I(1), I(0) - b, I(1) - (b / 2), I(0) + b, I(1) - (b / 2), I(0) + b, I(1))
pline1.Closed = True
Dim pline2 As AcadLWPolyline
Set pline2 = vehinh.pline(I(0) - (b / 2), I(1), I(0) - (b / 2), I(1) + h, I(0) + (b / 2), I(1) + h, I(0) + (b / 2), I(1))
pline2.Closed = True
pline2.layer = "cot"
Dim line1 As AcadLine
Set line1 = vehinh.line(I(0) + t - b / 2, I(1), I(0) + t - b / 2, I(1) + h + b)
line1.layer = "thep"
Dim offset1 As Variant
offset1 = line1.offset(-b + 2 * t)
Dim line3 As AcadLine
Set line3 = vehinh.line(I(0) + t - b / 2, I(1) + h + b, I(0) + 2 * t - b / 2, I(1) + h + b - t)
line3.layer = "thep"
Dim line4 As AcadLine
Set line4 = vehinh.line(I(0) - t + b / 2, I(1) + h + b, I(0) - 2 * t + b / 2, I(1) + h + b - t)
line4.layer = "thep"
Dim line5 As AcadLine
Set line5 = vehinh.line(I(0) + t - b / 2, I(1), I(0) + b / 2 - t, I(1))
line5.layer = "thep"
Dim offset2(0 To 100) As Variant
Dim offset3(0 To 100) As Variant
Dim m As Double
Dim n As Variant
Dim j As Double
m = Fix(h / (3 * s))
For j = 1 To m - 1
offset2(0) = line5.offset(j * s / 2)
Next
n = Fix(h / s)
For j = 1 To n - 1
offset3(0) = line5.offset(j * s)
Next
Dim dimste As AcadDimStyle
Set dimste = ThisDrawing.DimStyles.Add("1-30")
ThisDrawing.SetVariable "DIMBLK", "OBLIQUE"
ThisDrawing.SetVariable "DIMDEC", 0
ThisDrawing.SetVariable "DIMSCALE", 500
ThisDrawing.SetVariable "DIMTAD", 1
ThisDrawing.SetVariable "DIMTIH", 0
ThisDrawing.SetVariable "DIMTOH", 1
dimste.CopyFrom ThisDrawing
ThisDrawing.ActiveDimStyle = dimste
Dim dim1 As AcadDimAligned
Set dim1 = ghikt.kichthuoc(I(0) - b / 2, I(1), I(0) - b / 2, I(1) + h, I(0) - b / 2, I(1) + h / 2)
Dim dim2 As AcadDimAligned
Set dim2 = ghikt.kichthuoc(I(0) - b / 2, I(1) - b / 2, I(0) + b / 2, I(1) - b / 2, I(0) + b / 2, (I(1) - b / 2))
ZoomAll
End Sub


Private Sub Frame1_Click()

End Sub

Private Sub Frame2_Click()

End Sub

Private Sub Label1_Click()

End Sub

Private Sub txtb_Change()

End Sub

Private Sub txty_Change()

End Sub

Private Sub UserForm_Click()

End Sub


Về Đầu Trang Go down
Xem lý lịch thành viên
phongvjp36
Trưởng phòng


Tổng số bài gửi : 211
Points : 279
Birthday : 03/07/1990
Age : 26
Đến từ : Hawai
status : Never give up and never say die!

Bài gửiTiêu đề: Re: cáh làm VBA   Sun Oct 24, 2010 9:24 pm

cai gi the nay ha troi Shocked
Về Đầu Trang Go down
Xem lý lịch thành viên
mR_LaLa
Trưởng phòng


Tổng số bài gửi : 101
Points : 145
Birthday : 11/09/1990
Age : 26
Đến từ : Quế Võ- Bắc Ninh

Bài gửiTiêu đề: Re: cáh làm VBA   Sun Oct 24, 2010 10:01 pm

1 dải lên mây!
Về Đầu Trang Go down
Xem lý lịch thành viên
mR_LaLa
Trưởng phòng


Tổng số bài gửi : 101
Points : 145
Birthday : 11/09/1990
Age : 26
Đến từ : Quế Võ- Bắc Ninh

Bài gửiTiêu đề: Re: cáh làm VBA   Sun Oct 24, 2010 10:42 pm

đi thi trúng đề này, chắc gì đã gõ xong nhỉ
Về Đầu Trang Go down
Xem lý lịch thành viên
lechicuong
Trưởng phòng


Tổng số bài gửi : 184
Points : 241
Birthday : 22/03/1990
Age : 26

Bài gửiTiêu đề: Re: cáh làm VBA   Sat Oct 30, 2010 9:55 pm

mấy cái này là làm theo dữ liệu động hay dữ liệu tĩnh thế anh
Về Đầu Trang Go down
Xem lý lịch thành viên
a_ca
nhân viên thử việc


Tổng số bài gửi : 21
Points : 43

Bài gửiTiêu đề: Re: cáh làm VBA   Sat Oct 30, 2010 10:15 pm

thống kê thì lam theo dữ liệu động
Về Đầu Trang Go down
Xem lý lịch thành viên
Sponsored content




Bài gửiTiêu đề: Re: cáh làm VBA   Today at 9:18 pm

Về Đầu Trang Go down
 
cáh làm VBA
Xem chủ đề cũ hơn Xem chủ đề mới hơn Về Đầu Trang 
Trang 1 trong tổng số 1 trang

Permissions in this forum:Bạn không có quyền trả lời bài viết
 :: (¯`°•:ღ•°¤° BOX TIN XÂY DỰNG °¤°•ღ:•°´¯) :: .:: GÓC HỌC TẬP ::. :: Tài liệu-
Chuyển đến