工程图是设计完成的最后一步。各种零部件的设计以图纸的形式移交生产部门。也是设计的重要一环。
历时两个多月的艰苦努力,终于完成任务。
有些函数在设计很重要,反复使用,有必要总结一下,以备将来。也为开发者提供参考。
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;
}