Estou criando uma rotina para busar as informações dos PIESUPPORT em varios desenhos dentro do Plant 3D. Para não precisar abrir cada arquivo e executar a rotina que seria muito demorado, estou criando atraves do READDWGFILE para acessar o banco de dados de cada DWG e buscar as informações, porém quando executo eu cheguei ate o ponto de obter o OBJECTID dos elementos de PIPESUPPORT mas quando tento obter o ROWID para fazer as consultas nas tabelas do Plant3D aparece o erro que o objeto não tem LINK.
É possivel obter informações do banco de dados do Plant3D utilizando o READDWGFILE?
CODIGO:
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = new Database(false, true);
//Contextualize Plant Db...
PipingProject project = PlantApplication.CurrentProject.ProjectParts["Piping"] as PipingProject;
DataLinksManager dlm = project.DataLinksManager;
PnPDatabase pnpDb = dlm.GetPnPDatabase();
db.ReadDwgFile(@"O:\7010\BRASKEM\Plant 3D Models\PJ-17002226\PJ-1700226-TUB.dwg", System.IO.FileShare.ReadWrite, false, "");
Transaction tr = db.TransactionManager.StartTransaction();
using (tr)
{
// Open the blocktable, get the modelspace
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);
// Iterate through it, dumping objects
foreach (ObjectId supportId in btr)
{
Entity ent = (Entity)tr.GetObject(supportId, OpenMode.ForRead);
string typeString = ent.GetType().ToString();
if (typeString.Contains("Support"))
{
int rowId = dlm.FindAcPpRowId(ent.ObjectId);
//...continue
////////////////////////////////////////////////////////
}
Solved! Go to Solution.
Solved by quan_hm. Go to Solution.
DataLinksManager.FindAcPpRowId can only be used on objects residing in a currently opened drawing with its owning project opened in Project Manager.
Thank you for reply.
So it is not possible to use READDWGFILE to consult information from Plant 3D without having to open each file?
You can use READDWGFILE and get database info - as long as the project is open, you just can't use that function to get the row ID.
Could you tell me which way to query the ROWID using the OBJECTID together with the READDWGFILE?
Hi,
If you want datalinksmanager to read object in a drawing that was not open you need to add that drawing to datalinksmanager
dlm.AddDrawing(db, false);
Can't find what you're looking for? Ask the community or share your knowledge.