Ist es möglich, Blockattribute in AutoCAD mit Autodesk.AutoCAD.Interop zu bearbeiten?

Ich habe eine externe WPF-Anwendung entwickelt, um Zeichnungen in c # zu generieren. Ich war in der Lage, mit Autodesk.AutoCAD.Interop Blöcke und alles, was für die Anwendung erforderlich ist, zu zeichnen, zu dimensionieren, hinzuzufügen, aber ich kann das Schriftfeld scheinbar nicht ausfüllen oder eine Teileliste erstellen.

Alle Beispiele, die ich gesehen habe, basieren auf dem Mechanismus, der die Ausführung der Anwendung als Plugin in AutoCAD erfordert. Die Wahrheit ist, dass das Einfügen einer verwendeten Zeile eine oder zwei Codezeilen mit ModelSpace.InsertLine ist. Jetzt sind es mindestens 8 Codezeilen!

Gibt es eine Möglichkeit, diese Funktionalität mit Autodesk.AutoCAD.Interop zu erreichen? Oder gibt es eine Möglichkeit, das Interop mit einem Plugin zu kombinieren, das von der externen Exe aufgerufen werden kann?

Alle Hinweise hierzu werden geschätzt.

Vielen Dank.

BEARBEITEN Um zu zeigen:

// before - Draw Line with Autodesk.AutoCAD.Interop
private static AcadLine DrawLine(double[] startPoint, double[] endPoint)
{
    AcadLine line = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint);
    return line;
}
// Now - Draw line with Autodesk.AutoCAD.Runtime
[CommandMethod("DrawLine")]
public static Line DrawLine(Coordinate start, Coordinate end)
{
    // Get the current document and database 
    // Get the current document and database
    Document acDoc = Application.DocumentManager.MdiActiveDocument;
    Database acCurDb = acDoc.Database;

    // Start a transaction
    using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
    {
        // Open the Block table for read
        BlockTable acBlkTbl;
        acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable;

        // Open the Block table record Model space for write
        BlockTableRecord acBlkTblRec;
        acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

        // Create a line that starts at 5,5 and ends at 12,3
        Line acLine = new Line(start.Point3d, end.Point3d);

        acLine.SetDatabaseDefaults();

        // Add the new object to the block table record and the transaction
        acBlkTblRec.AppendEntity(acLine);
        acTrans.AddNewlyCreatedDBObject(acLine, true);

        // Save the new object to the database
        acTrans.Commit();
        return acLine;
    }
}

Antworten auf die Frage(1)

Ihre Antwort auf die Frage