Transaction Exception

Mohamed.E.Salem
Advocate

Transaction Exception

Mohamed.E.Salem
Advocate
Advocate

Hi my friends,

I am planing to use  bottom to select familyinstance (column ) then draw floor according to its position. so i used modeless form.but the problem as i understand the Revit API consider modeless form as  external application runing outside API context (I can't understand why) so i can't make transaction.Anyone can help me ???!

this message appeared

Capture.PNG

 

        public bool CreatedropPannel(CurveArray profile, FloorType floorType,Level level)
        {
            Floor dropPannel;
          
             try
            {
               

                if (profile !=null && floorType != null && level != null)
                {

               
                // normal vector
                XYZ normal = XYZ.BasisZ;

                    // create floor

                   Transaction t = new Transaction(m_revit.ActiveUIDocument.Document);
                    t.Start("create drop panel");
                    //dropPannel = doc.Create.NewFloor(profile, floorType, level, true, normal);
                    dropPannel = m_revit.ActiveUIDocument.Document.Create.NewFloor(profile, floorType, level, true, normal);

                  t.Commit();
                    if (dropPannel == null) { return false; }
                }

            }
            catch (Exception ex)
            {
                TaskDialog.Show("Revit", ex.ToString());
                return false;
            }
          
            return true;

        }

Thank you and best regards,

Salem

 

 

0 Likes
Reply
354 Views
1 Reply
Reply (1)

aignatovich
Advisor
Advisor

Hi!

 

Look at Samples\ModelessDialog\ModelessForm_ExternalEvent\CS sample in Revit SDK how to deal with modeless forms

0 Likes