# Pyhton Script for

**URL:** <https://forum.dynamobim.com/t/pyhton-script-for/101013>\
**Category:** Uncategorized\
**Created:** [May 15, 2024, 9:10am UTC](https://forum.dynamobim.com/t/pyhton-script-for/101013 "2024-05-15T09:10:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![l.guerit](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@l.guerit](https://forum.dynamobim.com/u/l.guerit)\
**Post date:** [May 15, 2024, 9:10am UTC](https://forum.dynamobim.com/t/pyhton-script-for/101013/1 "2024-05-15T09:10:28Z")

</div>

Hello everyone  
I have written a python script in which I create several masses, of type Form. I would like to integrate an evolution into this code that will allow me to create a family for each mass created (i.e. for each iteration of my loop). I don’t know how to go about it. I’m not familiar with Dynamo’s native functions, but I’ve heard of FamilyType.ByGeometry. Is this the right choice? Or do you recommend another function?  
I’d like to point out that I’m launching my python script from a conceptual mass family window.  
I remain at your disposal for any further information.  
Thank you

Translated with [DeepL.com](http://DeepL.com) (free version)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 15, 2024, 10:49am UTC](https://forum.dynamobim.com/t/pyhton-script-for/101013/2 "2024-05-15T10:49:46Z")

</div>

@l.guerit

give it a try

> **[DirectShape Class](https://www.revitapidocs.com/2015/bfbd137b-c2c2-71bb-6f4a-992d0dcf6ea8.htm)**
>
> Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018

share your progress

```auto
# 🎯 copy/paste

```

---

<div class="post-metadata">

**Author:** ![l.guerit](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@l.guerit](https://forum.dynamobim.com/u/l.guerit)\
**Post date:** [May 15, 2024, 11:19am UTC](https://forum.dynamobim.com/t/pyhton-script-for/101013/3 "2024-05-15T11:19:46Z")

</div>

I have this code. I want each of the mass to turn into a family of conceptual masses.

```
courbe = curve.copy()

liste_curve = lstChop(courbe,len(courbe)//2)
s = []
s = Form.ByLoftCrossSections(liste_curve)
solide.append(s)

for i in range(len(solide)):
    matos_name = lst_matos[i]
    try:
        matos = Material.ByName(matos_name)
        solide_elem = solide[i]
        solide_elem.SetParameterByName('Matériau', matos)
    except:
        matos = Material.ByName('Red')

OUT = solide

```
