|
我被难住了。
我正在使用RealDWG API C#,我似乎无法沿着向量移动ModelSpace中的所有实体。
我可以更改图层,但我不能移动实体。
这是方法。有什么想法吗?
{
使用(Database tmpDb=new Database(false, true))
{
tmpDb.ReadDwgFile(block Path,System.IO.FileShare.ReadWrite, true, "");
使用(Transaction tmpTrans=(Transaction)tmpDb.TransactionManager.StartTransaction())
{
LayerTable layerTbl=(LayerTable)tmpTrans.GetObject(tmpDb.LayerTableId,OpenMode.ForRead);
//关闭度量层
string sLayerName="Metric";
LayerTableRecacLyrTblRec;
if(layerTbl.Has(sLayerName))
{
acLyrTblRec=tmpTrans.GetObject(layerTbl[sLayerName],OpenMode.ForWrite)as LayerTableRecord;
acLyrTblRec.IsOff=true;
}
var temBt=(BlockTable)tmpTrans.GetObject(tmpDb.BlockTableId,OpenMode.ForRead);
var>
Point3d delta=new Point3d(0,0,0);
Vector3d的距离ToZero=zero.GetVectorTo(new Point3d(1.5,1.5,0));
//沿着向量移动所有实体
foreach(tmpBtr中的ObjectId entId)
{
Entity ent=tmpTrans.GetObject(entId,OpenMode.ForWrite)作为实体;
if(ent!=null)
{
ent.TransformBy(Matrix3d.Displacement(距离ToZero));
}
}
tmpTrans.Commit();
}
tmpDb.SaveAs(block Path,DwgVersion.AC1024);
}
}
本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请 回复 |
|