Code sample Home

Create polylines

void DemoPolylines (HANDLE hLcWnd)
{
  HANDLE hBlock;
  HANDLE hPline, hPline2, hPline3, hPline4, hPline5;

  // get the block linked to graphics window
  hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_VIEWBLOCK );
  // add a polyline object
  hPline = lcBlockAddPolyline( hBlock, 0, false, false );
  lcPlineAddVer( hPline, 0, 10, 0 );
  lcPlineAddVer( hPline, 0, 20, 10 );
  lcPlineAddVer( hPline, 0, 30, 0 );
  lcPlineAddVer( hPline, 0, 40, 10 );
  lcPlineAddVer( hPline, 0, 50, 0 );
  lcPlineAddVer( hPline, 0, 60, 10 );
  lcPlineAddVer( hPline, 0, 70, 0 );
  lcPlineEnd( hPline );
  // copy and move the polyline
  lcBlockSelectEnt( hBlock, hPline, true );
  lcBlockSelMove( hBlock, 0, 20, true, false );
  hPline2 = lcBlockGetLastEnt( hBlock );
  lcBlockSelMove( hBlock, 0, 40, true, false );
  hPline3 = lcBlockGetLastEnt( hBlock );
  lcBlockSelMove( hBlock, 0, 60, true, false );
  hPline4 = lcBlockGetLastEnt( hBlock );
  lcBlockSelMove( hBlock, 0, 80, true, false );
  hPline5 = lcBlockGetLastEnt( hBlock );
  lcBlockUnselect( hBlock );
  // modify fit type of the copied polylines
  lcPropPutInt( hPline2, LC_PROP_PLINE_FIT, LC_PLFIT_QUAD );
  lcPropPutInt( hPline3, LC_PROP_PLINE_FIT, LC_PLFIT_CUBIC );
  lcPropPutInt( hPline4, LC_PROP_PLINE_FIT, LC_PLFIT_SPLINE );
  lcPropPutInt( hPline5, LC_PROP_PLINE_FIT, LC_PLFIT_ROUND );
  lcPropPutFloat( hPline5, LC_PROP_PLINE_RADIUS, 2.5 );

  lcBlockUpdate( hBlock, true, 0 );
  lcWndExeCommand( hLcWnd, LC_CMD_ZOOM_EXT, 0 );
}
This will create a drawing as shown on the picture below:



See Also:

Create a closed polylines with filling
Create regular polygons
Create simple entities