⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 samp3.c

📁 Pro.TOOLKIT.Wildfire插件设计.配套光盘-141M.zip
💻 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>

ProFileName   UserMsg;
int UserLayerItemTypeChoose();
int UserLayerCreate();

/*--------------------------------------------------------------------*\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]){
    int i, menu_id;
    ProError status;
    uiCmdCmdId	cmd_id;

/*----------------------------------------------------------------*\
消息文件
\*----------------------------------------------------------------*/
	ProStringToWstring (UserMsg, "msg.txt");
	status = ProMessageDisplay (UserMsg, "USER %0s", "Demo of Layer Application.\n");

/*---------------------------------------------------------------------*\
    Add new button to the menu bar
\*---------------------------------------------------------------------*/
    status = ProCmdActionAdd("MyCmd",
	(uiCmdCmdActFn)UserLayerCreate,
	uiProe2ndImmediate, TestAccessDefault,
	PRO_B_TRUE, PRO_B_TRUE, &cmd_id);

    status = ProMenubarmenuPushbuttonAdd(
	"File", "MyCmd", "Layer Application", "Create Layer and add Objects",
	"File.psh_exit", PRO_B_TRUE, cmd_id, UserMsg);

    return (0);

}

/*====================================================================*\
FUNCTION : user_terminate()
PURPOSE  : To handle any termination actions
\*====================================================================*/
void user_terminate()
{

}

/*==================================================================*\
FUNCTION: UserLayerItemAction()
PURPOSE: Close the menu and reports the selected menu action.
\*==================================================================*/
int UserLayerItemAction (ProAppData dummy, int action)
{
	int status;
	status = ProMenuDeleteWithStatus (action);
	return(status);
}

/*==================================================================*\
FUNCTION: UserLayerItemTypeChoose()
PURPOSE: Prompt the user to select an element type to add to
the layer.
\*==================================================================*/
int UserLayerItemTypeChoose()
{
int menu_id;
int action;
ProError err;
err = ProMenuFileRegister ("LayerApp", "LayerApp.mnu", &menu_id);
err = ProMenubuttonActionSet ("LayerApp", "Part",
UserLayerItemAction, NULL, PRO_LAYER_PART);
err = ProMenubuttonActionSet ("LayerApp", "Feature",
UserLayerItemAction, NULL, PRO_LAYER_FEAT);
err = ProMenubuttonActionSet ("LayerApp", "Curve",
UserLayerItemAction, NULL, PRO_LAYER_CURVE);
err = ProMenubuttonActionSet ("LayerApp", "Quilt",
UserLayerItemAction, NULL, PRO_LAYER_QUILT);
err = ProMenubuttonActionSet ("LayerApp", "Point",
UserLayerItemAction, NULL, PRO_LAYER_POINT);
err = ProMenubuttonActionSet ("LayerApp", "LayerApp",
UserLayerItemAction, NULL, -1);
ProMenuCreate (PROMENUTYPE_MAIN, "LayerApp", &menu_id);
ProMenuProcess ("", &action);
return (action);
}

/*==================================================================*\
FUNCTION: UserLayerCreate()
PURPOSE: Create a layer and add items to it.
\*==================================================================*/
int UserLayerCreate()
{
#define MAX_BUFFER_LENGTH 20
ProLayer layer;
ProName layer_name;
ProLayerItem layer_item;
ProMdl object, member;
ProSelection *sel;
ProModelitem model_item;
int type;
int nsel;
int m;
char *option;
ProCharName str1;
ProCharLine str2;
ProError err;

/*-----------------------------------------------------------------*\
Get the handle for the active model.
\*-----------------------------------------------------------------*/
err = ProMdlCurrentGet (&object);
if (err != PRO_TK_NO_ERROR)
{
ProMessageDisplay (UserMsg, "USER %0s",
"Error getting current model.");
return (err);
}
/*-----------------------------------------------------------------*\
Get the layer name from the user.
\*-----------------------------------------------------------------*/
ProMessageDisplay (UserMsg, "USER %0s",
"输入新的层名: ");
ProMessageStringRead (MAX_BUFFER_LENGTH, layer_name);
/*-----------------------------------------------------------------*\
Create the new layer.
\*-----------------------------------------------------------------*/
err = ProLayerCreate (object, layer_name, &layer);
sprintf (str2, "新层%s已创建\n.",
ProWstringToString (str1, layer_name));
if (err == PRO_TK_NO_ERROR)
{
ProMessageDisplay (UserMsg, "USER %0s", str2);
}
else
{
ProMessageDisplay (UserMsg, "USER %0s",
"创建新层失败\n.");
return (err);
}
/*-----------------------------------------------------------------*\
Choose the type of element to be selected.
\*-----------------------------------------------------------------*/
ProMessageDisplay (UserMsg, "USER %0s",
"选择要增加的对象");
type = UserLayerItemTypeChoose ();
if (type < 0)
return (0);
/*-----------------------------------------------------------------*\
Set the appropriate ProSelect() option.
\*-----------------------------------------------------------------*/
switch (type)
{
case PRO_LAYER_PART : option = "part" ; break;
case PRO_LAYER_FEAT : option = "feature" ; break;
case PRO_LAYER_CURVE : option = "curve" ; break;
case PRO_LAYER_QUILT : option = "dtmqlt" ; break;
case PRO_LAYER_POINT : option = "point" ; break;
}
while (ProSelect (option, 1, NULL, NULL, NULL, NULL, &sel, &nsel ) ==
PRO_TK_NO_ERROR && nsel > 0)
{
err = ProSelectionModelitemGet (sel[0], &model_item);
err = ProLayerItemInit (type, model_item.id, object,
&layer_item);
err = ProLayerItemAdd (&layer, &layer_item);
ProWindowRepaint (-1);
}
return (0);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -