Hi Experts,
By Opening File into AutoCAD I can set the Custom Property(dwgname,dwgid,projectname) of the File.
But I want to set value of these properties without opening AutoCAD application.
I can set it using:
public void SetAttributes(Hashtable hashTable,String fileOpenPath)
{
Document Doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Open(fileOpenPath); //Can we create this Object using any other way??
Database Db = Doc.Database;
DatabaseSummaryInfoBuilder DbSib = new DatabaseSummaryInfoBuilder();
Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = Db.TransactionManager;
using (Transaction aTran = tm.StartTransaction())
{
foreach (DictionaryEntry entry in hashTable)
{
DbSib.CustomProperties.Add(entry.Key.ToString(), entry.Value.ToString());
}
Db.SummaryInfo = DbSib.ToDatabaseSummaryInfo();
aTran.Commit();
}
}
Solved! Go to Solution.
Hi,
>> I want to set value of these properties without opening AutoCAD application
Without having a software that can open and modify a DWG-file you can't alter any content in it.
As long as you have no alternative to AutoCAD you have to start AutoCAD. (Otherwise you may buy something like >>>Autodesk's RealDWG<<< or >>>OpenDwg<<<)
What may help is that you don't need to load the DWG into the editor, you can just open the file-database using
new DatabaseServices.Database and
Database.ReadDwgFile.
- alfred -
Maybe ask one the guys over at AdnDevBlog and see if they will provide a link to DWG Properties (DWGPropsX) control
and info on DwgPropsX.dll
Here is a start and needs refactoring just thrown together to see if worked, and and have not read it yet but a link to pdf with good info.
Can't find what you're looking for? Ask the community or share your knowledge.