Commit dwg to Speckle automatically

Hi @clrkng @teocomi @gokermu,

I try to use Speckle.Autocad.API and kit converter to parse Autodesk DBObject and upload to Speckle. ConvertToSpeckle seems retrieve DBObject. However, its upload seems unable to display.


May I ask “no display value” is because loaded converter failed to convert DBObject or ConvertToSpeckle filed to convert? Thanks. The following is my code.

var kit = KitManager.GetDefaultKit();
var converter = kit.LoadConverter(“AutoCAD2022”);
IList blist = new List();
using (Transaction tr = db.TransactionManager.StartTransaction())
BlockTable blckTbl = tr.GetObject(doc.Database.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord btr = tr.GetObject(blckTbl[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord;
foreach (ObjectId objId in btr)
DBObject obj = tr.GetObject(objId, OpenMode.ForWrite) as DBObject;
catch{ }
var commitObject = new Base();
commitObject[“@all”] = blist;
string url_ = “”;
Account account = new Account();
account.token = token;
account.serverInfo = new ServerInfo
url = url_
var transports = new List<Speckle.Core.Transports.ITransport>() { new ServerTransport(account, streamid) };

            Task.Run(async () => {
                var objectId = await Operations.Send(
                @object: commitObject,
                transports: transports,
                useDefaultCache: true

                var actualCommit = new CommitCreateInput()
                    streamId = streamid,
                    objectId = objectId,
                    branchName = "main",
                    message = "IFC",
                    sourceApplication = "Speckle API",
                var client = new Client(account);
                var response = await client.CommitCreate(actualCommit);
        catch(System.Exception ex) { MessageBox.Show(ex.ToString()); }

All regards,

1 Like

Update, forgot to add


what a shame on me. Now, I’m using PowerBI to decompose commit. Easy!


Did adding SetContextDocument solve your issue @archilles0203 ?

1 Like

Yes, I forgot that so that probably converter has no idea to parse DBObject. Thanks!

Thanks @gokermu .
However, when I unpack the records in data column of dwg commit in Power BI, as you can see in below, I cannot find Layer parameter.

“data”, {“x”, “y”, “z”, “id”, “units”, “displayStyle”, “speckle_type”, “applicationId”, “plane”, “value”, “height”, “richText”, “rotation”, “AutocadProps”, “displayValue”, “area”, “bbox”, “knots”, “closed”, “degree”, “domain”, “length”, “points”, “weights”, “periodic”, “rational”, “end”, “start”}, {“data.x”, “data.y”, “data.z”, “”, “data.units”, “data.displayStyle”, “data.speckle_type”, “data.applicationId”, “data.plane”, “data.value”, “data.height”, “data.richText”, “data.rotation”, “data.AutocadProps”, “data.displayValue”, “data.area”, “data.bbox”, “data.knots”, “data.closed”, “”, “data.domain”, “data.length”, “data.points”, “data.weights”, “data.periodic”, “data.rational”, “data.end”, “data.start”}

@gokermu @clrkng
May I ask what is the strategy to take layers out from AutoCAD via Speckle API? or, should I create my Converter for this usage? Appreciate any comment.


Hi @archilles0203 , layers in AutoCAD are sent as Collection objects in the commit body:


You can filter for speckle_type = Speckle.Core.Models.Collection and check that collectionType = layer