Microstation Development Language (MDL) – Place LineString

Back to MDL blog again.. Today we will do a simple program which will explain you a number of things in MDL programming in a simplified manner.

We will place a line string through a MDL program. Remember that this code is only applicable to the older version (Microstation/J – version 7).

In this program, I am showing how to
1. Show a prompt to the user
2. How to initiate a function on a data click
3. How to initiate a function on the right-click (Reset)
3. How to show a rubber band effect
4. How to generate a linestring in the end

The code is simple and self-explanatory but I will still add some description for you to understand.

In the program a prompt will ask use to give a point, when user gives a point in the view, an array of points will be populated and a counter of the number of vertices will be maintained. When user gives a right-click, the linestring placement will complete and a linestring will be generated. The user will be also see the rubber band dynamic display of the linestring as he gives point.


//include files
#include <mdl.h>
#include <tcb.h>
#include <mselems.h>
#include <userfnc.h>

//variable to create the linestring
MSElementUnion oElm;

//maximum 101 vertices – This is an array of coordinates
Dpoint3d lsPoints[MAX_VERTICES];

//number of vertices for the dynamic display of the linestring
int ntmpcount = 0;

//number of vertices to create a final linestring
int nvertexCount = 0;

//function definitions – if not added then it will not compile
void LS_NextPoint(Dpoint3d *point,int numView);
void LS_Complete(Dpoint3d *point,int numView);

//Dynamic display function, it is passed a cursor coordinate as the //cursor moves in the map
//dgnBuf is used for the dynamic display
//If this function is not defined then user will be able to give a point //in the map as usual but will not see how his linestring is appearing //in the map at the runtime.

int LineStringDynamics(Dpoint3d *ptP,int view)
{
ntmpcount = nvertexCount;
lsPoints[ntmpcount].x = ptP->x;
lsPoints[ntmpcount].y = ptP->y;

mdlLineString_create(dgnBuf, NULL, lsPoints, (ntmpcount+1));

return (SUCCESS);
}

//This is function receives a point on a data click, point array is //populated and vertex counter is incremented. The function calls itself // on a dataclick, it also sets a dynamic display function and complete //function on a right-click
void LS_NextPoint(Dpoint3d *point,int numView)
{

lsPoints[nvertexCount].x=point->x;
lsPoints[nvertexCount].y=point->y;

nvertexCount = nvertexCount+1;
mdlOutput_prompt(“Give the next point”);

mdlState_setFunction (STATE_DATAPOINT,LS_NextPoint);
mdlState_dynamicUpdate (LineStringDynamics, FALSE);
mdlState_setFunction (STATE_RESET,LS_Complete);
}

//When user gives a right-click the complete function is called, line //string is created, added to the file displayed normally, dialog box //shows a message to the user about the completion of the command and a //default command call is made. The Exit function call is made in the //end
void LS_Complete(Dpoint3d *point,int numView)
{
if(nvertexCount<2)
{
mdlOutput_prompt(“Give next point”);
mdlState_setFunction (STATE_DATAPOINT,LS_NextPoint);
}
else
{

mdlLineString_create(&oElm, NULL, lsPoints, nvertexCount);
mdlElement_add (&oElm);
mdlElement_display (&oElm, NORMALDRAW);
mdlOutput_prompt(“”);
mdlDialog_openInfoBox(“Placement is complete”);
mdlState_startDefaultCommand ();
mdlSystem_exit(NULL,1);
}
}

//program entry point – the function prompts user to give a first point
//A function call on a data click is set

int main(int argc, char *argv[])
{
mdlOutput_prompt(“Give the first point”);
mdlState_setFunction (STATE_DATAPOINT,LS_NextPoint);
return 0;
}


As you see the code above can be saved as a whole (with comments) in a file placeline.mc and compile as explained in the blog – Hello World MDL

Open a dgn file and execute the command as

mdl l \placeline

See the dynamic display below:

rubberband

The linestring placement is complete.

lscomplete

