.NET

.NET

Reply
Contributor
23 Posts
0 Kudos
Registered: ‎05-25-2012
Post 1 of 4
Accepted Solution

How to set Custom File Property without Opening File?

1673 Views, 3 Replies
06-27-2012 01:28 AM

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

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

*Expert Elite*
9,804 Posts
1,210 Kudos
Registered: ‎06-29-2007
Post 2 of 4

Re: How to set Custom File Property without Opening File?

06-27-2012 02:19 AM in reply to: vasantpadhiyar71

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
-------------------------------------------------------------------------
Valued Mentor
340 Posts
53 Kudos
Registered: ‎05-12-2009
Post 3 of 4

Re: How to set Custom File Property without Opening File?

06-27-2012 08:19 AM 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
Valued Mentor
340 Posts
53 Kudos
Registered: ‎05-12-2009
Post 4 of 4

Re: How to set Custom File Property without Opening File?

01-08-2013 10:03 AM 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post