CreatePoint
public virtual CATIGSMPointCoord_var CreatePoint( const CATICkeParm_var iFirstCoord,
const CATICkeParm_var iSecondCoord,
const CATICkeParm_var iThirdCoord) =0
功能:根据空间坐标创建点
参数:X/Y/Z坐标
示例:
double Coords[3]; //创建一个三维数组(x,y,z)定义点坐标
double Coords[3] = {100,0,0};
Coords[0] = 100;
Coords[1] = 0;
Coords[2] = 0;
CATISpecObject_var spSpecPoint1=spGSMFactory->CreatePoint(Coords);
spSpecPoint1->Update();
CATIGSMProceduralView_var spPntObj = spSpecPoint1;
spPntObj->InsertInProceduralView();//添加到视图中
CreatePoint
public virtual CATIGSMPointTangent_var CreatePoint( const CATISpecObject_var iCurve,
const CATIGSMDirection_var iDirection) = 0
功能:根据曲线和切线切点创建点
参数:曲线、方向
CreatePoint
public virtual CATIGSMPointCenter_var CreatePoint( const CATISpecObject_var iCurve) = 0
功能:根据圆的圆心创建点
参数:圆、
CreateLine
public virtual CATIGSMLinePtPt_var CreateLine( const CATISpecObject_var iPoint1,
const CATISpecObject_var iPoint2,
const CATISpecObject_var iSupport = NULL_var) = 0
功能:两点间创建一条直线
参数:点1、点2
示例:double Coords[3];
Coords[0] = 0;
Coords[1] = 0;
Coords[2] = 0; //创建一个三维数组(x,y,z)定义点坐标
CATIGSMPoint_var spPoint1 = spGSMFactory->CreatePoint(Coords); //Creates a
point,(创建一个CATIGSMPoint并将其转换为CATISpecObject)
CATISpecObject_var spSpecPoint1 = spPoint1; //Casts the point as a CATISpecObject
Coords[0] = 80;
Coords[1] = 60;
Coords[2] = 70;
CATIGSMPoint_var spPoint2 = spGSMFactory->CreatePoint(Coords);
CATISpecObject_var spSpecPoint2 = spPoint2;
CATISpecObject_var spSupport = NULL_var; //用创建的点创建一条线,并转换为CATISpecObject
CATIGSMLinePtPt_var spSpecPoint2, spSupport);
spLine1 = spGSMFactory->CreateLine(spSpecPoint1,
CATISpecObject_var spSpecLine1 = spLine1;
CreatePlane
public virtual CATIGSMPlaneAngle_var CreatePlane( const CATISpecObject_var
iPlane,
const CATISpecObject_var iRotationAxis,
const CATICkeParm_var iAngle,
const CATGSMOrientation iOrientation) = 0
功能:根据一个平面和角度创建另一个平面
示例:
CATICkeParm_var iAngle=spCkeFact -> CreateAngle (\"Angle\
CATIGSMPlaneAngle_var
lfbpm=spGSMFactory->CreatePlane(xpm,bjlzx,iAngle,CATGSMSameOrientation);
CreateLength
public virtual CATICkeParm_var CreateLength( const CATUnicodeString& iParameterName,
const double iParameterValue) = 0
功能:创建长度参数
参数:参数名、公式
CATICkeParm_var disp12/1000+0.1);
iLength1=spCkeFact -> CreateLength (\"Length1\",
CreateCircle
public virtual CATISpecObject_var CreateCircle( const double* iPoint, const double iRadius) = 0
功能:根据圆心和半径创建圆
参数:点、半径
示例:
double p10[2] = {0,0};
CATISpecObject_var spCurve10 =sketch2DFactory1->CreateCircle(p10,1000);
CreateCorner
public virtual CATIGSMCorner_var CreateCorner( const CATISpecObject_var iElement1,
const CATISpecObject_var iElement2,
const CATISpecObject_var iSupport,
const CATICkeParm_var iRayon,
CATGSMOrientation iOrient1,
CATGSMOrientation iOrient2,
CATBoolean Trim) = 0
功能:根据支持面上两条线或一个店一条线创建圆角
参数:第一参照线、第二参照线、支持面、圆角半径、支持方向、修剪类型
示例:
double radius = 20.;//定义半径
double pt_center[2] = {20., 20.};
CATI2DCurve_var spCurve5 =
spWF2DFactOnSketch->CreateCorner(spCurveOnLine1, spCurveOnLine4, pt_center,
&radius);
CATI2DTopologicalOperators_var spOperateur = spSketch;
spOperateur->InsertCorner(spCurve5,spLine1,1,spLine4,1);
spConstraint2DFactory->CreateConstraint( spLine1, NULL, spCurve5, NULL, NULL, NULL, NULL, Cst2DType_Tangent, 0, 0);
spConstraint2DFactory->CreateConstraint( spCurve5, NULL, spLine4, NULL, NULL, NULL, NULL, Cst2DType_Tangent, 0, 0);
spConstraint2DFactory->CreateConstraint( spCurve5, NULL, NULL, NULL, NULL, NULL, NULL, Cst2DType_Radius, 0, 1);//添加约束
CreatePocket
public virtual CATISpecObject_var
CreatePocket( const CATISpecObject_var& ihSketch = NULL_var) = 0
功能:创建凹槽
参数:用户创建的草图
示例:CATIPrtFactory_var spPrtFactOnPrtCont(piPrtCont);
CATISpecObject_var
spPrtFactOnPrtCont->CreatePocket(spSketch);
spSpecObj =
CATIPocket_var spPocketOnSpecObj(spSpecObj);
spPocketOnSpecObj->ModifyEndType(catUpToSurfaceLimit);//限制类型
spPocketOnSpecObj->ModifyEndInit(SOGSMSplit1);
spPocketOnSpecObj->ModifyEndOffsetFromSurface(-c1);//拉伸值
spPocketOnSpecObj->ModifyStartType(catUpToSurfaceLimit);
spPocketOnSpecObj->ModifyStartInit(SOGSMSplit2);
spPocketOnSpecObj->ModifyStartOffsetFromSurface(-c2);
CreatePad
public virtual CATISpecObject_var
CreatePad( const CATISpecObject_var& ihSketch = NULL_var) = 0
功能:创建凸台
参数:用户创建的草图
示例:CATIPrtFactory_var spPrtFactOnPrtCont(piPrtCont);
CATISpecObject_var spSpecObj = spPrtFactOnPrtCont->CreatePad(spSketch);
CATIPad_var spPadOnSpecObj(spSpecObj);
spPadOnSpecObj->ModifyEndType(catUpToSurfaceLimit);
spPadOnSpecObj->ModifyEndInit(SOGSMSplit1);
spPadOnSpecObj->ModifyEndOffsetFromSurface(-m1);
spPadOnSpecObj->ModifyStartType(catUpToSurfaceLimit);
spPadOnSpecObj->ModifyStartInit(SOGSMSplit2);
spPadOnSpecObj->ModifyStartOffsetFromSurface(-m2);
CreateSplit
public virtual CATIGSMSplit_var CreateSplit( const CATISpecObject_var iToCut,
const CATISpecObject_var iCutting,
CATGSMOrientation iOrientation) = 0
功能:分割剪裁
参数:被分割的元素(线或面)、用来分割的元素(点、线或面)、保留的方向
示例:
CATIGSMSplit_var
GSMSplit1=spGSMFactory->CreateSplit(_piSpecFeature1,spSpecExtr,CATGSMSameOrientation);
SOGSMSplit1=GSMSplit1;
SOGSMSplit1->Update();
CreateExtrude
public virtual CATIGSMExtrude_var CreateExtrude( const CATISpecObject_var iSpecIn,
const CATIGSMDirection_var iSpecDir,
const CATICkeParm_var iLength1,
const CATICkeParm_var iLength2,
const CATBoolean iOrientation)=0
功能:创建挤压表面(类似于薄壁拉伸)
参数:挤出面的轮廓(点或线)、挤出方向、第一拉伸长度、第二拉伸长度、方向
示例:
double Length1=distan1/1000+0.2;
double Length2=distan2/1000+0.2;
CATIGSMDirection_var
spDirRef=spGSMFactory->CreateDirection(_piSpecFeature4);
CATICkeParm_var spCkeLgStart= spCkeFact -> CreateLength( \"Start\" ,Length1);
CATICkeParm_var spCkeLgEnd = spCkeFact ->CreateLength( \"End\" ,Length2);
CATIGSMExtrude_var
spExtrude
spGSMFactory->CreateExtrude(spSketch,spDirRef,spCkeLgStart,spCkeLgEnd,TRUE);
=
CATISpecObject_var spSpecExtr = spExtrude;
spSpecExtr->Update();
CreateWeb
public virtual HRESULT __stdcall CreateWeb( const CATISpecObject* ipiPartSpec,
CATISpecObject** opiWebSpec) = 0
功能:创建网(腹板)
参数:生成网的草图、网的特征
示例:
piAslFactory -> CreateWeb ((CATISpecObject *) spPrtPartSpec, &piWebSpec);
CATIStmWeb * piStmWeb = NULL; // Web public interface
piWebSpec -> QueryInterface(IID_CATIStmWeb, (void **)& piStmWeb);
CATLISTP(CATISpecObject) LimitsSpecList;
CATListOfInt ViewTypeList;
LimitsSpecList.Append(SpecSketch);
ViewTypeList.Append(1);// Set the Web Boundary :
piStmWeb -> SetSupport(SpecSketch);
CreateSurfacicFlange
public virtual HRESULT __stdcall CreateSurfacicFlange( const CATISpecObject* ipiPartSpec,
CATISpecObject** opiSurfacicFlangeSpec) = 0
功能:创建翻边儿
参数:要加入翻边儿的基础特征、创建的翻边儿
示例:
CATISpecObject * piFlangeSurfSpec2 = NULL; // Surfacic Flange Feature
piAslFactory -> CreateSurfacicFlange ((CATISpecObject *) spPrtPartSpec, &piFlangeSurfSpec2);// retrieve a pointer on the SurfacicFlange public interface :
CATIStmFlangeSurf * piStmFlangeSurf2 = NULL; // Surfacic Flange public interface
piFlangeSurfSpec2 piStmFlangeSurf2);
-> QueryInterface(IID_CATIStmFlangeSurf, (void **)&
piStmFlangeSurf2 -> SetBaseFeature ((CATISpecObject *)piWebSpec);
piStmFlangeSurf2 -> SetSupport ((CATISpecObject *)spSpecOffset2);
piStmFlangeSurf2 -> SetBaseFeatureOrient(CATOrientationPositive);
piStmFlangeSurf2 -> SetMaterialOrient(CATOrientationNegative);
if(downsty==1)piStmFlangeSurf2 -> SetFlangeOrient(CATOrientationNegative);
CATICkeParm * opiEOPLengthParam2;
piStmFlangeSurf2 -> GetEOPLength(&opiEOPLengthParam2);
opiEOPLengthParam2 -> Valuate(B2/1000);
CreateOffset
public virtual CATIGSMOffset_var CreateOffset( const CATISpecObject_var iSpecIn,
const CATICkeParm_var iLittMax,
CATBoolean InvertDirection =FALSE,
CATBoolean iSuppressMode =FALSE) = 0
功能:创建偏移面
参数:要偏移的面、偏移距离、偏移方向
示例:
CATIGSMOffset_var
duantfb1=spGSMFactory->CreateOffset( spSpecdtpm1,dtpz1,FALSE);
QuickRelimit
public virtual HRESULT QuickRelimit( CATBaseUnknown* iCurve,
const CATMathPoint2D& iSelectedPoint,
CATBaseUnknown** oNewCurve,
int iBreak =-1, const int iCreateConstraint =1) = 0
功能:快速修剪,草图上两点,修剪后留下两点之间或者之外的部分
参数:被修剪曲线、位于被剪曲线上的点、数字决定留下哪部分
示例:CATBaseUnknown * oNewCurve=NULL;
CATI2DTopologicalOperators_var spOperateur = spSketch;
CATMathPoint2D iSelectedPoint(0,0);
spOperateur ->QuickRelimit( Geometry1[1], iSelectedPoint,&oNewCurve,0);
spOperateur ->QuickRelimit( Geometry2[1], iSelectedPoint,&oNewCurve,0);
if(firsty!=1)spOperateur ->QuickRelimit( spLine1, iSelectedPoint,&oNewCurve,0);
if(secsty!=1)spOperateur ->QuickRelimit( spLine3, iSelectedPoint,&oNewCurve,0);
if(NULL!=oNewCurve){oNewCurve->Release();oNewCurve=NULL;}
CreateThickness
public virtual CATISpecObject_var CreateThickness( const
CATLISTV(CATISpecObject_var)* ihObjectList, double iOffset) = 0
功能:创建厚度曲面
参数:曲线、拉伸值。(一般都是拉伸不封闭的曲面)
示例:
CATLISTV(CATISpecObject_var) aObjectParameters;
aObjectParameters.Append(spSpec2);
CATIPrtFactory_var spPrtFactOnPrtCont(piPrtCont);
CATISpecObject_var
ThickSurface=spPrtFactOnPrtCont->CreateThickness(&aObjectParameters ,9);
CreateSolidOffset
public virtual CATISpecObject_var CreateSolidOffset( const CATISpecObject_var ihSurface,
const CATPrtOffsetSens iIsensOffset,
double iTopOffset,
double iBotOffset) = 0
功能:创建光滑拉伸
示例
double thick=h1+h2;
CATIPrtFactory_var spPrtFactOnPrtCont(piPrtCont);
CATISpecObject_var
ThickSurface1=spPrtFactOnPrtCont->CreateSolidOffset( spSpec2,NormalSide ,0 ,thic
k);
ThickSurface1->Update();//厚曲面mm
CreateAdd
public virtual CATISpecObject_var CreateAdd( CATISpecObject_var iFirst,
CATISpecObject_var iSecond)=0
功能:布尔加,把一个实体加到另一个实体上
参数:当前实体,需要添加的实体
示例:
CATIPrtBooleanFactory_var Boolean(piPrtCont);
CATISpecObject_var add1=Boolean->CreateAdd(CurrentFea,PrtTool1); //布尔加
add1->Update();//生成加强凸台
CreateRemove
public virtual CATISpecObject_var CreateRemove( CATISpecObject_var iFirst,
CATISpecObject_var iSecond)=0
功能:布尔减
示例:
CATISpecObject_var Remove1=Boolean->CreateRemove(CurrentFea,PrtTool2);
Remove1->Update();
CreatePRTTool
public virtual CATISpecObject_var CreatePRTTool( const CATUnicodeString& iUserName,
const iDestination) = 0
CATISpecObject_var&
功能:插入一个机械特征
示例
double deep1=h1;
CATISpecObject_var PrtTool2=MechanicalRootFactory->CreatePRTTool( \"下陷\",spPart);//插入几何体
CreateRectPatt
public virtual CATISpecObject_var CreateRectPatt( const CATISpecObject_var ihMotif,
const CATISpecObject_var ihLine1,
const CATISpecObject_var ihLine2,
const CATBoolean iDir1,
const CATBoolean iDir2,
const int iNb1,
const int iNb2,
const double iStep1,
const double iStep2,
const int iNu,
const int iNv,
const double iRotationAngle) = 0
功能:矩形阵列
示例:int nb1 = 3, nb2 = 4;
double step1 = 40., step2 = 40.;
double angle1 =0.;
CATISpecObject_var spRectPatternOfPattPad=
spPrtFactOnPrtCont->CreateRectPatt(spSpecObj,
spSketchPlane,
spSketchPlane,
TRUE,
TRUE,
nb1,
nb2,
(float)step1,
(float)step2,
1,
1,
(float)angle1); if(NULL_var == spRectPatternOfPattPad)
return ;
CATIPrtPattern_var spUserPatt(spRectPatternOfPattPad);
if(NULL_var != spUserPatt) // specification option
{ BuildShape method to be in pattern context
int dsgInt = spUserPatt->GetIfDesignIntent();
if(0 == dsgInt)
spUserPatt->SetDesignIntent(1);
Sets the keep
// to define the }
spRectPatternOfPattPad->Update();
定义工作对象:
void StructureState::DefineInWorkObject(CATIPrtContainer * piPrtCont)
{
CATIPrtPart_var spPart(piPrtCont->GetPart());
CATLISTV(CATISpecObject_var) ListFound;
CATIDescendants_var spDescendants(spPart);
spDescendants->GetDirectChildren(\"CATISpecObject\",ListFound);
for(int i=1;i <= ListFound.Size();i++)
{
CATISpecObject_var spSpecName=ListFound[i];
CATIAlias * pIAlias = NULL ;
spSpecName->QueryInterface(IID_CATIAlias,(void**)& pIAlias);
CATUnicodeString str=pIAlias->GetAlias();
//cout<<\"spSpecName=\"< { spPart-> SetCurrentFeature(spSpecName); break; } } } 获取交点坐标和线坐标并通过矢量相减创建坐标系 //两条线交点坐标及在线上某点垂线的方向坐标 CATISpecObject_var StructureLiang::GetJiaodianzuobiao(CATIPrtContainer piPrtCont,CATISpecObject_var rootLine1,CATISpecObject_var rootLine2) * { CATISpecObject_var spSpPointCoord; CATIGSMFactory_var spGSMFactory(piPrtCont); CATICkeParmFactory_var spCkeFact(piPrtCont); CATICkeParm_var spCkeFirstCoord1= spCkeFact -> CreateLength( \"\" ,0); CATICkeParm_var spCkeSecondCoord1= spCkeFact -> CreateLength( \"\" ,0); CATICkeParm_var spCkeThirdCoord1 = spCkeFact -> CreateLength( \"\" ,0); CATIGSMIntersect_var spIntersect1=spGSMFactory->CreateIntersect(rootLine1,rootLine2,FALSE); CATISpecObject_var spSpIntersect1= spIntersect1; spSpIntersect1->Update(); CATIGSMPointCoord_var spGSMPointCoord1=spGSMFactory->CreatePoint(spCkeFirstCoord1,spCkeSecondCo ord1,spCkeThirdCoord1,spSpIntersect1); spSpPointCoord= spGSMPointCoord1; spSpPointCoord->Update(); return spSpPointCoord; } CATMathDirection StructureLiang::GetXianzuobiao(CATIPrtContainer piPrtCont,CATISpecObject_var rootLine1,CATISpecObject_var spSpPointCoord1) * rootPlane1,CATISpecObject_var { CATMathDirection pdir; CATIGSMFactory_var spGSMFactory(piPrtCont); CATICkeParmFactory_var spCkeFact(piPrtCont); const double PI=3.1415926; double angle=PI/2; CATICkeParm_var spCkeStartLength1= spCkeFact -> CreateLength( \"\" ,0); CATICkeParm_var spCkeEndLength1= spCkeFact -> CreateLength( \"\" ,-0.5); CATICkeParm_var spCkeAngle1= spCkeFact -> CreateAngle( \"\" ,angle); CATIGSMLineAngle_var spGSMLineAngle1=spGSMFactory->CreateLine(rootLine1,rootPlane1,spSpPointCoord1,TRUE,spCkeStartLength1,spCkeEndLength1,spCkeAngle1,CATGSMSameOrientation); CATISpecObject_var spSpGSMLineAngle1=spGSMLineAngle1; spSpGSMLineAngle1->Update(); CATLine* prootLine= NULL; spSpGSMLineAngle1->QueryInterface(IID_CATLine, (void**)&prootLine); prootLine->GetDirection(pdir); return pdir; } void piPrtCont, StructureLiang::Fuzhuyaosu1(CATUnicodeString str,CATIPrtContainer * CATISpecObject*_piSpecFeature1,CATISpecObject *_piSpecFeature2, CATISpecObject *_piSpecFeature3,CATISpecObject *_piSpecFeature4, CATISpecObject *_piSpecFeature5,CATISpecObject *_piSpecFeature6, double B, CATULong Ulong24,CATULong Ulong28) { CATIGSMFactory_var spGSMFactory(piPrtCont); CATICkeParmFactory_var spCkeFact(piPrtCont); //------------原点坐标-------------- CATPoint* pPoint1= NULL; double OX,OY,OZ; CATISpecObject_var spSpPointCoord1=GetJiaodianzuobiao(piPrtCont,_piSpecFeature3,_piSpecFeature5); spSpPointCoord1->QueryInterface(IID_CATPoint, (void**)&pPoint1); pPoint1->GetCoord(OX,OY,OZ); //------新坐标轴V方向-梁轴线方向坐标----------------------- CATISpecObject_var spSpPointCoord2=GetJiaodianzuobiao(piPrtCont,_piSpecFeature3,_piSpecFeature6); CATPoint* pPoint2= NULL; spSpPointCoord2->QueryInterface(IID_CATPoint, (void**)&pPoint2); double OX2,OY2,OZ2; pPoint2->GetCoord(OX2,OY2,OZ2); double VX1=OX2-OX,VY1=OY2-OY,VZ1=OZ2-OZ; //------新坐标轴H方向-H轴线方向坐标-------------------- CATMathDirection pdir1=GetXianzuobiao(piPrtCont,_piSpecFeature4,_piSpecFeature3,spSpPointCoord1);//H轴线方向坐标 double HX1,HY1,HZ1; pdir1.GetCoord(HX1,HY1,HZ1); 因篇幅问题不能全部显示,请点此查看更多更全内容