I will add more blogs on MDL, any comments or questions are welcome! Thank you!

Harihar Fort – Thrilling Trek near Trimbak

IMG_20150831_124409

Welcome, it’s been a while since I wrote a blog, well this time, it’s not technical but it’s all about something very thrilling and spectacular I ever experienced when I was in India in September 2015. Its too late to write this blog since I visited this place last year but it was always back of head to write something about it, I might have missed exact details.

IMG_20150831_144709

When I saw a picture of Harihar killa very first time on Facebook, I just watched it again and again and could not get my eyes off it. Made up my mind, that coming holiday I am going to make it special by visiting this place at any cost and experience the thrill of it. Found out two candidates who could be willing to visit this place, sent them the pictures of this breath taking place and both of them agreed immediately but then when started to look more into it, reality understood that it is not that easy and could be dangerous. Eventually it was Mahesh who is into thrill seeking and has good experience in Trekking. As the day came near, Mahesh started to give me other simpler options as I do not have much trekking experience. But I was adamant and convinced him to take a day off and come with me.

I googled but there was not much help available how to reach Harihar killa, except few blogs. Well we could not follow the directions given in those blogs and thought of going to the nearest point to the place by the easiest mean and find the option then if we could.

IMG_20150831_121947

Harihar Killa is in the town of Trimbak, in the Trimbakeshwar tehsil in the Nashik District of Maharashtra, India, 28 km from the city of Nashik.

IMG_20150831_161401

We caught the Kasara local train early in the morning, not that early, in fact it was late. It reached to Karjat around 7.45am. We reached Nasik around 9am. We had nice idli and tea at one of the roadside restaurants :). Then got into a ST (state transport) bus stand from where lot of buses were departing to Trimbak as there was big crown for Kumbh Mela (India’s biggest religious Hindu event). We started asking in the Bus if anyone knew where Harihar Killa is, surprised that no one knew about it. The bus conductor, driver was called from Vidarbh area for Kumbh Mela arrangement. The city was bustling with so many sadhus and pilgrims. IMG_20150831_161406We started asking everyone who was boarding the bus but all of them were first timers to Nasik. We were about to get off when we saw a highest peak on the way but luckily did not, else our plan would have spoiled. We reached to Trimbak at around 10.30am. Only option there was available which could get near to Harihar was the Rikshaw but no one was ready due to Kumbh Mela, the roads were blocked by heavy security, walking off to the place was not an option as it was too far and it was not possible to finish the plan in one day. There was nothing which would commute to Harihar Killa. We were already thinking it was too late and going back. But then a young Rickshaw driver nodded to take us near to the place but he charged us Rs. 800. We okayed, got into the rickshaw, on the way saw some spectacular scenery and reached to the village at the bottom of the peak. Wow, what a view it was, to watch all those peaks.

There is a very small village at the base, asked those nice friendly people which way to go, lot of small kids around and they chased us for money or anything. Initially we got really irritated but soon found they were innocent lot. It was rainy, green, slippery and watery all over, the peak we thought was so close but it wasn’t that way. The muddy trails were misleading. there was dense wood out there. We soon realised that we need to get someone with us to get to the top.IMG_20150831_115025

One of the kids, probably 10 we asked to join us and get the award later. He along with two other kids also started us leading to the correct way. It was challenging walk upwards. The skinny kids were not wearing any footwear but were so quick and were not missing a single step and here we two both guys were doing our best. It was around 1.30-hour climb, discussing good old memories, making fun of each other, asking kids about their lives, near the peak there is a challenging climb, we took long time deciding how we should go about it but the child guides and Mahesh’s previous experience helped. As we reached to the base of the main peak, the view I used to see only in pictures, it was just awesome. Took many photos. Looking at those steps literally in 85 degrees, you could feel how difficult it was. Especially when it was raining, freezing and fiercely windy. Mahesh told me that this peak will not be possible to achieve as I never did this kind of climb before and we should just return back. But I disagreed, ‘Ab aye hai to zanda gaad ke hi jayenge’ was my reply. He eventually gave up and we started on those heart stopping steps.


