autodesk.autocad.runtime importieren
autodesk.autocad.applicationservices importieren
autodesk.autocad.databaseservices importieren
autodesk.autocad.geometry
<commandmethod("addline")> - Ja.
Public sub addline()
'' erhalten Sie das aktuelle Dokument und die Datenbank
dim acdoc als Dokument = application.documentmanager.mdiactivedocument
dim accurdb als Datenbank = acdoc.database
'' Beginn einer Transaktion
actrans als Transaktion = accurdb.transactionmanager.starttransaction()
'' öffnen Sie die Blocktabelle zum Lesen
dim acblktbl als blockierbar
acblktbl = actrans.getobject(accurdb.blocktableid, openmode.forread)
'' öffnen Sie den Block-Tabellenrekord-Modellraum für schreiben
dim acblktblrec als blocktablerecord
acblktblrec = actrans.getobject(acblktbl(blocktablerecord.modelspace), _
openmode.forwrite)
'' erstellen Sie eine Linie, die bei 5,5 beginnt und endet bei 12,3
dim acline as line = new line(new point3d(5, 5, 0), new point3d(12, 3, 0))
acline.setdata basedefaults()
'' Fügen Sie das neue Objekt zum Block-Tabellenrekord und der Transaktion hinzu
acblktblrec.appendentity(acline)
actrans.addnewlycreateddbobject(acline, true)
'' das neue Objekt in der Datenbank speichern
actrans.commit()
Ende mit
Endteil</commandmethod("addline")>