Support Forum

[Frage] [PythonParts] ScriptObject Example on LearnNow [Gelöst]


Hi,

Thanks for adding examples in LearnNow for ScriptObject

So, I have few questions:

1) Can we have a notification when you add videos? (or maybe I missed it)

2) In modification mode you use

self.modification_ele_list.is_modification_element()
why not
self.is_modification_mode

In the main BaseScriptObjectData class it's the same and I think it's more easy to write / read

3) About the placement of the PythonPart, what is the difference between set a transformation matrix (included translation and rotation) with

pythonpart = pyp_util.create_pythonpart(build_ele= self.build_ele, placement_matrix= transformation_matrix)
and set a placement point in
CreateElementResult
and just the rotation with a matrix?

4) Please can you update the ScriptObjectPythonPart template :

def create_script_object(build_ele  : BuildingElement,
                         coord_input: AllplanIFW.CoordinateInput) -> BaseScriptObject
...

to

def create_script_object(build_ele         : BuildingElement,
                         script_object_data: BaseScriptObjectData) -> BaseScriptObject
...

ScriptObject is very great PythonPart, so more functionalities for the same writing level as Standard

Best Regards
Christophe

Lösung anzeigen Lösung verbergen

Zitiert von: cmaignan
1) Can we have a notification when you add videos? (or maybe I missed it)

We never expected, that this course would be anticipated this much! At the moment, we don't plan any other topics to be covered in a video tutorial like this, but maybe this is the best opportunity to ask the community: what other topic/use-case would you like us to cover?

Zitiert von: cmaignan
2) In modification mode you use self.modification_ele_list.is_modification_element() why not self.is_modification_mode

In the main BaseScriptObjectData class it's the same and I think it's more easy to write / read

No particular reason. When I created the course, I just overseen the shorter option but feel free to use it.

Zitiert von: cmaignan
3) About the placement of the PythonPart, what is the difference between set a transformation matrix (included translation and rotation) with pythonpart = pyp_util.create_pythonpart(build_ele= self.build_ele, placement_matrix= transformation_matrix) and set a placement point in CreateElementResult and just the rotation with a matrix?

No real difference, as long as you use the placement_matrix argument and not the local_placement_matrix. The latter has some other side effects, which I haven't investigated yet.

Zitiert von: cmaignan
4) Please can you update the ScriptObjectPythonPart template

We'll try, but it is not that easy to change anything in the released version. We will likely deliver these templates differently than with the application. Probably together with the examples, as we now have an efficient tool in the SDK to download the examples.

Best,
Bart

Zitiert von: cmaignan
1) Can we have a notification when you add videos? (or maybe I missed it)

We never expected, that this course would be anticipated this much! At the moment, we don't plan any other topics to be covered in a video tutorial like this, but maybe this is the best opportunity to ask the community: what other topic/use-case would you like us to cover?

Zitiert von: cmaignan
2) In modification mode you use self.modification_ele_list.is_modification_element() why not self.is_modification_mode

In the main BaseScriptObjectData class it's the same and I think it's more easy to write / read

No particular reason. When I created the course, I just overseen the shorter option but feel free to use it.

Zitiert von: cmaignan
3) About the placement of the PythonPart, what is the difference between set a transformation matrix (included translation and rotation) with pythonpart = pyp_util.create_pythonpart(build_ele= self.build_ele, placement_matrix= transformation_matrix) and set a placement point in CreateElementResult and just the rotation with a matrix?

No real difference, as long as you use the placement_matrix argument and not the local_placement_matrix. The latter has some other side effects, which I haven't investigated yet.

Zitiert von: cmaignan
4) Please can you update the ScriptObjectPythonPart template

We'll try, but it is not that easy to change anything in the released version. We will likely deliver these templates differently than with the application. Probably together with the examples, as we now have an efficient tool in the SDK to download the examples.

Best,
Bart