Product : Engine, Version : 5.0.0.1033, ArticleID : 41023584

HowTo : UCS icon modification

Article41023584
TypeHowTo
ProductEngine
Version5.0.0.1033
Date Added5/27/2004
Submitted byDamon CNC Developer
Keywords

Subject

UCS icon modification

Summary

I would like to have the ability to either set different colours for the WCS icon drawn in the lower left drawing or use a different image in its place.

Solution

new event was added in 5.0.0.1033 "DrawOverAll"

In the following examble we overwite the the way that UCS Icon is render.

void CVdView::OnDrawOverAllvdrawCTRL2(LPDISPATCH Render, short FAR* Cancel)
{
 // TODO: Add your control notification handler code here
 CvdRender rend;
 rend.AttachDispatch(Render,FALSE);
 long curpos = 0;
 COlePoint cen,xd,yd,zd;
 long swaxis = m_Vdraw.GetShowWCSAxis();
 double psize = rend.GetPixelSize();
 COlePoint vcen = m_Vdraw.GetActiveDocument().GetActiveLayOut().GetViewCenter();
 double ScreenWidth = m_Vdraw.GetActiveDocument().GetViewWidth();
 double ScreenHeight = m_Vdraw.GetActiveDocument().GetViewSize();
 
 cen[0]=0.0;
 cen[1]=0.0;
 cen[2]=0.0;
 m_Vdraw.GetActiveDocument().GetActiveLayOut().TransPoint(&cen,1,0);//ucs origin
 
 if((swaxis & 4) == 4){
  cen[0]=0.0;
  cen[1]=0.0;
  cen[2]=0.0;
 }
 BOOL isvisible = rend.IsPointVisible(cen);
 if((swaxis & 2) != 2) isvisible = FALSE;
 if(!isvisible){
  //move it to lowerleft
  cen = m_Vdraw.GetActiveDocument().GetActiveLayOut().GetViewCenter();
     cen[0] -=( rend.GetWidth()*psize*0.5 - psize*80.0);
     cen[1] -=( rend.GetHeight()*psize*0.5 - psize*80.0);
  m_Vdraw.GetActiveDocument().GetActiveLayOut().TransPoint(&cen,2,0);
 }
 if((swaxis & 4) != 4)
  m_Vdraw.GetActiveDocument().GetActiveLayOut().TransPoint(&cen,0,1);
 xd = m_Vdraw.GetUtility().geomPolar(cen,0.0,psize*60);
 yd = m_Vdraw.GetUtility().geomPolar(cen,PI/2.0,psize*60);
 zd = cen;
 zd[2] += psize*60;
 if((swaxis & 4) != 4){
  m_Vdraw.GetActiveDocument().GetActiveLayOut().TransPoint(&cen,1,0);
  m_Vdraw.GetActiveDocument().GetActiveLayOut().TransPoint(&xd,1,0);
  m_Vdraw.GetActiveDocument().GetActiveLayOut().TransPoint(&yd,1,0);
  m_Vdraw.GetActiveDocument().GetActiveLayOut().TransPoint(&zd,1,0);

  
 }
 
 CvdLine obj1,obj2,obj3;
 obj1 = m_Vdraw.CreateInstance(3);
 obj2 = m_Vdraw.CreateInstance(3);
 obj3 = m_Vdraw.CreateInstance(3);

 obj1.SetLayerName(m_Vdraw.GetActiveDocument().GetActiveLayer());
 obj2.SetLayerName(m_Vdraw.GetActiveDocument().GetActiveLayer());
 obj3.SetLayerName(m_Vdraw.GetActiveDocument().GetActiveLayer());

 
 obj1.GetPenColor().SetRgb(0x0000ff);
 obj2.GetPenColor().SetRgb(0x00ff00);
 obj3.GetPenColor().SetRgb(0xff0000);
 obj1.SetStartPoint(cen);
 obj2.SetStartPoint(cen);
 obj3.SetStartPoint(cen);
 obj1.SetEndPoint(xd);
 obj2.SetEndPoint(yd);
 obj3.SetEndPoint(zd);

 rend.DrawEntity(obj1);
 rend.DrawEntity(obj2);
 rend.DrawEntity(obj3);
 *Cancel = 1;
 
}