Handle creation¶
The general creation of a handle for a PythonPart parameter like
<Parameter>
<Name>SlopeX</Name>
…
<ValueType>Length</ValueType>
</Parameter>
can be done with the class HandleProperties
as follows:
handle_slope = HandleProperties("Slope",
point1 + AllplanGeo.Point3D(build_ele.SlopeX.value, build_ele.SlopeY.value, 0),
point1,
[HandleParameterData("SlopeX", HandleParameterType.X_DISTANCE, show_input_controls),
HandleParameterData("SlopeY", HandleParameterType.Y_DISTANCE, show_input_controls)],
HandleDirection.XYZ_DIR, False)
handle_slope.info_text = "Slope handle"
handle_list.append(handle_slope)
If the parameter is a Python list e.g. of Point3D like
<Parameter>
<Name>PolyPoints</Name>
…
<Value>[Point3D(500,-2000,0);Point3D(1000,-4000,0);Point3D(5000,-5000,0);Point3D(5000,-1000,0)]</Value>
<ValueType>Point3D</ValueType>
</Parameter>
the handle must be assigned to an index of the list:
for index, pnt in enumerate(build_ele.PolyPoints.value):
handle_list.append(HandleProperties("PolyPoints", pnt, AllplanGeo.Point3D(),
[HandleParameterData("PolyPoints", HandleParameterType.POINT, False,
list_index = index)],
HandleDirection.XYZ_DIR))
The examples in the Examples section describe the handle creation in more specific details.