Where is your code coming from, is this some "AI" hallucination?
You didn't supply a command name.
Here an absolute basic sample, focus on the "Setup" section.
import clr # that's an Ironpython module
# necessary to import .NET assemblies - https://ironpython.net/documentation/dotnet/dotnet.html
# https://newbedev.com/difference-between-assembly-and-dll
# "a dll is an assembly, but an assembly may not always be a dll"
clr.AddReference ('IronPython.Wpf')
import wpf # used to load and interpret the XAML user interface
# not sure why the following 2 don't need the AddReference before importing
from System.IO import StreamReader # necessary to load/read the XAML GUI file
from System.Windows.Controls import StackPanel
clr.AddReference ("System.Drawing")
from System.Drawing import Bitmap # necessary for the icon in the toolbar
try:
clr.AddReference ("Trimble.Sdk") # from version 5.50 some assemblies are "pre-referenced" - BUT not all of them
# for some you still have to do it manually
except:
clr.AddReference ("Trimble.Vce.Geometry") # in older versions we have to do it by hand, if the above fails
# it is TBC < 5.50 and we have to reference manually
from Trimble.Vce.Geometry import Point3D, Vector3D, Side # now we can load certain classes from the assembly
def Setup(cmdData, macroFileFolder):
cmdData.Key = "SCR_T1"
cmdData.CommandName = "SCR_T1"
cmdData.Caption = "_SCR_T1"
cmdData.UIForm = "SCR_T1" # MUST MATCH NAME FROM CLASS DEFINED BELOW !!!
cmdData.HelpFile = "Macros.chm"
cmdData.HelpTopic = "22602"
try:
cmdData.DefaultTabKey = "Macro Training"
cmdData.DefaultTabGroupKey = "Basics"
cmdData.ShortCaption = "T1 create simple Point-Variable"
cmdData.DefaultRibbonToolSize = 3 # Default=0, ImageOnly=1, Normal=2, Large=3
cmdData.Version = 1.00
cmdData.MacroAuthor = "SCR"
cmdData.MacroInfo = r""
cmdData.ToolTipTitle = "T1 create simple Point-Variable - fat Tooltip Title"
cmdData.ToolTipTextFormatted = "T1 create simple Point-Variable - Tooltip itself"
except:
pass
try:
b = Bitmap (macroFileFolder + "\\" + cmdData.Key + ".png")
cmdData.ImageSmall = b
except:
pass
class SCR_T1(StackPanel): # this inherits from the WPF StackPanel control
def __init__(self, currentProject, macroFileFolder):
with StreamReader (macroFileFolder + r"\SCR_T1.xaml") as s:
wpf.LoadComponent (self, s)
self.currentProject = currentProject
def OnLoad(self, cmd, buttons, event):
self.okBtn = buttons[0]
self.Caption = cmd.Command.Caption
def OkClicked(self, cmd, e):
p1 = Point3D(1, 0, 0)
p2 = Point3D(10, 0, 10)
------------------------------
Ronny Schneider
------------------------------