如何写块?
C#开发|冯美娟|2018-07-30 14:56
-
回答:
private void WriteBlock() { MxDrawSelectionSet ssGet = new MxDrawSelectionSet(); MxDrawUtility mxUtility = new MxDrawUtility(); mxUtility.Prompt("\n 选择写块实体:"); ssGet.Select (MCAD_McSelect.mcSelectionSetUserSelect,null,null,null); MxDrawResbuf aryId = new MxDrawResbuf(); for(Int32 i = 0; i < ssGet.Count;i++) { MxDrawEntity tmpEnt = ssGet.Item(i); aryId.AddObjectId(tmpEnt.ObjectID ); } MxDrawPoint basePoint = new MxDrawPoint(); MxDrawDatabase dataBase = (MxDrawDatabase)axMxDrawX1.GetDatabase(); MxDrawIdMapping maping; MxDrawDatabase newDataBase = dataBase.Wblock(aryId,basePoint,out maping); if(newDataBase != null) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "dwg 文件(*.dwg)|*.dwg"; if (sfd.ShowDialog() == DialogResult.OK) { newDataBase.SaveAs(sfd.FileName,0,null); MessageBox.Show("写块文件成功"); } } }