Code sample Home

Create TIN object (Triangulated Irregular Network)
void DemoTinCreate (HANDLE hLcWnd)
{
  HANDLE hBlock, hTIN;
  int    Color;
  WCHAR* szPtypeName = L"Default";  // name of point type

  // get a block, linked with CAD window
  hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_VIEWBLOCK );

  // define TIN points
  lcTIN_AddPoint( 0, szPtypeName, 0, 0, 101.7 );
  lcTIN_AddPoint( 0, szPtypeName, 0, 25, 103.3 );
  lcTIN_AddPoint( 0, szPtypeName, 0, 50, 103.0 );
  lcTIN_AddPoint( 0, szPtypeName, 25, 0, 102.5 );
  lcTIN_AddPoint( 0, szPtypeName, 25, 25, 103.8 );
  lcTIN_AddPoint( 0, szPtypeName, 25, 50, 102.2 );
  lcTIN_AddPoint( 0, szPtypeName, 50, 0, 103.8 );
  lcTIN_AddPoint( 0, szPtypeName, 50, 25, 104.1 );
  lcTIN_AddPoint( 0, szPtypeName, 50, 50, 105.0 );
  // create TIN object from the points
  hTIN = lcBlockAddTIN( hBlock, L"" );
  if (hTIN != 0){
    lcPropPutStr( hTIN, LC_PROP_TIN_NAME, L"Demo TIN" );
    lcBlockUnselect( hBlock );
    lcBlockSelectEnt( hBlock, hTIN, true );
    // generate boundary
    if (lcTIN_Bnd( hTIN, 0.0, hLcWnd )){
      // triangilate points inside boundary
      if (lcTIN_Triangulate( hTIN, hLcWnd )){
        // generate isolines
        lcTIN_Isolines( hTIN, 0.2, 5, hLcWnd );
        // generate color filling
        lcTIN_ColorFill( hTIN, 0.2, 0.05, hLcWnd );
        // set visibility of TIN elements
        lcPropPutBool( hTIN, LC_PROP_TIN_VIEWPT, true );    // point
        lcPropPutBool( hTIN, LC_PROP_TIN_VIEWPTN, false );  // point name
        lcPropPutBool( hTIN, LC_PROP_TIN_VIEWPTI, false );  // point index
        lcPropPutBool( hTIN, LC_PROP_TIN_VIEWPTZ, true );   // point Z
        lcPropPutBool( hTIN, LC_PROP_TIN_VIEWBND, false );  // boundary
        lcPropPutBool( hTIN, LC_PROP_TIN_VIEWCF, true );    // color filling
        lcPropPutBool( hTIN, LC_PROP_TIN_VIEWISO, true );   // isolines
        lcPropPutBool( hTIN, LC_PROP_TIN_VIEWISOH, true );  // heights of isolines
        // set parameters for point type
        hPtype = lcTIN_PtypeGetByName( hTIN, szPtypeName );
        if (hPtype != 0){
          lcPropPutStr( hPtype, LC_PROP_TINPTYPE_DTEXT, L"STD" );
          Color = lcColorRGB( 255, 0, 0 );
          lcPropPutInt( hPtype, LC_PROP_TINPTYPE_COLOR, Color );
        }
      }
    }
    lcBlockUnselect( hBlock );
    lcBlockUpdate( hBlock, false, 0 );   // update extents 
    lcWndZoomRect( hLcWnd, 0,0,0,0 );
    lcWndZoomScale( hLcWnd, 0.8 );
    // hide block's basepoint marker
    lcPropPutBool( hLcWnd, LC_PROP_WND_BLKBASEPT, false );
  }
}

This will create a drawing as shown on the picture below:



Without color filling: