protected override void SolveInstance(IGH_DataAccess DA)
        {
            if (!_needBake || !GhDrawingContext.LinkedDocument.IsActive)
            {
                return;
            }

            /*Extract input parameters*/
            IGH_GeometricGoo geometry = null;

            if (!DA.GetData("Geometry", ref geometry))
            {
                return;
            }

            var elementType = Bricscad.Bim.BimTypeElement.BimGenericBuildingElt;

            Types.ElementType type = null;
            if (DA.GetData("ElementType", ref type))
            {
                elementType = type.Value;
            }

            Bricscad.Bim.BIMSpatialLocation spatialLocation = null;
            Types.SpatialLocation           location        = null;
            if (DA.GetData("SpatialLocation", ref location))
            {
                spatialLocation = location.Value;
            }

            var objIds = BakeGhGeometry(geometry);

            if (objIds == null)
            {
                return;
            }

            Bricscad.Bim.BIMProfile bimProfile = null;
            Types.Profile           profile    = null;
            if (DA.GetData("Profile", ref profile))
            {
                var dummy = new Bricscad.Bim.BIMProfile(profile.Value);
                if (dummy.SaveProfile(GhDrawingContext.LinkedDocument.Database) == Bricscad.Bim.BimResStatus.Ok)
                {
                    bimProfile = dummy;
                }
            }

            var createdProfileId = _OdDb.ObjectId.Null;

            _OdDb.ObjectEventHandler objAppended = (s, e) => createdProfileId = e.DBObject.ObjectId;
            GhDrawingContext.LinkedDocument.Database.ObjectAppended += objAppended;
            var curvesToDelete = new _OdDb.ObjectIdCollection();

            for (int i = 0; i < objIds.Count; ++i)
            {
                var id = objIds[i];
                spatialLocation?.AssignToEntity(id);
                Bricscad.Bim.BIMClassification.ClassifyAs(id, elementType);
                bimProfile?.ApplyProfileTo(id, 0, true);
                //replace curve with created solid profile
                if (DatabaseUtils.IsCurve(id) && !createdProfileId.IsNull)
                {
                    curvesToDelete.Add(id);
                    objIds[i]        = createdProfileId;
                    createdProfileId = _OdDb.ObjectId.Null;
                }
            }
            DatabaseUtils.EraseObjects(curvesToDelete);
            GhDrawingContext.LinkedDocument.Database.ObjectAppended -= objAppended;
            var res = new List <Types.BcEntity>();

            foreach (_OdDb.ObjectId objId in objIds)
            {
                DA.SetData("BuildingElement",
                           new Types.BcEntity(new _OdDb.FullSubentityPath(new _OdDb.ObjectId[] { objId }, new _OdDb.SubentityId()), GhDrawingContext.LinkedDocument.Name));
            }
        }