VS2010 Creo2.0 删除零件

15 篇文章 0 订阅

构造要删除零件的特征del_feat

	ProSelection *p_sel = NULL;
	int n_sel;
	ProMdl mdl;
	ProModelitem sel_item;
	ProFeature feature, p_feat_handle;
	ProMdl p_owner;

	ProAsmcomppath path;
	ProMdlCurrentGet(&mdl);
	std::vector<ProFeature> featls;
	err = ProSolidFeatVisit((ProSolid)mdl, ProFeatureVisitAction_f10, ProFeatureFilterAction_f10, &featls);

	err = ProSelect((char*)"prt_or_asm", 1, NULL,NULL, NULL, NULL, &p_sel, &n_sel);
	if (err != PRO_TK_NO_ERROR || n_sel < 1)	return;
	err = ProSelectionAsmcomppathGet(p_sel[0], &path);
	if (err != PRO_TK_NO_ERROR)	return;

	ProAsmcomppath father_path = path;
	father_path.table_num--;
	ProMdl father_mdl;
	err = ProAsmcomppathMdlGet(&father_path,&father_mdl);
	ProFeature del_feat;
	del_feat.owner = father_mdl;
	del_feat.id = path.comp_id_table[path.table_num-1];
	del_feat.type = PRO_FEATURE;
	featureDel(&del_feat);

ProFeatureDelete函数

ProError featureDel(ProFeature *feat)

	ProError err = PRO_TK_NO_ERROR;
	int featsDelids[1];
	featsDelids[0]=feat->id;

	ProFeatureDeleteOptions delOps[]={PRO_FEAT_DELETE_NO_OPTS};
	err=ProFeatureDelete((ProSolid)feat->owner,featsDelids,1,delOps,1);
	if (err != PRO_TK_NO_ERROR)	return err;
	return err;


动作函数

ProError ProFeatureVisitAction_f10(ProFeature* p_feature, ProError status, ProAppData app_data);

ProError ProFeatureVisitAction_f10(ProFeature* p_feature, ProError status, ProAppData app_data)
{
	std::vector<ProFeature>* pls = (std::vector<ProFeature>*)app_data;

	ProMdl p_mdl_handle;
	ProError err;
	ProFeattype p_type;
	ProMdlType ptype;
	ProBoolean p_is_auto_round_member;
	err = ProFeatureTypeGet(p_feature, &p_type);

	if (p_type == PRO_FEAT_COMPONENT)
	{
		ProAsmcompMdlGet((ProAsmcomp*)p_feature, &p_mdl_handle);
		ProMdlTypeGet(p_mdl_handle, &ptype);
		if (ptype == PRO_MDL_ASSEMBLY)
		{
			ProSolidFeatVisit((ProSolid)p_mdl_handle, ProFeatureVisitAction_f10, ProFeatureFilterAction_f10, app_data);
		}

	}
	pls->push_back(*p_feature);
	return PRO_TK_NO_ERROR;
}


过滤函数
ProError ProFeatureFilterAction_f10(ProFeature* p_parameter, ProAppData app_data);

ProError ProFeatureFilterAction_f10(ProFeature* p_parameter, ProAppData app_data)
{
	return PRO_TK_NO_ERROR;
}





  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Creo2.0是一款功能强大的三维CAD软件,它提供了丰富的工具和功能来帮助用户进行产品设计和可视化。作为二次开发的一部分,Creo2.0 C提供了更多的定制化选项和灵活性,使用户能够根据自己的需求来定制和扩展软件的功能。 使用Creo2.0 C进行二次开发可以实现许多目标。首先,它可以帮助用户创建自定义的用户界面,以适应他们独特的工作流程和操作习惯。用户可以自定义菜单、工具栏、快捷键等,使软件的使用更加高效和便捷。 其次,Creo2.0 C还提供了强大的API(应用程序接口),允许用户编写自己的脚本和工具,以实现高级的自动化和批处理功能。通过编写脚本,用户可以自动执行重复性的任务,加快设计和生产的速度。 此外,Creo2.0 C还支持与其他软件和系统的集成,使用户能够与其它设计团队和供应商进行无缝的协作。用户可以通过导入和导出不同的文件格式,与其他CAD软件进行互操作,并共享设计数据和模型。 最后,Creo2.0 C还提供了丰富的工具和功能来进行模型分析和优化。用户可以使用它来进行结构分析、材料研究、优化算法等,以改进产品的性能和质量。 总之,Creo2.0 C作为Creo2.0的二次开发,为用户提供了更多的定制化选项和灵活性,帮助用户更加高效地进行产品设计和可视化。通过自定义界面、编写脚本、与其他软件集成以及进行模型分析和优化,用户可以根据自己的需求来扩展和定制软件功能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值