Useful Smallworld PNI Magik commands

Let’s have a handle on an object :
MagikSF> bb << dbv[:mit_bay].an_element()
$
mit_bay4444:(70511)

1.    setvars() – has an argument print? – will set some usefull/frequently used SW Magik environment variables:
2.    m() – returns a method for an object; Can be used together with ‘source_file
3.    object.ap(str/symbol OPT including_private? including_system?) – shows all methods defined on the object where the name includes the substring STR/SYMBOL
4.    view(name_as_symbol) – returns the dataset cached with the key NAME_AS_SYMBOL
5.    pms() – print memory statistics
6.    colap(string/symbol OPT view) – writes names of all collections (in the specified view) where name includes ‘string/symbol’
7.    w()/p()/dp() – write()/print()/debug_print()
8.    a_view.apn() – return the string for the name of the current alternative
9.    a_record_or_collection.df() – Displays all the fields of either a record or a database collections, this is useful for debugging purposes. Please NOTE the difference if you are using ‘a_record_or_collection.describe_fields()’ – it gives you all fields with values.
10.    fdap(str/symbol OPT a_view) – writes out all ‘collection name: field name’, where a field name includes STR/SYMBOL
11.    a_record_or_collection.fdap(str/symb) – Writes/Returns fields with name matching str/symb
12.    dbs() – writes out current Database information
13.    object.pa/object.ph – print_ancestry / print_hierarchy of an object
14.    object.p/object.dp – print /debug_print of an object
15.    wrel(a_col OPT a_method) – writes out elements of the collection A_COL by performing A_METHOD
16.    prel(a_col) – prints out elements of A_COL

1.    setvars() – has an argument print? – will set some usefull/frequently used SW Magik environment variables:
MagikSF> setvars(_false)
$
MagikSF> setvars()
$
gpm << gis_program_manager
v << mit_manager.modelit_dataset (mit_gis_ds_view(Gis))
de_view << mit_manager.modelit_dataset.dyn_enum_view (dyn_enums_ds_view(Dynamic_enumerator))
tv << mit_manager.modelit_dataset.template_view (template_ds_view(Template))
dbv << v.collections
mm << mit_manager (a sw:mit_manager)
paf << smallworld_product.pni_application() (pni_application(pni))
pam << paf.manager (a pni_application_manager(application_manager))
pg << pam.pseudo_grs (a emst!pseudo_grs(pseudo_grs))
plugs << paf.plugins() (sw:rope:[1-87])

2.    m() – returns a method for an object
MagikSF> m(bb, :trace_description)
$
method trace_description in mit_description_mixin
Can be used together with ‘source_file’ :
MagikSF> m(bb, :trace_description).source_file
$
“../SW410/pni410/modules/mixins/source\mit_description_mixin.magik”

3.    object.ap(str/symbol OPT including_private? including_system?) – shows all methods defined on the object where the name includes the substring STR/SYMBOL
MagikSF> bb.ap(:trace)
$
method trace_desc() in mit_description_mixin
class constant trace_start_node_selectable? in mit_bay
method trace_description in mit_description_mixin
class constant trace_start_node_trail_required? in mit_bay
method trace_on(stream, optional expand_n) in object

4.    view(name_as_symbol) – returns the dataset cached with the key NAME_AS_SYMBOL
MagikSF> view(:design_admin)
$
gis_ds_view(Design_admin)

5.    pms() – print memory statistics
MagikSF> pms()
$
Extension file:     C:\TEMP\msfext.igor-pc4288
    maximum size:            32768
    current size:            2272
    pages in use:            1388
    yellow zone size:        8192
     – triggers at:          24576

6.    colap(string/symbol OPT view) – writes names of all collections (in the specified view) where name includes ‘string/symbol’
MagikSF> colap(:bay).p
$
:int!new_mit_bay_new_mit_shelf
:int!new_mit_bay_new_mit_bay_t
:mit_bay
:mit_bay_text
:int!new_mit_termi_new_mit_bay
:int!new_mit_rme_t_new_mit_bay
:int!strw_con_mit_bay
:int!new_mit_hub_new_mit_bay
rope(1,8):
1     a ds_collection(int!new_mit_bay_new_mit_shelf)
2     a ds_collection(int!new_mit_bay_new_mit_bay_t)
3     a ds_collection(mit_bay)
4     a ds_collection(mit_bay_text)
5     a ds_collection(int!new_mit_termi_new_mit_bay)
6     a ds_collection(int!new_mit_rme_t_new_mit_bay)
7     a ds_collection(int!strw_con_mit_bay)
8     a ds_collection(int!new_mit_hub_new_mit_bay)
sw:rope:[1-8]

7.    w()/p()/dp() – write()/print()/debug_print()
MagikSF> w(bb)
$
mit_bay4444:(70511)
MagikSF> p(bb)
$
mit_bay4444:
:description     “CAR TN4X (2)”
:number     “2”
:construction_status     “In Service”
:account_code     “CamTel”

…..

:mns_medium_description     “Bay : CAR TN4X (2), Number – 2”
:mns_long_description     “Hub (Primary, Carlisle), CAR TN4X (2) 2”
MagikSF> dp(bb)
$
mit_bay4444:
:id     70511
:number     “2”
:description     “CAR TN4X (2)”
:construction_status     “In Service”
:world_id     1782
:back_world_id     1783

….

:spec_id     “Nortel Bay – 25mm MS”
:acceptance_date     ds_date(10/06/2001)
:rwo_id     gis_id(683593,911431124,70514)
:ds!version     50331868

