# How to rollback if a family can not make

**URL:** <https://discourse.mcneel.com/t/how-to-rollback-if-a-family-can-not-make/120424>\
**Category:** Revit\
**Tags:** windows, mac\
**Created:** [March 15, 2021, 12:04pm UTC](https://discourse.mcneel.com/t/how-to-rollback-if-a-family-can-not-make/120424 "2021-03-15T12:04:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssw1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ssw1/32/508387_2.png) [@ssw1](https://discourse.mcneel.com/u/ssw1)\
**Post date:** [March 15, 2021, 12:04pm UTC](https://discourse.mcneel.com/t/how-to-rollback-if-a-family-can-not-make/120424/1 "2021-03-15T12:04:12Z")

</div>

Hi,

I am having an issue where I am trying to pass a parameter number into a curtain wall family- for a different reason- this family fails to build.

It then tells me that the family can not build and I should delete the type and replace the family (this happens with a revit box that pops up).

Is there a way inside rhino inside (or my python script) where I can see that it fails and then tell the script- actually I do not want to change the parameter (and in turn delete it).

Ideally I would just leave the family as is and record that there was an issue passing in the new parameter.

However, I want it to operate on all the ones it can make successfully, just not the ones that it cant.

Thanks

---

<div class="post-metadata">

**Author:** ![Dancergraham](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dancergraham/32/497397_2.png) [@Dancergraham](https://discourse.mcneel.com/u/Dancergraham)\
**Post date:** [March 15, 2021, 12:26pm UTC](https://discourse.mcneel.com/t/how-to-rollback-if-a-family-can-not-make/120424/2 "2021-03-15T12:26:44Z")

</div>

Hello,

What does the error look like? Is it raising an exception? Do you know about `try...except` blocks in python?

---

<div class="post-metadata">

**Author:** ![ssw1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ssw1/32/508387_2.png) [@ssw1](https://discourse.mcneel.com/u/ssw1)\
**Post date:** [March 15, 2021, 12:41pm UTC](https://discourse.mcneel.com/t/how-to-rollback-if-a-family-can-not-make/120424/3 "2021-03-15T12:41:25Z")

</div>

Hi Graham,

So I pass in my parameter and the python script runs.

Then I get this error once the script has run:

 ![shot](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/6/e/c/6ecddac491e03366fa4a40dc5acda9a16a223dec.png)

I then press delete and replace and it just changes by default to a blank panel and loses all its infomation.

With my script:

I first find the paramter and then I try and set it, I do this within a try:

My script is below:

f Trigger:

```
with DB.Transaction(doc, 'test') as t:
    t.Start()
    
    
    for count, element_ind in enumerate(Element):
        # Get the element name
        PanelName = element_ind.Name
        
        # Value for Element
        Current_Value = (Value[count])

        
        # Convert to correct revit units
        Value_Conversion = UnitConverter.InHostUnits(Current_Value, DB.ParameterType.Length)
        
        # Input Value
        Element_Input = element_ind.LookupParameter("Panel_AngleIntersection_Input")
        SetInput = Element_Input.Set(str(Current_Value))
        
        Element_Input = element_ind.LookupParameter("Panel_AngleIntersection_Error")
        SetInput = Element_Input.Set(str("Added"))
    
        # Find the Keys Parameter
        Element_Key_Value = element_ind.LookupParameter(Key)
        Element_Key_Value_String = Element_Key_Value.AsString()
        

        try: 
            SetValue = Element_Key_Value.Set(Value_Conversion)
            Element_NewValue = element_ind.LookupParameter(Key)
            
            # Pass out some information

            
           
        except:
            # This says if it cant get this value, then it sets 1000 instead
            #SetValue = Element_Key_Value.Set(1000)
            print("An exception occurred")
            #Parameter_List.append("error")

    t.Commit()
```

---

<div class="post-metadata">

**Author:** ![Rickson](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/rickson/32/690545_2.png) [@Rickson](https://discourse.mcneel.com/u/Rickson)\
**Post date:** [March 15, 2021, 12:57pm UTC](https://discourse.mcneel.com/t/how-to-rollback-if-a-family-can-not-make/120424/4 "2021-03-15T12:57:33Z")

</div>

Out of my arena but i believe this will get you closer… [SetFailureHandlingOptions Method](https://www.revitapidocs.com/2015/1e913cca-f75b-8dfb-b172-5a04f3732b85.htm)

This was in one of Ehsan’s scripts…

```auto

class FailureSwallower(DB.IFailuresPreprocessor):
    def PreprocessFailures(self, failuresAccessor):
        failures = failuresAccessor.GetFailureMessages()
        for failure in failures:
            failuresAccessor.DeleteWarning(failure)
        return DB.FailureProcessingResult.Continue

# create and start the transaction
t = DB.Transaction(doc, 'Transaction Name')
fhndlr_opts = t.GetFailureHandlingOptions()
fhndlr_opts.SetFailuresPreprocessor(FailureSwallower())
t.SetFailureHandlingOptions(fhndlr_opts)
t.Start()

```

---

<div class="post-metadata">

**Author:** ![ssw1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ssw1/32/508387_2.png) [@ssw1](https://discourse.mcneel.com/u/ssw1)\
**Post date:** [March 15, 2021, 1:26pm UTC](https://discourse.mcneel.com/t/how-to-rollback-if-a-family-can-not-make/120424/5 "2021-03-15T13:26:31Z")

</div>

Excellent I will look into this- essentially I want a way to say if one of the families fails to make- roll that back… but keep trying to do the others and then commit.

---

<div class="post-metadata">

**Author:** ![Rickson](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/rickson/32/690545_2.png) [@Rickson](https://discourse.mcneel.com/u/Rickson)\
**Post date:** [March 15, 2021, 1:31pm UTC](https://discourse.mcneel.com/t/how-to-rollback-if-a-family-can-not-make/120424/6 "2021-03-15T13:31:23Z")

</div>

you might have to get more particular in the error handling, but honestly not sure what’s possible.

[https://www.revitapidocs.com/2015/376f0f4f-e1e0-f704-79cb-4d48ced78602.htm](https://www.revitapidocs.com/2015/376f0f4f-e1e0-f704-79cb-4d48ced78602.htm)

this one might do it, no?

“Loaded family curtain panels cannot be used in non-rectangular cells of the curtain host. Type-driven panels from non-rectangular cells were unlocked and left unchanged.”

[https://www.revitapidocs.com/2015/14ce6ee2-999d-0221-c008-725016fc6de4.htm](https://www.revitapidocs.com/2015/14ce6ee2-999d-0221-c008-725016fc6de4.htm)
