.NET

Reply
Contributor
vasantpadhiyar71
Posts: 23
Registered: ‎05-25-2012
Message 1 of 4 (951 Views)
Accepted Solution

How to set Custom File Property without Opening File?

951 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
*Expert Elite*
Alfred.NESWADBA
Posts: 8,867
Registered: ‎06-29-2007
Message 2 of 4 (946 Views)

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
jeff
Posts: 321
Registered: ‎05-12-2009
Message 3 of 4 (924 Views)

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
jeff
Posts: 321
Registered: ‎05-12-2009
Message 4 of 4 (777 Views)

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community