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

AssocArray doesn't remember deleted items

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
277 Views, 0 Replies

AssocArray doesn't remember deleted items

I'm trying to read AssocArrays created by the user, when they are created and later. The issue I'm running into is when users create an AssocArray and erase some items out of it, then save and reopen it still renders fine but when search the AssocArray object it believes the items are there.

 

I've attached a command that reads the assoc array.

 

[CommandMethod("READARRAY")]
        public static void READARRAY()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            using (DocumentLock lok = doc.LockDocument())
            {
                using (Transaction trans = doc.TransactionManager.StartTransaction())
                {
                    PromptEntityOptions peo = new PromptEntityOptions("\nSelect an assoc array:");
                    PromptEntityResult per = doc.Editor.GetEntity(peo);

                    if (per.Status == PromptStatus.OK)
                    {
                        AssocArray dbo1 = AssocArray.GetAssociativeArray(per.ObjectId);
                        if (dbo1 != null)
                        {
                            AssocArrayRectangularParameters assocParams = (AssocArrayRectangularParameters)dbo1.GetParameters();

                            int maxY = assocParams.RowCount;
                            int maxX = assocParams.ColumnCount;
                            for (int x = 0; x < maxX; x++)
                            {
                                for (int y = 0; y < maxY; y++)
                                {
                                    ItemLocator il = new ItemLocator(x, y, 0);
                                    bool isErased = dbo1.IsErased(il);
                                    if (isErased)
                                        doc.Editor.WriteMessage("\n" + x + ", " + y + "\n");
                                }
                            }
                        } else
                            doc.Editor.WriteMessage("\nThat wasn't an assoc array ಠ_ಠ\n");
                    }

                    doc.Editor.PostCommandPrompt();
                    trans.Abort();
                }
            }
        }

 

Tags (1)
0 REPLIES 0

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