IMG_20150831_145955

IMG_20150831_144740

IMG_20150831_121927

The guys in the tent told us to leave our back packs with them as the wind was so strong and there is a chance of getting blown away. We decided not to. Soon we realised it was tough to climb each step as they are so steep and with every step you go up it was like you cannot cancel it and only way was to go up. I was only thinking how would I get down. Funnily the lightweight kids were so fast in climbing those and guiding in Marathi. We were instructing each other to be extremely careful. Wind was very strong and everything was watery so it slowed us too much, we were not minding anything, soon got the sense how you need extra stamina in these scenario, literally the hands started shaking after a while. Good about those steps is that they got grooves at the edges so you can hold them tightly else I wonder how one would have climbed those. I was not looking downwards as only thing you would see is deep valley beneath. we took about 40 minutes to climb the first block of stairs until we reached the first entrance. Luckily there was no one who was sliding down else It would have been an extremely challenging on those narrow steps. When the first entrance arrived we took some rest. It was like a cave carved in the hard rock, an idol was painted in saffron, it was a spectacular view beneath.


IMG_20150831_140425
IMG_20150831_125935

IMG_20150831_130017

Started for the second phase, it was kind of indoor but still layout is such that you can see the valley beneath and it was so steep and very challenging too. We reached to the spot where there was small idol statue and cut in the big stone, you could see the force of wind and space was so narrow but it was comfortable to stand and enjoy the scenery, no wonder the pictures and selfies were taken, you would always have a creeping though at the back of your mind saying you came this high but how would you go back down :). There is a lane rounding the pick, we went through it, some local village young girls were coming down and made fun of us how much we were slow and cautious with every step. One of them told us that there was not a single accident on this spot, it was hard to believe but thought it could be a blessed spot. I wondered why someone needed to make a fort out of this peak and how they were managing it in the past. well finally we went to the very top, you could see the monkeys sitting on the very edge. There was a small Hanuman temple, we prayed for keeping us safe so far.

IMG_20150831_152019

IMG_20150831_134722 IMG_20150831_134351 IMG_20150831_132638
IMG_20150831_135132 One thing I wanted to mention, in these survival situations you do not at all mind muddy ground or muddy water on you skin, spoiling your cloths, you really see how everything gels together. Well then the descending was even more challenging especially when you do not want to look down into the deep valley and still want to step down on to the so narrow stair steps. It was really freaking experience. At one spot the step is missing you really need to stretch your leg to reach to the correct stair, but we managed it.

IMG_20150831_135546

IMG_20150831_154532

Well when we came down, we took cold water bath in the icy water stream, hmm later we found there is no commutation available to get back to Trimbak , we had to wait nearly an hour when one of the villager was ready to take us to Kumbh Mela. Till then we enjoyed the friendly tea and peace and tranquillity of the greenly village atmosphere.IMG_20150831_163140

IMG_20150831_163140

IMG_20150831_155558

It was not even a village, just the 5-6 houses and could see how simple life was for those guys. One wondered how the kids there would survive in the mad world out there. The return journey was on a motor bike. The villager gave us a ride with we three guys on a small bike. Thanked God, without that ride don’t know how we would have gotten back. End of the day we were so tired. But it was an amazing fulfilling day!!! We were very happy!!

If you think you want to experience something THRILLING, then you must visit this fort!!!

IMG_20150831_142947

 

ESB Networks Deploys Intergraph® GIS for Ireland’s Electricity Distribution System

Worked on this fantastic project and its finally Live

The following news comes from the Intergraph’s site – http://www.intergraph.com/assets/pressreleases/2015/06-04-2015a.aspx

Intergraph G/Technology® solution aids in planning, design, construction and operations

