几何尺寸与公差论坛

 找回密码
 注册
查看: 269|回复: 5

Task 103855 – Parallelism of plane with projection length and width

[复制链接]
发表于 2008-5-27 11:44:35 | 显示全部楼层 |阅读模式
<< David Petrizze  --  12/12/07  15:15:34>>
Create a design document for this enhancement.

Since this enhancement will take more than three days to implement we are breaking it up into two parts, one is the design part and the other will be implementation and testing.
<<END>>
 楼主| 发表于 2008-5-27 11:44:53 | 显示全部楼层

回复: Task 103855 – Parallelism of plane with projection length and width

<< Don Turcotte  --  02/08/08  17:17:46>>
I have completed the implementation of the analysis.  I have this working so the user can specify a secondary datum to control the orientation of Major/Minor.  For this type of parallelism, PC-DMIS now displays the FCF trihedron so the user can see the orientation (Major == length is X axis of FCF trihedron, Minor == width is Y axis of FCF trihedron).

I have attached several test programs.

Added to V43B and V44B.

Files inserted to server
------------------------
V43B\DIMENS\DIM_PARA.CPP
V43B\DIMENS\FEATCTRLFRM.CPP
V43B\DIMENS\GDTHELP.CPP
V43B\INCLUDE\BASIC1.H
V43B\INCLUDE\DIM_PARA.H
V43B\INCLUDE\DTYPES.H
V43B\INCLUDE\EDITRSTR.H
V43B\INCLUDE\FEATCTRLFRM.H
V43B\INCLUDE\FEATCTRLFRMDLG.H
V43B\INCLUDE\GLOBALS.H
V43B\INCLUDE\strings.h
V43B\MENU\DIMENSIO.CPP
V43B\MENU\FEATCTRLFRMCELLS.CPP
V43B\MENU\FEATCTRLFRMDLG.CPP
V43B\MENU\FORMULAINPLACEEDIT.CPP
V43B\PCDLRN.ODL
V43B\RESOURCE\LANGS\ENGLISH\Strings.RC
V43B\SOURCE\DTYPES.CPP
V43B\SOURCE\EDITRSTR.CPP

V44B\DIMENS\DIM_PARA.CPP
V44B\DIMENS\FEATCTRLFRM.CPP
V44B\DIMENS\GDTHELP.CPP
V44B\INCLUDE\BASIC1.H
V44B\INCLUDE\DIM_PARA.H
V44B\INCLUDE\DTYPES.H
V44B\INCLUDE\EDITRSTR.H
V44B\INCLUDE\FEATCTRLFRM.H
V44B\INCLUDE\FEATCTRLFRMDLG.H
V44B\INCLUDE\GLOBALS.H
V44B\INCLUDE\strings.h
V44B\MENU\DIMENSIO.CPP
V44B\MENU\FEATCTRLFRMCELLS.CPP
V44B\MENU\FEATCTRLFRMDLG.CPP
V44B\MENU\FORMULAINPLACEEDIT.CPP
V44B\PCDLRN.ODL
V44B\RESOURCE\LANGS\ENGLISH\Strings.RC
V44B\SOURCE\DTYPES.CPP
V44B\SOURCE\EDITRSTR.CPP
<<END>>
 楼主| 发表于 2008-5-27 11:48:45 | 显示全部楼层

回复: Task 103855 – Parallelism of plane with projection length and width

