GetAssociatedParts method /Getdepedentelements method

Hi,

I want to retrieve the parts elements or the parts IDs from partmaker class.

I used a partdivide method and it returned a partmaker element, but I would need the parts it created or the ids of those parts.
image
Using GetAssocietedParts method
parts = PartUtils.GetAssociatedParts(doc, partmaker.Id, 1, 1)
The all trasaction

TransactionManager.Instance.EnsureInTransaction(doc)

if PartUtils.AreElementsValidForCreateParts(doc, FloorList):
    	createParts = PartUtils.CreateParts(doc, FloorList)
    	doc.Regenerate()

    parts = PartUtils.GetAssociatedParts(doc, Floor.Id, 0, 0)
    partmaker = PartUtils.DivideParts(doc, parts, intersectionElementsIds, curveArray, sketchPlane.Id)

    parts = PartUtils.GetAssociatedParts(doc, partmaker.Id, 1, 1)


    TransactionManager.Instance.TransactionTaskDone()

    OUT =[partDivide,parts]

i got a empty list I don´t know if this is possible.
image
Using GetAssocietedParts method

How can I create a filter to pass into the the getdependentelements method?

I have to create A IDisposable? sorry I don´t know a lot about .net framework.

Would appreciate some help on this.

Regards,

Using GetAssocietedParts method doesn’t work because partmaker has no partassocieted

PartUtils.HasAssociatedParts(doc,partmaker.Id)

I got false
image

The get dependent elements method recives a filter

the element classfilter Constructor recives a type to do a filter of this type (I Think)

And to create this type I would need to import the type class (from .net?)

And I also have to put the return of the method in a IList

The ref would look something like this ?

clr.AddReference('System')
from System.Collections.Generic import List
from System import Type

And the code would look something like this ?

Part_type=typeof(part)#making the part type
filter=ElementClassFilter(Part_type)#making the filter#making the filter
Part_List=List[ElementId]()#making the part list receiver
PartList.Add(GetDependentelElements(filter)) #getting parts ids 

If anyone could help, I would appreciate

Thank you very much !

Forgot to mention, I’ve noticed that sometimes the output list was giving the wrong results. Transaction.end did the trick.