[New Feature Preview] Python 3 Support Issue Thread

Thanks @c.poupin,
I tried to translate the examples you provided to work with my code and unfortunatley I am either not getting it OR there is another issue that is stopping this from working.
Please see my amended snippet of my previous attempt:

  global adoc
    global cdoc
    s1 = "station" #dummy inputs as per advice on other threads
    o1 = "offset"
     # use float as no longer able to use
    # - strongbox functionality  as per ironpython i.e. Double #clr.Reference[float]()
    station = 1.23 
    offset = 1.23 

    output = []
    nm=[]
    sta=[]
    offs=[]

    with adoc.LockDocument():
        with adoc.Database as db:
            with db.TransactionManager.StartTransaction() as t:
                bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
                btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
                alignment = None
                for ind,x in enumerate(name):
                    #ind=name.index(i)             
                    for oid in cdoc.GetSitelessAlignmentIds():
                        al = t.GetObject(oid, OpenMode.ForRead)
                        if al.Name == name[ind]:
                            alignment = al
                            # so trying to use 'dummy' inputs and station offset will be returned to assigned float vars?
                            station,offset=alignment.StationOffset(easting[ind], northing[ind],s1,o1) 
                            sta.append(station)
                            offs.append(offset)
                            break
                            
                    # Couldn't find the alignment with the given name
                    if alignment is None:
                        return
    #need to allow for start and and points and for flipping osl and os right points
    return [sta, offs]


OUT = get_soe_by_en(names, northings, eastings)

This crashes Civil 3d with unhandled Type Error.

Any further feedback appreciated, maybe @Paolo_Emilio_Serra1 could advise to correct solution here is possible, thanks.

Cm

@cjm
dummy variables must be same type as ref or out parameters

https://help.autodesk.com/view/CIV3D/2022/ENU/?guid=c6fe2704-261c-3cbd-d159-4d3324963f6f

@c.poupin Was there ever a solution/workaround for the family load code you pasted a while back? I’m trying to get that exact same code to work in CPython3 and am having the same issue you experienced (“interface takes exactly one arguement…”). Thanks!

Hi, @jpclark

currently, I didn’t found a stable solution

Hi @c.poupin,

any update on that issue? Could you solve it or is there no way to fix that?
I ran into the same problem unfortunately…
Thank you in advance for your answer!

Hello,
for which issue ? Net interface ?

Yeah, the bug with family load via .NET interface.

no, I have the impression that PythonNet 2.5.2 fails to Release all resources for some Revit Objects created.
I’m waiting for PythonNet 3.0 hoping that fixes the problem.

IronPython3 final should be released soon too

2 Likes