Divided Surface Creation of Mass in Revit Project

Hello,
I found a code to create Divided Surface for Mass with Python through this link:
Link

Here is the code and the result:

import clr
clr.AddReference('RevitAPI') 
clr.AddReference('RevitAPIUI') 
from Autodesk.Revit.DB import * 
 
app = __revit__.Application
doc = __revit__.ActiveUIDocument.Document
 
t = Transaction(doc, 'Divide Surface.')
 
t.Start()
 
#Create a FilteredElementCollector
collector = FilteredElementCollector(doc)
collector.OfCategory(BuiltInCategory.OST_MassForm)
 
famtypeitr = collector.GetElementIdIterator()
famtypeitr.Reset()
 
for item in famtypeitr:
    typeID = item
    srfObj = doc.get_Element(typeID)
 
    #Get Geometry Elements
    geOptions = app.Create.NewGeometryOptions()
    geOptions.ComputeReferences = True
    geoElem = srfObj.get_Geometry(geOptions)
 
    #For each geometry object in geometry elements
    for geObj in geoElem.Objects:
 
        #For each face on the geometry object
        for face in geObj.Faces:
 
            #Divide the face
            divSrf = doc.FamilyCreate.NewDividedSurface(face.Reference)
 
            #Establish spacing rules
            srfU = divSrf.USpacingRule
            srfU.SetLayoutFixedNumber(20, SpacingRuleJustification.Center,0,0)
 
            srfV = divSrf.VSpacingRule
            srfV.SetLayoutFixedNumber(20, SpacingRuleJustification.Center,0,0)
 
t.Commit()
 
__window__.Close()

It works on Conceptual Mass environment. But, I want to implement it inside Revit project.

So, I want to automate the sequence of (1) Click Mass > (2) Edit in-place > (3) Click surface > (4) Click divided surface (in the project) > (5) Select pattern by utilizing dynamo/ and Python. Here are the illustration:

Any answers and suggestions would be appreciated. Thank you :slight_smile:

Addition. Here is the project file I used:
Project_Example.rvt (5.9 MB)