Type Error: No method matches given arguments after switched to Cpython3

Any one have any update in this No method matches given arguments Type error while using Cpython3? It happened to me in this line of code “linePattern = patt.GetLinePattern()” but it seems like this is a known error. I’m using R23 Dynamo Core 2.13.1.3887 Dynamo Revit 2.13.1.3891
https://github.com/DynamoDS/DynamoRevit/issues/2850
Thank you!

Yes, the method no longer works in CPython even though it is present
Here is a workaround that works with IronPython and CPython using the method directly from the Class

linepatternelements = (
    FilteredElementCollector(doc)
    .OfClass(LinePatternElement)
    .ToElements()
)

output = []
for lpe in linepatternelements:
    output.append(LinePatternElement.GetLinePattern(doc, lpe.Id))

OUT = output

Thanks for the walk around, it work for this method, but I found that there more methods returning a same error. For example: GetSolidPatternId(), and SetLinePattern(), and I belive will see more, not sure there are walkaround solutions for all.

GetSolidPatternId is a static method - it will not change LinePatternElement.GetSolidPatternId() will return the Revit system integer that represents a solid line pattern

Setting a line pattern can be done from a line’s GraphicStyleCategory by Category.SetLinePatternId(<id>, <GraphicsStyleType>) inside a transaction

Here’s some minimal code

graphicsstyles = (
    FilteredElementCollector(doc)
    .OfClass(GraphicsStyle)
    .ToElements()
)

mylinestyle = [gs for gs in graphicsstyles if gs.Name == "MyLineStyle"].pop()

solid = LinePatternElement.GetSolidPatternId()

with Transaction(doc, "Change MyLineStyle to solid") as t:
    t.Start()
    gsc = mylinestyle.GraphicsStyleCategory
    gsc.SetLinePatternId(solid, GraphicsStyleType.Projection)
    t.Commit()

Works for me in both flavours of python

1 Like