Hi,
I am trying to create an editable PythonPart with an Interactor in Allplan and I found some confusing behavior regarding .pyp vs .pal.
My setup:
Stairs_automation.pyp
Stairs_automation.py
Stairs_automation.pal
Inside the interactor constructor I originally loaded the palette like this:
result, self.build_ele_script, self.build_ele_list, self.control_props_list, \
self.build_ele_composite, partn_name, self.file_name = \
self.build_ele_service.read_data_from_pyp(
self.pyp_path + "\\Stairs_automation.pal",
self.str_table_service.str_table,
False,
self.str_table_service.material_str_table
)
Then I create geometry and save it as PythonPart using:
pyp_util = PythonPartUtil()
pyp_util.add_pythonpart_view_2d3d([test]) #test is AllplanBasisElements.ModelElement3D object
pyp_transaction = PythonPartTransaction(
self.coord_input.GetInputViewDocument()
)
pyp_transaction.execute(
AllplanGeo.Matrix3D(),
self.coord_input.GetViewWorldProjection(),
pyp_util.create_pythonpart(self.build_ele),
self.modification_ele_list
)
I was trying to change paths:
#self.build_ele.pyp_file_name = self.pyp_path + "\\Stairs_automation.pyp"
#self.build_ele.pyp_file_name = self.pyp_path + "\\Stairs_automation.pal"
Problem:
- the geometry was NOT even created
- the PythonPart was not editable
- double click did not reactivate the interactor
Then I changed ONLY this:
read_data_from_pyp(
self.pyp_path + "\\Stairs_automation.pyp",#I used test .pyp only for creating PP
...
)
instead of:
read_data_from_pyp(
self.pyp_path + "\\Stairs_automation.pal",
...
)
and suddenly:
geometry is created correctly
PythonPart is editable
double click works
interactor reopens correctly
So now I am confused because in many official Allplan examples I see .pal passed into read_data_from_pyp(...).
I would like to follow Allplan and create PP with .pal in creating palette
Questions:
- What is the correct/recommended workflow?
- Should read_data_from_pyp() always receive the main .pyp instead of .pal?
- What exactly is the role of .pal in editable interactors?
- Why does loading .pal directly break PythonPart creation/reactivation in my case?
- Is .pal only meant as palette definition while .pyp initializes the actual PythonPart metadata (pyp_file_name, hash, parameters, etc.)?
Any clarification would be greatly appreciated.
Thanks!