.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set Custom File Property without Opening File?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
vasantpadhiyar71
3049 Views, 3 Replies

How to set Custom File Property without Opening File?

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();
                }            
        }

Vasant PADHIYAR
3 REPLIES 3
Message 2 of 4

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 -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 4
jeff
in reply to: Alfred.NESWADBA

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

You can also find your answers @ TheSwamp
Message 4 of 4
jeff
in reply to: jeff

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.

 

http://www.theswamp.org/index.php?topic=43512.0

You can also find your answers @ TheSwamp

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost