反正我又迟到了
- Public Sub wall()
- Dim dblLength As Double, dblWidth As Double, dblHeight As Double
- Dim inspt(2) As Double, endpt(2) As Double
- inspt(0) = 120: inspt(1) = 120: inspt(2) = 0
- Dim oLayer As AcadLayer, oCurrLayeR As AcadLayer, oBlock As AcadBlockReference, _
- oEntity As AcadEntity, newObjs As Variant ', InsPT As Variant
- Set oCurrLayeR = ThisDrawing.ActiveLayer
- Set oLayer = ThisDrawing.Layers.Add("SITE-WALL")
- oLayer.color = 1
- ThisDrawing.ActiveLayer = oLayer
- ' dblLength = CDbl(txtLength.Value)
- ' dblWidth = CDbl(txtWidth.Value)
- ' dblHeight = CDbl(txtHeight.Value)
- dblLength = 144
- dblWidth = 72
- dblHeight = 60
- Dim WallCoords(9) As Double
- WallCoords(0) = inspt(0) - (dblLength / 2): WallCoords(1) = inspt(1) + (dblWidth / 2)
- WallCoords(2) = inspt(0) + (dblLength / 2): WallCoords(3) = inspt(1) + (dblWidth / 2)
- WallCoords(4) = inspt(0) + (dblLength / 2): WallCoords(5) = inspt(1) - (dblWidth / 2)
- WallCoords(6) = inspt(0) - (dblLength / 2): WallCoords(7) = inspt(1) - (dblWidth / 2)
- WallCoords(8) = inspt(0) - (dblLength / 2): WallCoords(9) = inspt(1) + (dblWidth / 2)
- Dim plineObj As AcadLWPolyline
- Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(WallCoords)
- plineObj.Closed = True
- Dim bound(0) As AcadEntity
- Set bound(0) = plineObj
- Dim regionObj As Variant
- regionObj = ThisDrawing.ModelSpace.AddRegion(bound)
- plineObj.Delete
- ZoomAll
- ThisDrawing.ActiveLayer = oCurrLayeR
- End Sub
|