Programatically "launch" component's menu item

While I wait for some help, as long as I can’t figure out how to complete the paths suggested by @DavidRutten , I’am walking blindly, navigating inside ArchiCADConnection.dll, exploring the terrain for alternatives… This is already just a didactical exercise for me.

import scriptcontext as sc
import Grasshopper as gh
from System.Windows import Forms
import clr
clr.AddReference('ArchiCADConnection.dll')
import ArchiCAD


if activate:
    doc = gh.Instances.ActiveCanvas.Document
    comp = [obj for obj in doc.Objects if obj.NickName == name][0]
    comp.Menu_CustomSingleValueItem() #this statement raises the error

i’am trying to execute our infamous component’s Menu_CustomSingleValueItem() method,
Well, the code above raises this exception:

Runtime error (TypeErrorException): cannot access protected member Menu_CustomMultiValueItem without a python subclass of AC_Polyline

Traceback:
line 23, in script

The method happens to be decorated as protected, so no access posible wihout subclassing. But as i said yesterday, subclassing seems to be not allowed, at least i interpret this from python exception message:

class myPolyParamClass(ArchiCAD.PersistentParams.AC_Polyline):
    def __init__(self):
        pass

boom, in the face…

Runtime error (TypeErrorException): cannot derive from ArchiCAD.PersistentParams.AC_Polyline because it is sealed
Traceback:
line 25, in script

wich is exactly what avoid me to follow David’s suggestion of overriding AppendMenuItems() (if i has understood him correctly)

well… Further orientation would be wellcome.
thanks

1 Like