8.    a_view.apn() – return the string for the name of the current alternative
MagikSF> v.apn()
$
:Engineering Design sw:rope:[1-1]

9.    a_record_or_collection.df() – Displays all the fields of either a record or a database collections, this is useful for debugging purposes.
MagikSF> bb.df()
$
dd_table(mit_bay)
*   id                            ds_uint                                              
 V  number                        ds_char16canon 10                                    
 V  description                   ds_char16canon 35                                    
 V  construction_status           dd_dynamic_enumerator(construction_status_type_type)
    world_id                      ds_uint                                              
    back_world_id                 ds_uint                                              
    centre_point                  ds_double_as_int                                     
    mounting_text_size            ds_uint                                              
    rme_spec_id                   ds_uint                                              
    spec_id                       dd_dynamic_enumerator(rme_bay_spec_type)             
 V  acceptance_date               ds_date                                              
 V  acceptance_name               ds_char16canon 30                                    
 V  account_code                  ds_char16canon 7                                     
……
Please NOTE the difference if you are using ‘a_record_or_collection.describe_fields()’ – it gives you all fields with values:
MagikSF> bb.describe_fields()
$
mit_bay4444:(70511)
*   id                             70511
 V  number                         2
 V  description                    CAR TN4X (2)
 V  construction_status            In Service
    world_id                       1782
    back_world_id                  1783
    centre_point                   ds_coord:(1.868e+003,8.406e+003)
    mounting_text_size             20
    rme_spec_id                    unset
    spec_id                        Nortel Bay – 25mm MS
 V  acceptance_date                10/06/2001
 V  acceptance_name                Gareth Hatfield
 V  account_code                   CamTel
 V  barcode_number                 437881828090
 V  date_installed                 09/05/2001
……

10.    fdap(str/symbol OPT a_view) – writes out all ‘collection name: field name’, where a field name includes STR/SYMBOL
MagikSF> fdap(:long_name)
$
bundle_color: color_long_name
fiber_color: color_long_name
mit_rme_port: mns_long_name
mit_slot: mns_long_name
mit_df: mns_long_name
mit_bay: mns_long_name
mit_shelf: mns_long_name
mit_multi_port: mns_long_name
mit_card: mns_long_name

11.    a_record_or_collection.fdap(str/symb) – Writes/Returns fields with name matching str/symb
MagikSF> bb.fdap(:name).p
$
acceptance_name
mns_long_name
mns_short_name
mns_medium_name
installer_name
rope(1,5):
1     dd_phys_field(mit_bay.acceptance_name)
2     dd_derived_field(mit_bay.mns_long_name)
3     dd_derived_field(mit_bay.mns_short_name)
4     dd_derived_field(mit_bay.mns_medium_name)
5     dd_phys_field(mit_bay.installer_name)
sw:rope:[1-5]

12.    dbs() – writes out current Database information
MagikSF> dbs()
$
——————–
Database information
DB                        Alternative path                         Writer #Readers
——————–      —————————————- —— ——–
Style                     |                                        No writer  1   
Job_queue                 |                                        No writer  1   
message                   |                                        No writer  1   
Dxf                       |                                        No writer  1   
Auth                      |                                        No writer  1   
Template                  |                                        No writer  1   
Swdp_schematics           |igor|                                   yourself   0   
Dynamic_enumerator        |                                        No writer  1   
Ace                       |igor|                                   yourself   0   
Design_admin              |                                        No writer  1   
Design_admin (Replica)    |                                        No writer  1   
ACE (Replica)             |                                        No writer  1   
Swdp_schematics (Replica) |gs!public|                              No writer  1   
Gis                       |Engineering Design|                     No writer  1   
——————–      —————————————- —— ——–

13.    object.pa/object.ph – print_ancestry / print_hierarchy of an object
MagikSF> bb.pa
$
mit_bay4444
    sw:mit_bay
        sw:mit_rwo_with_internals
            sw:mit_hierarchical_rwo
                sw:mit_rwo_record
                    sw:rwo_record
                        sw:ds_record
                            sw:ds_record_and_field_mixin
                                sw:ds_basic_mixin
                                sw:slotted_format_mixin
                                    sw:object
                           ……
MagikSF> bb.ph
$
mit_bay4444
mit_bay4444:(70511)

14.    object.p/object.dp – print /debug_print of an object (see above)

15.    wrel(a_col OPT a_method) – writes out elements of the collection A_COL by performing A_METHOD
MagikSF> wrel(dbv[:mit_bay], :trace_description)
$
mit_bay4444:(70511) || Bay (CAR TN4X (2)) in Hub (Primary, ‘Carlisle’)
mit_bay4444:(85889) || Bay (CAR TN4X (1)) in Hub (Primary, ‘Carlisle’)
mit_bay4444:(97288) || Bay (CAM HE) in Hub (Primary, ‘Cambridge (Hub)’)
…..

16.    prel(a_col) – prints out elements of A_COL

Ninotech Path Copy 4

This is just a quick post on the very useful tool that I’ve been using for many years.
Today I had to do some stuff on a new environment and I realised that I am so used to this tool. So I though that you might find it useful too.

http://www.novell.com/coolsolutions/tools/13986.html

This is a shell extension to copy the path of a file or directory to the Clipboard. Just an extra option added to the right click menu. With some extended configuration options. To install – just unzip the file and right-click on PATHC400.INF file and choose “Install” in the context menu.