Dynamic Object Creation And Deletion: Difference between revisions

From Planimate Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
A model can modify its own structure by adding portals (copying a master) and deleting portals from itself.
A model can modify its own structure by adding portals (copying a master) and deleting portals from itself.  


This is achieved using a table to provide a series of commands to the edit environment. A dispatcher in "Restart Engine/Continue" mode is used to perform the edits.
This is achieved using a table to provide a series of commands to the edit environment. A dispatcher in "Restart Engine/Continue" mode is used to perform the edits.  


Dispatchers in this mode restart the model engine whilst preserving the item that triggered them. ALL OTHER ITEMS in the model are deleted - the run is<br> stopping and restarting at time = 0.&nbsp; The item at the dispatcher survives the restart and will continue through its flow after the changes to the model have been effected.  
Dispatchers in this mode restart the model engine whilst preserving the item that triggered them. ALL OTHER ITEMS in the model are deleted - the run is<br> stopping and restarting at time = 0.&nbsp; The item at the dispatcher survives the restart and will continue through its flow after the changes to the model have been effected.  


To enable the dynamic object mode, the Dispatcher "Enable Edit Command Table" option must be selected. This option is only available once the dispatcher is in "Restart Engine/Continue" mode. When this is enabled a new context menu option enables the dispatcher to be associated with a table via a reference.
To enable the dynamic object mode, the Dispatcher "Enable Edit Command Table" option must be selected. This option is only available once the dispatcher is in "Restart Engine/Continue" mode. When this is enabled a new context menu option enables the dispatcher to be associated with a table via a reference.  


The following columns ''must'' exist in the table. The order doesn't matter and other columns can exist (and will be untouched) by the dynamic object system.  
The following columns ''must'' exist in the table. The order doesn't matter and other columns can exist (and will be untouched) by the dynamic object system.  


<br> _command<br>_original_id<br>_new_id<br>_new_objpanel ''or'' _new_panel<br>_x<br>_y<br>_result<br>_new_name (optional)
<br> _command<br>_original_id<br>_new_id<br>_new_objpanel ''or'' _new_panel<br>_x<br>_y<br>_result<br>_new_name (optional)  
 
Additional columns can exist in the table and if the name of <u>Title</u> of the column matches the name of a portal attribute, the portal attribute will be set with the cells value.


<br> Each row is processed according to its _command. The following codes are&nbsp; implemented:  
<br> Each row is processed according to its _command. The following codes are&nbsp; implemented:  
Line 19: Line 21:
_new_id will be set to the new id of the object. If non zero,<br> Planimate will attempt to use the index specified but if it is in<br> use, a new index will be allocated and _new_id will be set to it  
_new_id will be set to the new id of the object. If non zero,<br> Planimate will attempt to use the index specified but if it is in<br> use, a new index will be allocated and _new_id will be set to it  


_new_objpanel (object label) or _new_panel (panel label) specifies the panel where the object will be placed. If _new_objpanel is used, it must be a portal, then its subsystem will be used. If its 0, the top level panel is used.
_new_objpanel (object label) or _new_panel (panel label) specifies the panel where the object will be placed. If _new_objpanel is used, it must be a portal, then its subsystem will be used. If its 0, the top level panel is used.  


_x,_y specify the lower left co-ord that the object will be placed at <br> _result will be set to a result code by Planimate.<br>  
_x,_y specify the lower left co-ord that the object will be placed at <br> _result will be set to a result code by Planimate.<br>  


_new_name, if present, enables the object name to be specified. The text in the cell is used as the name. It may be modified if the name is already used.
_new_name, if present, enables the object name to be specified. The text in the cell is used as the name. It may be modified if the name is already used.  


=== _command = 2: DELETE Object ===
=== _command = 2: DELETE Object ===


_original_id is the object label of the object to delete  
_original_id is the object label of the object to delete  
Line 37: Line 39:
If a row attempts to delete an object which would cause the deletion<br> of the dispatcher executing the table, the delete will fail.  
If a row attempts to delete an object which would cause the deletion<br> of the dispatcher executing the table, the delete will fail.  


=== _command = 3 REPLACE object ===
=== _command = 3 REPLACE object ===


In this mode, _original_id specifies the object ID of the original to copy and _new_id must be set to specify the object ID of the object that will<br> be replaced. The new object will hence get the ID _new_id.  
In this mode, _original_id specifies the object ID of the original to copy and _new_id must be set to specify the object ID of the object that will<br> be replaced. The new object will hence get the ID _new_id.  


