Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Transaction Exception

1 REPLY 1
Reply
Message 1 of 2
Mohamed.E.Salem
321 Views, 1 Reply

Transaction Exception

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

 

 

1 REPLY 1
Message 2 of 2

Hi!

 

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report