@Guus All great points, and wow that powerpoint mockup!
We are definitely planning a more sophisticated interface for schema mapping post beta, with potential UI integration pending mac support.
As you’ve identified, the core challenge is scoping out the most useful filtering method based on sort hierarchies & geometry type. This would inevitably influence file organization & user workflows for each non-visual programming application: easy for apps that primarily use Layers
to sort, but needs for apps with multiple sort mechanisms like
Blocks
, Filters
, Selection Sets
, etc.
For now, schema conversion for AutoCAD could be implemented via command to set object XData
, similar to Rhino ( pseudocode):
[CommandMethod("SpeckleSchema", CommandFlags.UsePickSet)]
public static void SetSchema()
{
// get user selected objects, could add selection filters
var ids = new List<ObjectId>();
PromptSelectionResult selection = Doc.Editor.GetSelection();
ids = selection.Value.GetObjectIds().ToList();
foreach (var id in ids)
{
// decide schema here, by assumption or another user input prompt
string schema = "";
switch (id.ObjectClass.DxfName)
{
case "LINE":
schema = "MaybeAColumn"; break;
}
// add schema to object XData
using (Transaction tr = Doc.TransactionManager.StartTransaction())
{
DBObject obj = tr.GetObject(id, OpenMode.ForWrite);
obj.XData = new ResultBuffer(new TypedValue(Convert.ToInt32(DxfCode.Text), schema));
tr.Commit();
}
}
}
And schema properties would be checked on conversion before sending the stream:
public Base ConvertToSpeckle(object obj)
{
switch (obj)
{
case DBObject o:
// check for speckle schema xdata
string schema = GetSpeckleSchema(o.XData);
if (schema != null)
return ObjectToSpeckleBuiltElement(o);
else return ObjectToSpeckle(o);
}
}
Great feedback, the schema builder feature might need a whole other thread to itself!