It is possible to extract solids from a transaction using rollback?

It is possible to extract solids from a transaction using rollback?

peqr1997
Participant Participant
274 Views
2 Replies
Message 1 of 3

It is possible to extract solids from a transaction using rollback?

peqr1997
Participant
Participant

Hello guys, i am trying to get the original solid of a SLOPPED column that has cuts and joins with other elements, try to use "GetOriginalGeometry" but it loses the slope, so it occurred to me to use a transaction to temporarily remove the nearby elements and get the solid of the column already isolated and then with "RollBack" restore the deleted elements, all good but the solid supposedly obtained does not exist. What am I doing wrong?, I did the same thing other times but only obtaining the volume as "double" and it worked, but it seems that with "Solid" it doesn't work.

 

What am I doing wrong?  Do you recommend another way?

 

 

public static Solid Get_original_solid (Element elem, Document doc, Options opt)
        {
            List<ElementId> Ids_nearestElems = new List<ElementId>();
            List<Element> nearestElems = Get_NearestElements(elem, doc);
            foreach (Element e in nearestElems) 
            {
                Ids_nearestElems.Add(e.Id);
            }
            
            Solid originalSolid = null;
            using (Transaction trans = new Transaction(doc))
            {
                trans.Start("Get original solid");
                doc.Delete(Ids_nearestElems);
                doc.Regenerate();
                Solid solid = GetSolid(elem, opt);
                originalSolid = solid;
                trans.RollBack();
            }
            return originalSolid;
        }

 

 

0 Likes
Accepted solutions (1)
275 Views
2 Replies
Replies (2)
Message 2 of 3

architect.bim
Collaborator
Collaborator
Accepted solution

Hi!

Try to make a copy your solid using Clone method. And only then roll the transaction back. I'm not sure, but it might help.


Maxim Stepannikov | Architect, BIM Manager, Instructor
0 Likes
Message 3 of 3

peqr1997
Participant
Participant

Now it works.

Thanks a lot !