void DemoFilling (HANDLE hLcWnd)
{
HANDLE hDrw, hBlock, hEnt, hEnt2, hFill, hFill2;
WCHAR* szNameFill = L"Hatch 1";
WCHAR* szNameFill2 = L"Hatch 2";
// get a drawing and a block, linked with CAD window
hDrw = lcPropGetHandle( hLcWnd, LC_PROP_WND_DRW );
hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_BLOCK );
// check if the filling style with specific name already exist
hFill = lcDrwGetObjectByName( hDrw, LC_OBJ_LINFILL, szNameFill );
if (hFill == 0){
// don't exist, add it
hFill = lcDrwAddFilling( hDrw, szNameFill );
lcFillSetLine( hFill, 0, 1.0, 0.0, 0.5 );
}
// check if the filling style with specific name already exist
hFill2 = lcDrwGetObjectByName( hDrw, LC_OBJ_LINFILL, szNameFill2 );
if (hFill2 == 0){
// don't exist, add it
hFill2 = lcDrwAddFilling( hDrw, szNameFill2 );
lcFillSetLine( hFill2, 0, 1.8, 45.0*LC_DEG_TO_RAD, 0.5 );
lcFillSetLine( hFill2, 1, 1.8, -45.0*LC_DEG_TO_RAD, 0.5 );
}
// create closed and filled polyline
// the filling is solid by default
hEnt = lcBlockAddPolyline( hBlock, LC_PLFIT_NONE, true, true );
lcPlineAddVer( hEnt, 0, 10,30 );
lcPlineAddVer( hEnt, 0, 8,55 );
lcPlineAddVer( hEnt, 0, 30,70 );
lcPlineAddVer( hEnt, 0, 45,38 );
lcPlineEnd( hEnt );
// set filling color (red)
lcPropPutInt( hEnt, LC_PROP_ENT_FCOLORT, RGB(255,0,0) );
// copy the polyline
hEnt2 = lcBlockAddClone( hBlock, hEnt );
// move the copied polyline
lcEntMove( hEnt2, 40, -10 );
// set filling color (green)
lcPropPutInt( hEnt2, LC_PROP_ENT_COLORT, RGB(0,255,0) );
// set filling style
lcPropPutBool( hEnt2, LC_PROP_ENT_SOLIDFILL, false );
lcPropPutHandle( hEnt2, LC_PROP_ENT_LINFILL, hFill );
// copy the polyline
hEnt2 = lcBlockAddClone( hBlock, hEnt );
// move the copied polyline
lcEntMove( hEnt2, 80, 10 );
// set filling color (cyan)
lcPropPutInt( hEnt2, LC_PROP_ENT_COLORT, RGB(0,255,255) );
// set filling style
lcPropPutBool( hEnt2, LC_PROP_ENT_SOLIDFILL, false );
lcPropPutHandle( hEnt2, LC_PROP_ENT_LINFILL, hFill2 );
// update view
lcBlockUpdate( hBlock, LC_TRUE, 0 );
// zoom extents
lcWndZoomRect( hLcWnd, 0, 0, 0, 0 );
}