HUNTSVILLE, Ala., June 4, 2015 – ESB Networks Ltd., the licensed operator of the electricity distribution system in the Republic of Ireland, has implemented a geographic information system (GIS) built upon Intergraph G/Technology® to support the planning, design, construction and day-to-day operations of Ireland’s electricity distribution network.

The Intergraph GIS serves as a single enterprise solution for the full life-cycle management of ESB Networks’ network assets, improving workflow efficiencies and integrating seamlessly with other business-critical systems. The new system went live this week following a three-year delivery project.

“The delivery of our new GIS system has been a huge team effort from all the parties involved and provides a highly integrated, modern solution which will serve the expanding and challenging requirements of the ESB Networks business over the coming years” said John Gallagher, IT delivery manager, ESB Networks. “We can now face the challenges of the future safe in the knowledge that we have a state of the art and future proofed solution in place.”

An Intergraph customer for 20 years, ESB Networks had previously developed a highly bespoke Intergraph FRAMME-based solution to meet the specific workflows the utility company’s business users required. ESB Networks determined to upgrade to a new G/Technology-based system and contracted Intergraph and its partners, Irish Mapping & GIS Solution Limited (IMGS) and Rolta U.K. Limited in 2012 to deliver the project following a highly competitive procurement process. The selection was based on the Intergraph team’s demonstration of an understanding of the solutions complexity, the ability of the technology to meet the utility company’s requirements and the team’s commitment to deliver.

“The Intergraph team is honored to serve ESB Networks in its efforts to ensure reliable electricity distribution in the Republic of Ireland,” said Alun Pearsey, U.K. country manager, Intergraph Security, Government and Infrastructure (SG&I). “This major enterprise information system implementation is the culmination of a global collaboration and partnership between ESB Networks and its vendor team.”

“IMGS were delighted to support Intergraph in the implementation of a national next-generation GIS for ESB Networks,” said Ciaran Kirk, general manager, IMGS. “This next generation GIS will streamline existing ESB Network workflows and provide unheralded levels of integration between the GIS and ESB’s core business systems to ensure ESB can meet the challenges of providing a smarter 21st century electric grid.”

The solution features Intergraph’s G!NIUS electricity data model with additional customizations to meet the advanced business workflows ESB had configured in FRAMME. Taking advantage of the latest in web services technologies, including Intergraph’s SAP integration module, the project featured a tremendous level of integration, integrating fully with SAP asset, work and customer management systems; Oracle outage management system and Synergee network modeling system. The new Intergraph GIS solution enables ESB Networks to manage the network in three views simultaneously – geographic, geo-schematic and ortho-schematic – through a single system.

Intergraph SG&I helps utilities and communications companies streamline work processes and make smarter decisions. A pioneer in the development and application of location-based technology for more than 45 years, Intergraph SG&I provides solutions to hundreds of utilities and communications customers around the globe, supporting network engineering and operations, customer services and more.

# # #

About Intergraph
Intergraph helps the world work smarter. The company’s software and solutions improve the lives of millions of people through better facilities, safer communities and more reliable operations.

Intergraph Process, Power & Marine (PP&M) is the world’s leading provider of enterprise engineering software enabling smarter design and operation of plants, ships and offshore facilities. Intergraph Security, Government & Infrastructure (SG&I) is the leader in smart solutions for emergency response, utilities, transportation and other global challenges. For more information, visit www.intergraph.com.

Intergraph is part of Hexagon (Nasdaq Stockholm: HEXA B; hexagon.com), a leading global provider of information technologies that drive quality and productivity improvements across geospatial and industrial enterprise applications.

Jim Dobbs
Executive Manager, SG&I
+1.256.730.8558
jim.dobbs@intergraph.com

© 2015 Intergraph Corporation. All rights reserved. Intergraph is part of Hexagon. Intergraph and the Intergraph logo are registered trademarks of Intergraph Corporation or its subsidiaries in the United States and in other countries. CADWorx, CAESAR II, PV Elite and GT STRUDL are registered trademarks, and TANK is a trademark of Intergraph Corporation. Other brands and product names are trademarks of their respective owners.