1.
V44B\DIMENS\DIM_PARA.CPP
CPCDdim_parallel::CPCDdim_parallel(CPCDpart_program *pProgram, CBitVector in_flagword,
                                   CPCDcommand* in_feature1,
                                   CPCDcommand* in_feature2,
                                   LPCTSTR in_id,
  m_matlCondPrimary = DAT_RFS;
  m_matlCondSecondary = DAT_RFS;
  m_matlCondTertiary = DAT_RFS;
  m_pDrf = NULL;

  m_bPlaneProjectedZone = FALSE;
  m_bPlaneProjectionMajorMinor = TRUE;
  m_PlaneProjectedZoneLength = 0.0;
  m_PlaneProjectedZoneWidth = 0.0;
}
void CPCDdim_parallel::GetProjectedCornerPoints(CPCDcommand * pFeature,double length,double width,CArray<CPoint3,CPoint3> & points)
{
  if( pFeature )
  {
    CPoint3 centroid;
    pFeature->gp(CENTROID, MEAS, PART, global_align, centroid);

    CPoint3 vector;
    pFeature->gp(VECTOR, MEAS, PART, global_align, vector);

    CPoint3 major;

    // Figure out which workplane makes sense to project onto the measured plane by using
    // the THEO vector of the plane.  Projecting the workplane onto the measured plane will
    // allow us to determine the directions of length and width.
    CPoint3 theo_vector;
    pFeature->gp(VECTOR, THEO, PART, global_align, theo_vector);

    int Index = 0;
    (void)theo_vector.maxabs(&Index);

    // Get the orientation of length and width.
    switch( Index )
    {
    case 0: // max THEO component in X
      major = CPoint3(0.,1.,0.); // MAJOR == Y
      break;
    case 1: // max THEO component in Y
      major = CPoint3(1.,0.,0.); // MAJOR == X
      break;
    case 2: // max THEO component in Z
      major = CPoint3(1.,0.,0.); // MAJOR == X
      break;
    }

    CPoint3 third = vector.cross(major);
    CPoint3 length_dir = third.cross(vector);
    length_dir.normalize();

    CPoint3 width_dir = vector.cross(length_dir);
    width_dir.normalize();

    CPoint3 machine_pt;
    CPoint3 corner_pt = centroid;
    ConvertCoordinateSystem(PART,ZPAXIS,corner_pt,MACHINE,TOP,machine_pt,global_align,FALSE,this);
    points.Add(machine_pt);

    corner_pt += length * length_dir;
    ConvertCoordinateSystem(PART,ZPAXIS,corner_pt,MACHINE,TOP,machine_pt,global_align,FALSE,this);
    points.Add(machine_pt);

    corner_pt += width * width_dir;
    ConvertCoordinateSystem(PART,ZPAXIS,corner_pt,MACHINE,TOP,machine_pt,global_align,FALSE,this);
    points.Add(machine_pt);

    corner_pt -= length * length_dir;
    ConvertCoordinateSystem(PART,ZPAXIS,corner_pt,MACHINE,TOP,machine_pt,global_align,FALSE,this);
    points.Add(machine_pt);
  }
}
 楼主| 发表于 2008-5-27 12:04:04 | 显示全部楼层

回复: Task 103855 – Parallelism of plane with projection length and width

2. V44B\DIMENS\FEATCTRLFRM.CPP
bool CPCDFeatCtrlFrm::IsPlaneProjectionValid(int lineno/*=2*/)
{
bool bResult = false;
int DimRes = (GetSegmentType() == COMPOSITE_SEGMENT)?GetLine23ComposRes()lineno==2)?GetLine2DimRes():GetLine3DimRes();
int i=0;
for(i=0; i<m_numLeaderLines; i++)
{
if(m_leaderFeatures)
{
CPCDcommand * pFeature = m_leaderFeatures;
int typ= pFeature->feature();
switch(typ)
{
case F_PLANE:
if( DimRes == ID_INSERT_DIMENSION_PARALLELISM )
bResult = true;
break;
case F_SET:
 楼主| 发表于 2008-5-27 12:07:43 | 显示全部楼层

回复: Task 103855 – Parallelism of plane with projection length and width

3. V44B\DIMENS\GDTHELP.CPP
void DrawFCFCallout(CPCDpart_program *m_pPartProgram, CDC *pDC, CPCDFeatCtrlFrm *pFCF, CRect *pRect, CSize *pSize, int FcfLineNum)
        if( pFCF->IsPlaneProjectionValid(2) && pFCF->m_bPlaneProjectionMajorMinor ) // show major,minor projection length
        {
          // Need to convert two values.
          CString ProjStr = pFCF->GetLine2ProjStr();
          int inx_slash = ProjStr.Find(_T('/'));
          CString left, right;
          if( inx_slash != -1 )
          {
            left = ProjStr.Left(inx_slash);
            right = ProjStr.Right(ProjStr.GetLength() - (inx_slash+1));
          }
          else
          {
            left = ProjStr;
          }
          fcfstr = FormatString(m_pPartProgram,left,dUnitsConversion);
          fcfstr += _T("/");
          str += GDTHelpMakeFrameString(fcfstr);
          fcfstr = FormatString(m_pPartProgram,right,dUnitsConversion);
        }
        else
        {
          fcfstr = FormatString(m_pPartProgram,pFCF->GetLine2ProjStr(),dUnitsConversion); // PR245892
        }
 楼主| 发表于 2008-5-27 12:47:15 | 显示全部楼层

回复: Task 103855 – Parallelism of plane with projection length and width

4. t:\V44B\INCLUDE\BASIC1.H
_T("Const DIM_PLANE_PROJECTION_TYPE = 858\r\n") // T103855 - MAJOR/MINOR or DIAMETER for line2
_T("Const DIM_PLANE_PROJECTION_TYPE2 = 859\r\n") // T103855 - MAJOR/MINOR or DIAMETER for line3
_T("Const DIM_PLANE_PROJECTION_LENGTH = 860\r\n") // T103855 - MAJOR proj value (length) for line2
_T("Const DIM_PLANE_PROJECTION_LENGTH2 = 861\r\n") // T103855 - MAJOR proj value (length) for line3
_T("Const DIM_PLANE_PROJECTION_WIDTH = 862\r\n") // T103855 - MINOR proj value (width) for line2
_T("Const DIM_PLANE_PROJECTION_WIDTH2 = 863\r\n") // T103855 - MINOR proj value (width) for line3
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 00:04 , Processed in 0.040633 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表