Business as a front-end beginner sees it

The year 2020 has passed, in the past year, a lot of harvest. I went from being a newbie to a newbie with work experience. After one year’s training, I have improved my business coding ability as well as my hand speed. Speaking of business, as a programmer, this is an old topic. So what have I been doing in the past year?

What is BIM?

Before we talk about business, let’s talk about the development industry I work in –BIM. Since the company is engaged in BIM consulting, BIM is the word I have heard and come into contact with most since I joined the company. Then I have listened to BIM for one year. What is BIM?

Building Information Modelling (BIM) is an Information technology applied to the whole life cycle process of Building engineering design, construction, operation, maintenance and so on. Building engineering model is established through informatization, digitization and parameterization. In this way, the project life cycle process can be managed, project resources can be optimized, project expenditure can be reduced, and project construction efficiency can be improved.

The main features of BIM include:

  1. Model visualization: the plan, elevation, 3D model and basic elements and modules of the model in BIM software can be presented to designers and construction personnel in a visual way, which is convenient for viewing, modifying and optimizing the model.
  2. Parameterized: engineering model consists of a large number of elements, components, modules and so on, and the effect of parameters is to give its properties and performance, such as giving an Duan Liang engineering model of attribute information, such as height, strength participation main body to inspect it, modify or update, so the BIM features for parameterized design provides a great convenience.
  3. Interactivity: BIM can access or output necessary model elements (such as data and information) through relevant software interfaces to realize information sharing and software interworking.
  4. Whole life cyclical: BIM can be applied to the entire life cycle of construction projects, including the initial engineering design and construction of middle and late operation and maintenance, can be in the form of data information including project cycle, budget, schedule, scope, usage, spending various project indicators, improve the transparency of the project.

That’s the definition of BIM and its main features. Now let’s talk about BIM based business.

What is a business?

For a company or department, do have a lot of, fragmented and put these little things together, slowly, slowly to make a great product, in the process, the final result of fragmentary things or can be regarded as a business, because the value of the core elements of the business is the business itself, every part is the value of a business. For example 🌰, modeling is a big part of BIM development. For me, it is extremely important to develop a model preview operation component with relatively complete functions for the users of BIM products. The more powerful the model function is, the more practical and convenient it is, the users will be willing to use it, which will make users stickiness to a certain extent. In this process, the model is a line of business, the business logic is practical model components – users are willing to use – product sales platform, based on this business line, we are worthy of attention, because that is the point, the stronger, the better, the user is willing to use to pay for the product, resulting in revenue.

How to do business well?

Is doing a model component completing a business development? Of course not. In order to do a good job of this business component, you need to keep in mind that there are a number of areas where validation can be optimized:

  1. Model components need to be used on multiple endpoints. How to better support multiple endpoints?
  2. With so many platform products, modifying components can’t just be copy-pasted. How to manage them more efficiently?
  3. How to better support multiple model engines?
  4. Is this development worth the effort?

In the past, the model engine used in the platform mostly relied on a lot of copy and paste to reuse. When DKV was introduced in the later stage, the code maintenance would be more complicated. Therefore, I sorted out the code of platform model components:

  • By engine:

  • Comb the call relationship:

In order to consider the use of multiple terminals, as well as the compatibility of each platform terminal, finally use the most simple and efficient < IFrame > form to call model components, so as to ensure the maximum reuse of components, but also to ensure that no matter what environment, development engineering environment can be done out of the box. In addition, in order to reduce unnecessary parameters appearing in the URL of iframe, the front end uses postMessage to interact between pages, which not only ensures compatibility but also conceals the interaction.

// Call component, send data
  _this.DKViewerSrc = [{
    path: url
  }];
  _this.DKViewerMode = '3D';
  _this.DKViewerSceneColor = _this.DKVIEWER_SCENE_COLOR['3D'];
  document.getElementById('dkv-viewer-iframe')
  .setAttribute('src'.'/Content/plug-in/model-engine/DKV/web.html');
  const iframe = document.getElementById('dkv-viewer-iframe');
  iframe.onload = function () {
    const data = JSON.stringify({
      src: _this.DKViewerSrc,
      name: [{ name: _this.fileNameForDialog.split('. ') [0]}],mode: _this.DKViewerMode,
      color: _this.DKViewerSceneColor
    });
    iframe.contentWindow.postMessage(
      data,
      `The ${window.location.origin}/Content/plug-in/model-engine/DKV/web.html`
    );
  }
  
  
  // The component receives data, initializes models, drawings, and notifies the caller
  window.addEventListener("message".function (event) {
    const origin = event.origin || event.originalEvent.origin;
    if(origin ! = =window.location.origin) {
      return;
    }
    try {
      const {
        src,
        mode,
        color,
        name
      } = JSON.parse(event.data);
      
      if (viewer) {
        uninstall();
      }
      
      DKViewerSrc = src;
      DKViewerMode = mode;
      DKViewerSceneColor = color;
      DKViewerModelName = name;
      
      document.title = titleFactory();
      
      initDKV();
      
    }
    catch (e) {
      // console.error(e)}},false);
  
  function initDKV() {
    window.__DKViewerInstance = viewer = new DKViewer({
      elem: "model-viewer".path: DKViewerSrc,
      name: DKViewerModelName,
      viewerMode: DKViewerMode,
      toolBar: toolBarFactory(),
    });
    
    window.__DKViewerInstance.uninstall = uninstall;
    
    // Initialize the scene
    viewer.initialize(() = > {
      // Load the model
      viewer.loadModels(() = > {
        // Set to automatically convert light color drawings to dark color drawings
        viewer.setSwapBlackAndWhite(true)
        // Set the mouse wheel to forward direction
        viewer.setReverseZoomDirection();
        // Turn off model shadows
        viewer.setGroundShadow();
        // Set the background color and transparency of the scene
        viewer.setBackgroundColor(DKViewerSceneColor);
        // Return to the default perspective position
        viewer.setCurrentView();
        // Self-use size
        viewer.fitToView();
        // Add a toolbar
        viewer.addTool();
        // Notify the caller
        parent.postMessage({loadSuccess: true}, "*")}); }); }Copy the code

In this way, the model business foundation and development management are improved, greatly improving component reuse and development efficiency.

Further thinking, as a front-end developer, you can think of more:

  1. Engineering r & D suite
  2. Extensions to model components
  3. Combined with the backend students, build the model of the middle stage

So, have we really thought about what the business is? Have you thought about your business? Will the business be different with you? Writing business code is never just coding, it must be coding mindfully in order to truly write business code.

The above is just my understanding of business during development. There may be some deviation in my understanding of business development, but I always want to do it faster and better and convert it into more money.

PS: Just write, whatever comes to mind.