【UG\NX二次开发】曲线拉伸出片体

/*曲线拉伸出片体*/
bool extrudeSheet(std::vector<tag_t> vCurve, double dir[3], double LimitStart, double LimitEnd, tag_t* tFeature, std::vector<tag_t>& Featurebodys, int get_type)//close list ;1,feature ;2,body
{
	UF_UNDO_mark_id_t  mark_id;
	try
	{
		UF_CALL(UF_UNDO_set_mark(UF_UNDO_visible, NULL, &mark_id));

		char czLimitStart[256];
		char czLimitEnd[256];
		tag_t curve_tag;
		int type;
		int subtype;

		Session* theSession = Session::GetSession();
		Part* workPart(theSession->Parts()->Work());

		Features::Feature* nullFeatures_Feature(NULL);
		Features::ExtrudeBuilder* extrudeBuilder1;
		extrudeBuilder1 = workPart->Features()->CreateExtrudeBuilder(nullFeatures_Feature);

		Section* section1;
		section1 = workPart->Sections()->CreateSection(0.00095, 0.001, 0.05);


		extrudeBuilder1->SetSection(section1);
		extrudeBuilder1->AllowSelfIntersectingSection(true);
		//extrudeBuilder1->SetDistanceTolerance(0.001);
		//extrudeBuilder1->SetDistanceTolerance(0.05);
		//extrudeBuilder1->SetDistanceTolerance(0.1);

		extrudeBuilder1->SetDistanceTolerance(0.0254);

		extrudeBuilder1->BooleanOperation()->SetType(GeometricUtilities::BooleanOperation::BooleanTypeCreate);

#pragma region Limits

		sprintf(czLimitStart, "%f", LimitStart);
		extrudeBuilder1->Limits()->StartExtend()->Value()->SetRightHandSide(czLimitStart);

		sprintf(czLimitEnd, "%f", LimitEnd);
		extrudeBuilder1->Limits()->EndExtend()->Value()->SetRightHandSide(czLimitEnd);

#pragma endregion

#pragma region SetTargetBodies

		extrudeBuilder1->FeatureOptions()->SetBodyType(GeometricUtilities::FeatureOptions::BodyStyleSheet);

		extrudeBuilder1->BooleanOperation()->SetType(GeometricUtilities::BooleanOperation::BooleanTypeCreate);

		std::vector<Body*> targetBodies1(1);
		Body* nullBody(NULL);
		targetBodies1[0] = nullBody;
		extrudeBuilder1->BooleanOperation()->SetTargetBodies(targetBodies1);

#pragma endregion

		/*extrudeBuilder1->Draft()->FrontDraftAngle()->SetRightHandSide("-7");
		extrudeBuilder1->Draft()->BackDraftAngle()->SetRightHandSide("2");
		extrudeBuilder1->Offset()->StartOffset()->SetRightHandSide("0");
		extrudeBuilder1->Offset()->EndOffset()->SetRightHandSide("3");*/

		GeometricUtilities::SmartVolumeProfileBuilder* smartVolumeProfileBuilder1;
		smartVolumeProfileBuilder1 = extrudeBuilder1->SmartVolumeProfile();
		smartVolumeProfileBuilder1->SetOpenProfileSmartVolumeOption(false);
		//smartVolumeProfileBuilder1->SetCloseProfileRule(GeometricUtilities::SmartVolumeProfileBuilder::CloseProfileRuleTypeFci);

#pragma region SetDirection

		Point3d origin1(0.0, 0.0, 0.0);
		Vector3d vector1(dir[0], dir[1], dir[2]);
		Direction* direction1;
		direction1 = workPart->Directions()->CreateDirection(origin1, vector1, SmartObject::UpdateOptionWithinModeling);

		extrudeBuilder1->SetDirection(direction1);

#pragma endregion

		//section1->SetDistanceTolerance(0.001);
		//section1->SetChainingTolerance(0.00095);
		//section1->SetDistanceTolerance(0.05);
		//section1->SetChainingTolerance(0.05-0.005);
		section1->SetDistanceTolerance(0.0254);
		section1->SetChainingTolerance(0.02413);


		section1->SetAllowedEntityTypes(Section::AllowTypesOnlyCurves);

#pragma region AddToSection

		std::vector<IBaseCurve*> curves1;
		for (int i = 0; i < vCurve.size(); i++)
		{
			curve_tag = vCurve[i];
			UF_CALL(UF_OBJ_ask_type_and_subtype(curve_tag, &type, &subtype));

			if (UF_line_type == type)
				curves1.push_back((NXOpen::Line*)NXOpen::NXObjectManager::Get(curve_tag));
			else if (UF_circle_type == type)
				curves1.push_back((NXOpen::Arc*)NXOpen::NXObjectManager::Get(curve_tag));
			else if (UF_spline_type == type)
				curves1.push_back((NXOpen::Spline*)NXOpen::NXObjectManager::Get(curve_tag));
			else if (UF_conic_type == type && UF_conic_ellipse_subtype == subtype)
				curves1.push_back((NXOpen::Ellipse*)NXOpen::NXObjectManager::Get(curve_tag));
			else if (UF_conic_type == type && UF_conic_parabola_subtype == subtype)
				curves1.push_back((NXOpen::Parabola*)NXOpen::NXObjectManager::Get(curve_tag));
			else if (UF_conic_type == type && UF_conic_hyperbola_subtype == subtype)
				curves1.push_back((NXOpen::Hyperbola*)NXOpen::NXObjectManager::Get(curve_tag));
		}

		CurveDumbRule* curveDumbRule1;
		curveDumbRule1 = workPart->ScRuleFactory()->CreateRuleBaseCurveDumb(curves1);

		section1->AllowSelfIntersection(true);

		std::vector<SelectionIntentRule*> rules1;
		rules1.push_back(curveDumbRule1);
		NXObject* nullNXObject(NULL);
		Point3d helpPoint1(0.0, 0.0, 0.0);
		section1->AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1, Section::ModeCreate, false);

#pragma endregion

#pragma region CommitFeature

		extrudeBuilder1->SetParentFeatureInternal(false);

		Features::Feature* feature1;
		feature1 = extrudeBuilder1->CommitFeature();

		if (NULL == feature1)
		{
			uc1601("不能 创建拉伸", 0);
			return 0;
		}

		*tFeature = NULL_TAG;
		if (1 == get_type)
			* tFeature = feature1->Tag();
		else
		{
			UF_MODL_ask_feat_body(feature1->Tag(), tFeature);//2的时候,tFeature为第一个拉伸体,Featurebodys存着所有拉伸体

			std::vector<Body*> test = dynamic_cast<Features::BodyFeature*>(feature1)->GetBodies();
			size_t iCount(test.size());
			Featurebodys.clear();
			for (size_t i(0); i < iCount; ++i)
			{
				Featurebodys.push_back(ask_obj_tag(test[i]));
			}
		}

		extrudeBuilder1->Destroy();

		if (NULL_TAG == *tFeature)
		{
			uc1601("不能 创建拉伸", 0);
			return 0;
		}

#pragma endregion

		return 1;
	}
	catch (exception& ex)
	{
		UF_CALL(UF_UNDO_undo_to_mark(mark_id, NULL));
		return 0;
	}
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
毕业设计,基于SpringBoot+Vue+MySQL开发的影城管理系统,源码+数据库+论文答辩+毕业论文+视频演示 随着现在网络的快速发展,网上管理系统也逐渐快速发展起来,网上管理模式很快融入到了许多生活之中,随之就产生了“小徐影城管理系统”,这样就让小徐影城管理系统更加方便简单。 对于本小徐影城管理系统的设计来说,系统开发主要是采用java语言技术,在整个系统的设计中应用MySQL数据库来完成数据存储,具体根据小徐影城管理系统的现状来进行开发的,具体根据现实的需求来实现小徐影城管理系统网络化的管理,各类信息有序地进行存储,进入小徐影城管理系统页面之后,方可开始操作主控界面,主要功能包括管理员:首页、个人中心、用户管理、电影类型管理、放映厅管理、电影信息管理、购票统计管理、系统管理、订单管理,用户前台;首页、电影信息、电影资讯、个人中心、后台管理、在线客服等功能。 本论文主要讲述了小徐影城管理系统开发背景,该系统它主要是对需求分析和功能需求做了介绍,并且对系统做了详细的测试和总结。具体从业务流程、数据库设计和系统结构等多方面的问题。望能利用先进的计算机技术和网络技术来改变目前的小徐影城管理系统状况,提高管理效率。 关键词:小徐影城管理系统;Spring Boot框架,MySQL数据库
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

社恐猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值