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

How to erase an AEC-DIMENSION-GROUP

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
anikakramer2006
1036 Views, 5 Replies

How to erase an AEC-DIMENSION-GROUP

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

 

 

5 REPLIES 5
Message 2 of 6

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

Message 3 of 6

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?

:O)

 

Greetings from Germany,

 

Anika

 

Message 4 of 6

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

Message 5 of 6

I'm sorry Smiley Embarassed... 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

 

 

 

 

Message 6 of 6

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

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