Thursday, December 17, 2015

Map3D Industry Model : Select job topic states

select * from tb_job_topic jt,
TB_JOB_TOPIC_STATE jts,
S497_NETWORK_UPDATE nu,
S497_NETWORK_UPDATE_JOB nuj,
TB_JOB j
where jt.ID = jts.JOB_TOPIC_ID
and nu.NWUP_ID = nuj.NWUP_ID
and j.id = nuj.JOB_ID
and nuj.JOB_ID = 837
and jt.JOB_ID = 837
and jts.SELECTED = :state;

select * from tb_job_topic jt,
TB_JOB_TOPIC_STATE jts,
S497_NETWORK_UPDATE nu,
S497_NETWORK_UPDATE_JOB nuj,
TB_JOB j
where jt.ID = jts.JOB_TOPIC_ID
and nu.NWUP_ID = nuj.NWUP_ID
and j.id = nuj.JOB_ID
and nuj.JOB_ID = :jid
and jt.JOB_ID = :jid
and jts.SELECTED = :state;

Monday, November 16, 2015

Map3D Industry Model : Modify Job States & Job State Transitions

By default Map 3D industry models have 4 job states and their corresponding job state transitions.
It is possible to add some extra states and modify or add corresponding state transitions if the defaults are insufficient for your implementation.

Default job states

select * from tb_job_state;


Default job state transitions

select * from tb_job_state_transition;



Transition Direction

  • (F,Forward)
  • (B,Backward)
Transition Type
  • (M,Merge the features)
  • (D,Delete the job)
  • (N, Do nothing)
SQL Example

--insert new job states into table tb_job_state
delete from tb_job_state where id in(5,6,7,8,9);
delete from TB_JOB_STATE_TRANSITION where id in(6,7,8,9,10);
delete from TB_JOB_STATE_TRANSITION where id in(12,13,14,15,16,22);
delete from TB_JOB_STATE_TRANSITION where id in(17,18,19,20,21);
insert into tb_job_state (ID, DESCRIPTION, FEATURES_EDITABLE,INITIAL_STATE,NAME,USE_JOBID) VALUES(5,null,1,1,'Planning',1);
insert into tb_job_state (ID, DESCRIPTION, FEATURES_EDITABLE,INITIAL_STATE,NAME,USE_JOBID) VALUES(6,null,1,0,'Design',0);
insert into tb_job_state (ID, DESCRIPTION, FEATURES_EDITABLE,INITIAL_STATE,NAME,USE_JOBID) VALUES(7,null,1,0,'Phase Planning',0);
insert into tb_job_state (ID, DESCRIPTION, FEATURES_EDITABLE,INITIAL_STATE,NAME,USE_JOBID) VALUES(8,null,1,0,'Construction',0);
insert into tb_job_state (ID, DESCRIPTION, FEATURES_EDITABLE,INITIAL_STATE,NAME,USE_JOBID) VALUES(9,null,1,0,'Asset Management',0);
--insert new job state transitions forward into table tb_job_state_transition
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(6,null,5,6,'F','M');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(7,null,6,7,'F','M');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(8,null,7,8,'F','M');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(9,null,8,9,'F','M');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(10,null,9,1,'F','M');
--insert new job state transitions delete into table tb_job_state_transition
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(12,null,5,4,'F','D');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(13,null,6,4,'F','D');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(14,null,7,4,'F','D');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(15,null,8,4,'F','D');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(16,null,9,4,'F','D');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(22,null,1,4,'F','D');
--insert new job state transitions backwards into table tb_job_state_transition
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(17,null,6,5,'B','N');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(18,null,7,6,'B','N');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(19,null,8,7,'B','N');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(20,null,9,8,'B','N');
insert into TB_JOB_STATE_TRANSITION (ID,PASSWORD, PREDECESSOR_ID, SUCCESSOR_ID, TRANSITION_DIRECTION, TRANSITION_TYPE) VALUES(21,null,1,9,'B','N');
commit;

Result Job States

Result Job State Transitions


Map3D Industry Model : SQL Query Logical Topology Connection & Jobs

SQL Query

select topo.fid, topo.FID_FROM, topo.F_CLASS_ID_FROM,
dic2.F_CLASS_NAME CLASSNAME_FROM, topo.FID_TO, topo.F_CLASS_ID_TO, dic.F_CLASS_NAME CLASSNAME_TO,  topo.FLOW,
j.id, j.NAME, j.COMMENTARY,
jv.STATE
from 
RNT_NODE_EDGE_TOPO_CONN topo, TB_DICTIONARY dic, TB_DICTIONARY dic2, TB_JOB j, TB_JOB_VERSION jv
where dic.F_CLASS_ID = topo.F_CLASS_ID_TO
and dic2.F_CLASS_ID = topo.F_CLASS_ID_FROM
and j.id = jv.JOB_ID
and jv.JOB_VERSION = topo.JOB_VERSION;



flow 

  • (1,forward) 
  • (2,backward) 
  • (3, forward and backward)

state

select * from tb_job_state;


Tuesday, June 16, 2015

Reset Logical Topology Map3D Industry Model

 /// <summary>
        /// Reset the topology of the industry model currently connected to.
        /// </summary>
        public static void ResetTopology()
        {
            var application = Application.Active;
            var connection = application.Documents.Active.Connection;

            using (var ma = new Topobase.LogicalTopology.Maintainance(connection))
            {
                connection.Open();
                //Make sure there are topologies to clear
                if (connection.Topologies != null)
                {
                    for (int i = 0; i < connection.Topologies.Count; i++)
                    {
                        //Check the type of the topologies before clearing them.
                        //Make sure they are logical topologies and not area
   var topology =     
   connection.Topologies.Get(connection.Topologies[i].Name);
                        var logicalToplogy = topology as LogicalTopology;
                        //Clear topology attached to the industry model
                        ma.ClearTopology(logicalToplogy, null);
                        //Initialize topolgy of the current industy model
                        ma.InitializeTopology(logicalToplogy, null);
                    }
                }
            }
        }

Monday, March 30, 2015

FME DWG Text 2 RASTER

First you need to TXTEXP all your text within autocad. After you ran the command you will end up with lines on layer 0.

Then you can run this workbench to transform your data from autocad vector data to any raster image.

Enjoy!

Download Workbench