.NET

Reply
Active Contributor
anikakramer2006
Posts: 29
Registered: ‎03-23-2011
Message 1 of 6 (316 Views)
Accepted Solution

How to erase an AEC-DIMENSION-GROUP

316 Views, 5 Replies
08-19-2013 06:21 AM

Hi,

 

we are using AutoCAD and also AutoCAD Architecture 2013

so we got drawings with AEC-Dimensions.

For our external Customers I tried to erase all Dimensions from our drawings.

Had no Problem with the AutoCAD Dimensions like RotatedDimension etc.

But now I tried to get the AEC-DIMENSIONS-GROUP.

I guess this objects must be at the BlockTable and I know when you open an

AutoCAD Architecture drawing in AutoCAD they turn into Proxies (or am I wrong?).

My Question is, what kind of Object is AEC-DIMENSION-GROUP and how can I get them with

my C# AutoCAD CommandClass?

 

Is it the same way like:

IntPtr mleaderPtr = RXClass.GetClass(typeof(RotatedDimension)).UnmanagedObject;

Maybe somebody got a hint...

 

thanks,

 

anika

 

 

Ok I did it.

I just added the compiled AecArchDACHMgd.ll and the AecBaseMgd.dll

to my NETLOAD Lisp Routine now it is also working on every workstation

with pure AutoCAD 2013.

 

Now everything is fine,

my c# Tool now erases AEC_DIMENSION_GROUP's too...

 

thanks

 

Just have to do this for the 32-Bit Versions too...

so I' fine now.

 

Anika

ADN Support Specialist
Balaji_Ram
Posts: 701
Registered: ‎03-21-2011
Message 2 of 6 (285 Views)

Re: How to erase an AEC-DIMENSION-GROUP

08-21-2013 12:50 AM in reply to: anikakramer2006

Hi,

 

I am not an AEC expert, but may be one of these suggestions helps you provide some direction to investigate this on your own.

 

1. Use the ARXDBG snoop tool from the ObjectARX SDK folder under "\samples\database\ARXDBG".

    After you have the .arx loaded, right-click on the drawing and select "ArxDbg->Entity Info" from the context menu

 

2. Iterate through the model space of a sample drawing that has the AEC dimensions and print its RXClass name.

    "ObjectId.ObjectClass.Name" should get you the name.



Balaji
Developer Technical Services
Autodesk Developer Network

Active Contributor
anikakramer2006
Posts: 29
Registered: ‎03-23-2011
Message 3 of 6 (281 Views)

Re: How to erase an AEC-DIMENSION-GROUP

08-21-2013 01:12 AM in reply to: Balaji_Ram

Hi,

 

thank you for your suggestion.

I already did "snoop" the entity.

It's an DimensionGroup.

 

I could solve the problem for Architecture if import the

AecArchDachMgd.dll

AecBasMgd

for Architecture

this works fine...

 

        public void MakeMyDayAndEraseAEC() // This method can have any name
        {

            IntPtr mleaderPtr = RXClass.GetClass(typeof(DimensionGroup)).UnmanagedObject;
            Database database = HostApplicationServices.WorkingDatabase;
           

            using (Transaction transaction = database.TransactionManager.StartTransaction())
            {
                BlockTable blkTable = (BlockTable)transaction.GetObject(database.BlockTableId, OpenMode.ForRead);
                foreach (ObjectId btRecordId in blkTable)
                {
                    BlockTableRecord btRecord = (BlockTableRecord)transaction.GetObject(btRecordId, OpenMode.ForRead);
                    if (!(btRecord.IsDependent || btRecord.IsFromExternalReference || btRecord.IsAProxy))
                    {
                        foreach (ObjectId id in btRecord)
                        {
                            if (id.ObjectClass.UnmanagedObject == mleaderPtr)
                            {
                                DimensionGroup _aecDim = (DimensionGroup)transaction.GetObject(id, OpenMode.ForRead);
                                _aecDim.UpgradeOpen();
                                _aecDim.Erase();
                                _aecDim.UpgradeOpen();

                                //}
                            }
                        }
                    }
                }
                transaction.Commit();
            }
            //Application.DocumentManager.MdiActiveDocument.Editor.Regen();

 

 

 

but it's not for AutoCAD.

There must be a libary for AutoCAD to get those DimensionGroups Class too

because I found the Entities on the layer with this...

 

        [CommandMethod("AEC_1")]
        static public void EntitiesOnLayer()
        {

            Database db = Application.DocumentManager.MdiActiveDocument.Database;
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;


              using(Transaction tr = db.TransactionManager.StartOpenCloseTransaction())
              {

                PromptResult pr = ed.GetString("\nEnter name of layer: ");
                if (pr.Status == PromptStatus.OK)
                {
                    ObjectIdCollection ents = GetEntitiesOnLayer(pr.StringResult);
                    ed.WriteMessage("\nFound {0} entit{1} on layer {2}",ents.Count,(ents.Count == 1 ? "y" : "ies"),pr.StringResult);
                    foreach (ObjectId _getId in ents)
                        {
                            ed.WriteMessage("\n{0}", _getId.ObjectClass.DxfName);
                        }
                 }
              }
        }

 

it also says...the ObjectClas.DxfName ist.... DimensionGroup

There must be a way to erase these objects from an AutoCAD drawing

by using C#....

 

Any clue?

:smileysurprised:)

 

Greetings from Germany,

 

Anika

 

ADN Support Specialist
Balaji_Ram
Posts: 701
Registered: ‎03-21-2011
Message 4 of 6 (275 Views)

Re: How to erase an AEC-DIMENSION-GROUP

08-21-2013 01:36 AM in reply to: anikakramer2006

Hi Anika,

 

Can you please share a non-confidential drawing that has the AEC dimension that you are trying to erase ?

 

 

May I know which AutoCAD version you are using in trying this ? I can then try with the same version.

 

Thank you

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Active Contributor
anikakramer2006
Posts: 29
Registered: ‎03-23-2011
Message 5 of 6 (271 Views)

Re: How to erase an AEC-DIMENSION-GROUP

08-21-2013 01:52 AM in reply to: Balaji_Ram

I'm sorry :smileyembarrassed:... here are the informations:

 

I tried this in AutoCAD 2013.

 

With assemblies: AecArchDACHMgd and AecBaseMgd

now its working in AutoCAD Architecture 2013...

but I need it also working in AutoCAD 2013....

 

Thanks

 

Anika

 

 

 

 

Active Contributor
anikakramer2006
Posts: 29
Registered: ‎03-23-2011
Message 6 of 6 (266 Views)

Re: How to erase an AEC-DIMENSION-GROUP

08-21-2013 02:26 AM in reply to: anikakramer2006

Ok I did it.

I just added the compiled AecArchDACHMgd.ll and the AecBaseMgd.dll

to my NETLOAD Lisp Routine now it is also working on every workstation

with pure AutoCAD 2013.

 

Now everything is fine,

my c# Tool now erases AEC_DIMENSION_GROUP's too...

 

thanks

 

Just have to do this for the 32-Bit Versions too...

so I' fine now.

 

Anika

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 or visit the Installation and Licensing Forum to get help installing your software.