The _x,_y and _new_panel columns are ignored in this mode.
The _x,_y and _new_panel columns are ignored in this mode.  


=== Currently Defined _Result Codes (may be extended)  ===
=== Currently Defined _Result Codes (may be extended)  ===


This code is reported in the _result column.
This code is reported in the _result column.  


0: No Error / Nothing to report. The operation was successful<br> 1: Something unexpected happened (coding error)<br> 2: The panel id provided was not for a dynamic panel<br> 3: The panel id provided was not for any kind of panel<br> 4: No source object was provided for copy/delete<br> 5: The command code was not a recognised value, the row was ignored<br> 6: An attempt was made to delete an object which cannot be deleted<br> for reasons outlined above or because it is part of a network<br> structure.<br>  
0: No Error / Nothing to report. The operation was successful<br> 1: Something unexpected happened (coding error)<br> 2: The panel id provided was not for a dynamic panel<br> 3: The panel id provided was not for any kind of panel<br> 4: No source object was provided for copy/delete<br> 5: The command code was not a recognised value, the row was ignored<br> 6: An attempt was made to delete an object which cannot be deleted<br> for reasons outlined above or because it is part of a network<br> structure.<br>  


<br><font size="2"></font>
<br><font size="2"></font>  


[[Category:Dynamic Structure]]
[[Category:Dynamic_Structure]] [[Category:Labellist]] [[Category:Object/Portal]] [[Category:Runtime_Engine]]
[[Category:Labellist]]
[[Category:Object/Portal]]
[[Category:Runtime Engine]]

Revision as of 13:00, 11 July 2011

A model can modify its own structure by adding portals (copying a master) and deleting portals from itself.

This is achieved using a table to provide a series of commands to the edit environment. A dispatcher in "Restart Engine/Continue" mode is used to perform the edits.

Dispatchers in this mode restart the model engine whilst preserving the item that triggered them. ALL OTHER ITEMS in the model are deleted - the run is
stopping and restarting at time = 0.  The item at the dispatcher survives the restart and will continue through its flow after the changes to the model have been effected.

To enable the dynamic object mode, the Dispatcher "Enable Edit Command Table" option must be selected. This option is only available once the dispatcher is in "Restart Engine/Continue" mode. When this is enabled a new context menu option enables the dispatcher to be associated with a table via a reference.

The following columns must exist in the table. The order doesn't matter and other columns can exist (and will be untouched) by the dynamic object system.


_command
_original_id
_new_id
_new_objpanel or _new_panel
_x
_y
_result
_new_name (optional)

Additional columns can exist in the table and if the name of Title of the column matches the name of a portal attribute, the portal attribute will be set with the cells value.


Each row is processed according to its _command. The following codes are  implemented:

_command = 1: COPY Object

_original_id is the object label of the original object to copy

_new_id will be set to the new id of the object. If non zero,
Planimate will attempt to use the index specified but if it is in
use, a new index will be allocated and _new_id will be set to it

_new_objpanel (object label) or _new_panel (panel label) specifies the panel where the object will be placed. If _new_objpanel is used, it must be a portal, then its subsystem will be used. If its 0, the top level panel is used.

_x,_y specify the lower left co-ord that the object will be placed at
_result will be set to a result code by Planimate.

_new_name, if present, enables the object name to be specified. The text in the cell is used as the name. It may be modified if the name is already used.

_command = 2: DELETE Object

_original_id is the object label of the object to delete

_result will be set to the result code of the delete operation

All other columns must be present as for Add, but will be ignored and can be 0 filled.

If a row attempts to delete the panel (or an owner of the panel) that
is currently visible, the delete will fail.

If a row attempts to delete an object which would cause the deletion
of the dispatcher executing the table, the delete will fail.

_command = 3 REPLACE object

In this mode, _original_id specifies the object ID of the original to copy and _new_id must be set to specify the object ID of the object that will
be replaced. The new object will hence get the ID _new_id.

The _x,_y and _new_panel columns are ignored in this mode.

Currently Defined _Result Codes (may be extended)

This code is reported in the _result column.

0: No Error / Nothing to report. The operation was successful
1: Something unexpected happened (coding error)
2: The panel id provided was not for a dynamic panel
3: The panel id provided was not for any kind of panel
4: No source object was provided for copy/delete
5: The command code was not a recognised value, the row was ignored
6: An attempt was made to delete an object which cannot be deleted
for reasons outlined above or because it is part of a network
structure.