工程圖是設計完成的最後一步。各種零部件的設計以圖紙的形式移交生產部門。也是設計的重要一環。
歷時兩個多月的艱苦努力,終於完成任務。
有些函數在設計很重要,反覆使用,有必要總結一下,以備將來。也爲開發者提供參考。
1、畫直線
參數:iStartPoint 起點座標;iEndPoint 終點座標;iLineName:直線名;iLineWidth: 線寬
返回:(1)NULL_var:創建失敗。(2)非空,成功,返回直線的指針。
CATISpecObject_var DrawLine( CATI2DWFFactory_var spGeomFactory,double *iStartPoint,double *iEndPoint[2],CATUnicodeString iLineName,unsigned int iLineWidth,unsigned int iLineType)
{
CATISpecObject_var spObject;
spObject=spGeomFactory->CreateLine(iStartPoint, iEndPoint);
if (spObject==NULL_var) return NULL_var;
spObject->SetName(iLineName);
CATIVisProperties * piVisPropertiesOnLine = NULL;
HRESULT rc = spObject->QueryInterface(IID_CATIVisProperties, (void **) & piVisPropertiesOnLine );
if ( SUCCEEDED(rc)&&piVisPropertiesOnLine)
{
CATVisPropertiesValues MyPropertyOnLine ;
MyPropertyOnLine.SetWidth(iLineWidth);
rc = piVisPropertiesOnLine ->SetPropertiesAtt(MyPropertyOnLine, CATVPWidth ,CATVPLine );
MyPropertyOnLine.SetLineType(iLineType);
rc = piVisPropertiesOnLine ->SetPropertiesAtt(MyPropertyOnLine, CATVPLineType ,CATVPLine );
piVisPropertiesOnLine->Release();
piVisPropertiesOnLine=NULL;
}
return spObject;
}