📄 samp5.c
字号:
/*load head file*/
#include<ProToolkit.h>#include<Pro2dEntdef.h>#include<ProANSI.h>#include<ProAnimate.h>#include<ProArray.h>#include<ProAsmcomp.h>#include<ProAsmcomppath.h>#include<ProAssembly.h>#include<ProAxis.h>#include<ProChamfer.h>#include<ProClCmd.h>#include<ProColor.h>#include<ProComm.h>#include<ProConst.h>#include<ProContour.h>#include<ProContourdata.h>#include<ProCore.h>#include<ProCsys.h>#include<ProCsysdata.h>#include<ProCurve.h>#include<ProCurvedata.h>#include<ProDatumdata.h>#include<ProDisplist.h>#include<ProDtmAxis.h>#include<ProDtmCrv.h>#include<ProDtmCrvSketch.h>#include<ProDtmCsys.h>#include<ProDtmPln.h>#include<ProEdge.h>#include<ProEdgedata.h>#include<ProElemId.h>#include<ProElement.h>#include<ProElempath.h>#include<ProExpldstate.h>#include<ProExtdata.h>#include<ProExtobj.h>#include<ProExtobjCB.h>#include<ProExtobjDisp.h>#include<ProExtobjRef.h>#include<ProExtobjSel.h>#include<ProExtrude.h>#include<ProFaminstance.h>#include<ProFamtable.h>#include<ProFeatForm.h>#include<ProFeatType.h>#include<ProFeature.h>#include<ProFixture.h>#include<ProFlatSrf.h>#include<ProForeignCurve.h>#include<ProGeomitem.h>#include<ProGeomitemdata.h>#include<ProGraphic.h>#include<ProGroup.h>#include<ProHardware.h>#include<ProImportfeat.h>#include<ProIntfData.h>#include<ProItemerr.h>#include<ProLayer.h>#include<ProLayerR19.h>#include<ProMaterial.h>#include<ProMdl.h>#include<ProMenu.h>#include<ProMenuBar.h>#include<ProMessage.h>#include<ProMfg.h>#include<ProMfgoper.h>#include<ProModFeat.h>#include<ProMode.h>#include<ProModelitem.h>#include<ProNcseq.h>#include<ProNcseqElem.h>#include<ProNote.h>#include<ProNotify.h>#include<ProObjects.h>#include<ProParameter.h>#include<ProParamval.h>#include<ProPart.h>#include<ProPattern.h>#include<ProPecktable.h>#include<ProPoint.h>#include<ProProcstep.h>#include<ProQuilt.h>#include<ProQuiltdata.h>#include<ProRelSet.h>#include<ProReplace.h>#include<ProRevolve.h>#include<ProRmdt.h>#include<ProRule.h>#include<ProSecConstr.h>#include<ProSecdim.h>#include<ProSecdimType.h>#include<ProSecerror.h>#include<ProSection.h>#include<ProSelection.h>#include<ProSheetmetal.h>#include<ProSimprep.h>#include<ProSimprepdata.h>#include<ProSizeConst.h>#include<ProSolid.h>#include<ProStdSection.h>#include<ProSurface.h>#include<ProSurfacedata.h>#include<ProSweep.h>#include<ProTool.h>#include<ProToolElem.h>#include<ProToolinput.h>#include<ProUICmd.h>#include<ProUtil.h>#include<ProValue.h>#include<ProVerstamp.h>#include<ProView.h>#include<ProWcell.h>#include<ProWchar.h>#include<ProWindows.h>#include<ProWorkspace.h>#include<ProWstring.h>#include "ProDtmCsys.h"
#define C_PRINT(a) printf ( "%s\n", a);
ProFileName UserMsg;
/*---------------------- Function Prototypes -------------------------*/
ProError ProDemoGeneralCsysCreate();
/*------------------------- External Data ----------------------------*/
ProError ProDemoSectCreate();
/*--------------------------------------------------------------------*\Application global data\*--------------------------------------------------------------------*/static uiCmdAccessState TestAccessDefault(uiCmdAccessMode access_mode){ return (ACCESS_AVAILABLE);}/*===========================================================================*\ Function : main Purpose : Test the ProToolkitMain() function. main is optional function.\*===========================================================================*/main(argc, argv)int argc;char **argv;{ ProToolkitMain(argc, argv); return(0);}/*====================================================================*\FUNCTION : user_initialize()PURPOSE : Pro/DEVELOP standard initialize - define menu button\*====================================================================*/int user_initialize( int argc, char *argv[], wchar_t errbuf[80]){
ProError status;
uiCmdCmdId cmd_id;
/*----------------------------------------------------------------*\
消息文件
\*----------------------------------------------------------------*/
ProStringToWstring (UserMsg, "msg.txt");
status = ProMessageDisplay (UserMsg, "USER %0s", "Demo of creating datum Csys.\n");
/*---------------------------------------------------------------------*\
Add new button to the menu bar
\*---------------------------------------------------------------------*/
status = ProCmdActionAdd("MyCmd",
(uiCmdCmdActFn)ProDemoGeneralCsysCreate,
uiProe2ndImmediate, TestAccessDefault,
PRO_B_TRUE, PRO_B_TRUE, &cmd_id);
status = ProMenubarmenuPushbuttonAdd(
"File", "MyCmd", "Create Datum Csys", "Create Datum Csys",
"File.psh_exit", PRO_B_TRUE, cmd_id, UserMsg);
return (0);
}
/*====================================================================*\
FUNCTION : user_terminate()
PURPOSE : To handle any termination actions
\*====================================================================*/
void user_terminate()
{
}
/*===============================================================*\
FUNCTION : ProDemoGeneralCsysCreate
PURPOSE : Demonstrates the creation of the extruded protrusion
base feature.
\*===============================================================*/
ProError ProDemoGeneralCsysCreate()
{
ProErrorlist errors;
ProMdl model;
ProModelitem model_item;
ProSelection model_sel;
ProFeature feature;
ProFeatureCreateOptions opts[1];
ProAsmcomppath *p_comp_path = NULL;
ProValue value;
char name[PRO_NAME_SIZE];
ProError status;
ProElement pro_e_feature_tree;
ProElement pro_e_feature_type;
ProElement pro_e_std_feature_name;
ProElement pro_e_csys_origin_constrs;
ProElement pro_e_csys_origin_constr;
ProElement pro_e_csys_origin_constr_ref;
ProElement pro_e_csys_offset_type;
ProElement pro_e_csys_orientmoves;
ProElement pro_e_csys_orientmove;
ProElement pro_e_csys_orientmove_move_type;
ProElement pro_e_csys_orientmove_move_val;
ProName wide_string;
ProValueData value_data;
ProSelection * p_select;
int n_select;
ProBoolean is_interactive = PRO_B_TRUE;
/*---------------------------------------------------------------*\
Populating root element PRO_E_FEATURE_TREE
\*---------------------------------------------------------------*/
C_PRINT( " *** Processing Element PRO_E_FEATURE_TREE *** " );
status = ProElementAlloc ( PRO_E_FEATURE_TREE, &pro_e_feature_tree );
/*---------------------------------------------------------------*\
Populating element PRO_E_FEATURE_TYPE
\*---------------------------------------------------------------*/
C_PRINT( " *** Processing Element PRO_E_FEATURE_TYPE *** " );
status = ProElementAlloc ( PRO_E_FEATURE_TYPE, &pro_e_feature_type );
value_data.type = PRO_VALUE_TYPE_INT;
value_data.v.i = PRO_FEAT_CSYS; /* 979 */
status = ProValueAlloc ( &value );
status = ProValueDataSet ( value, &value_data );
status = ProElementValueSet ( pro_e_feature_type, value );
status = ProElemtreeElementAdd ( pro_e_feature_tree, NULL,
pro_e_feature_type );
/*---------------------------------------------------------------*\
Populating element PRO_E_STD_FEATURE_NAME
\*---------------------------------------------------------------*/
C_PRINT( " *** Processing Element PRO_E_STD_FEATURE_NAME *** " );
status = ProElementAlloc ( PRO_E_STD_FEATURE_NAME, &pro_e_std_feature_name );
ProStringToWstring ( wide_string, "MY_CS0" );
value_data.type = PRO_VALUE_TYPE_WSTRING;
value_data.v.w = wide_string;
status = ProValueAlloc ( &value );
status = ProValueDataSet ( value, &value_data );
status = ProElementValueSet ( pro_e_std_feature_name, value );
status = ProElemtreeElementAdd ( pro_e_feature_tree, NULL,
pro_e_std_feature_name );
/*---------------------------------------------------------------*\
Populating element PRO_E_CSYS_ORIGIN_CONSTRS
\*---------------------------------------------------------------*/
C_PRINT( " *** Processing Element PRO_E_CSYS_ORIGIN_CONSTRS *** " );
status = ProElementAlloc ( PRO_E_CSYS_ORIGIN_CONSTRS,
&pro_e_csys_origin_constrs );
status = ProElemtreeElementAdd ( pro_e_feature_tree, NULL,
pro_e_csys_origin_constrs );
/*---------------------------------------------------------------*\
Populating element PRO_E_CSYS_ORIGIN_CONSTR
\*---------------------------------------------------------------*/
C_PRINT( " *** Processing Element PRO_E_CSYS_ORIGIN_CONSTR *** " );
status = ProElementAlloc ( PRO_E_CSYS_ORIGIN_CONSTR,
&pro_e_csys_origin_constr );
status = ProElemtreeElementAdd ( pro_e_csys_origin_constrs, NULL,
pro_e_csys_origin_constr );
/*---------------------------------------------------------------*\
Populating element PRO_E_CSYS_ORIGIN_CONSTR_REF
\*---------------------------------------------------------------*/
C_PRINT( " *** Processing Element PRO_E_CSYS_ORIGIN_CONSTR_REF *** " );
status = ProMessageDisplay ( UserMsg, "Select a reference CSYS");
printf ( "Please select csys_ID_25 type of Modelitem\n");
status = ProSelect ( "csys", -1, NULL, NULL, NULL, NULL, &p_select,
&n_select );
if ( n_select <= 0 ) return -1;
status = ProElementAlloc ( PRO_E_CSYS_ORIGIN_CONSTR_REF,
&pro_e_csys_origin_constr_ref );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -