试试这个:
- [font=Consolas][size=2][/size][/font]
- [font=Consolas][size=2][size=2][font=Consolas] <CommandMethod("BatM")> _
- Public Sub BlockAtMid()
- Dim startpunt() As Double = New Double() {0.0, 0.0, 0.0}
- Dim eindpunt() As Double = New Double() {0.0, 0.0, 0.0}
- Dim midden() As Double = New Double() {0.0, 0.0, 0.0}
- Dim aanlegjaar As AcadBlockReference
- Dim streng As AcadLine
- Dim ThisDrawing As AcadDocument = Autodesk.AutoCAD.ApplicationServices.Application. _
- DocumentManager.MdiActiveDocument.AcadDocument[/font][/size]
- [size=2][font=Consolas][/font][/size]
- [size=2][font=Consolas] ' Get the first point without entering a base point
- startpunt = ThisDrawing.Utility.GetPoint(, "What is the beginning of the line?: ")
- eindpunt = ThisDrawing.Utility.GetPoint(startpunt, "What is the end of the line?: ")
- midden(0) = (startpunt(0) + eindpunt(0)) / 2
- midden(1) = startpunt(1) / 2 + eindpunt(1) / 2
- midden(2) = startpunt(2) / 2 + eindpunt(2) / 2[/font][/size]
- [size=2][font=Consolas] streng = ThisDrawing.ModelSpace.AddLine(startpunt, eindpunt)
- aanlegjaar = ThisDrawing.ModelSpace.InsertBlock(midden, "C:\block 1.dwg", 1, 1, 1, 0)[/font][/size]
- [size=2][font=Consolas] End Sub [/font][/size][/size][/font]
|