示例#1
0
        public void Test_SelectGroupEntity()
        {
            var file  = @"D:\Dev\honeybee-rhino-plugin\src\HoneybeeRhino.Test\TestModels\SingleRoomAndWindow.json";
            var breps = LoadBrepsFromJson(file);


            var roomObj   = InitBrepObject(breps.First(_ => _.IsSolid));
            var windowObj = InitBrepObject(breps.First(_ => _.IsSurface));

            //make room
            var roomBrep    = EntityHelper.ToRoomBrepObj(roomObj);
            var roomBrepObj = new ObjRef(roomObj.ObjectId);

            _doc.Objects.Replace(roomBrepObj, roomBrep);


            //make window //add to groupEntity
            var processedObj = roomBrepObj.AddAperture(windowObj);
            var apt          = processedObj.apertures.First();
            var done         = _doc.Objects.Replace(roomObj.ObjectId, processedObj.room);

            done &= _doc.Objects.Replace(apt.id, apt.brep);


            var newRoom = new ObjRef(roomObj.ObjectId);

            _doc.Objects.Select(newRoom, true, true);
            var selectedObjs = _doc.Objects.GetSelectedObjects(false, false);
            var counts       = selectedObjs.Count();

            _doc.Objects.UnselectAll();
            selectedObjs = _doc.Objects.GetSelectedObjects(false, false);
            foreach (var item in selectedObjs)
            {
                _doc.Objects.Purge(item);
            }
            Assert.IsTrue(counts == 2);
        }