本系列文章主要讲解NXOpen UF API(简称ufun函数)的使用,之前看教学视频大都建议用ufun进行开发,这里西门子官方还专门给了一套系列文章来讲,说明官方也是特别推崇ufun。
本人从事二开也有一段时间了,我的二开启蒙师父就特别喜欢用NXOpen API,用他的话来说“年少不知nxopen好,错把ufun当成宝”,其实就我个人而言,还是喜欢NXOPEN+ufun联合开发。
本实例完成了切面模型与实体分离的实现,具体知识点如下:
1、创建块 theUfSession.Modl.CreateBlock1
2、生成切面模型 theUfSession.Facet.FacetSolid
3、倒斜角 theUfSession.Modl.CreateBlend
4、切面模型与关联实体分离 theUfSession.Facet.DisassocFromSolid
1、生成块
2、生成切面模型
3、处理切面模型
4、分离切面模型
UGOPEN\SampleNXOpenApplications\.NET\NXOpenExamples\EX_Facet
1、生成块
Tag block_feature_tag;
string[] edge_lengths = { "10", "30", "40" };
corner_point[0] = 0.0;
corner_point[1] = 0.0;
corner_point[2] = 0.0;
theUfSession.Modl.CreateBlock1(FeatureSigns.Nullsign, corner_point, edge_lengths, out block_feature_tag );
2、 生成切面模型
Tag faceted_model;
UFInitParams(ref faceting_params);
theUfSession.Facet.AskDefaultParameters(out faceting_params) ;
theUfSession.Facet.FacetSolid(block_tag, ref faceting_params, out faceted_model );
3、 处理切面模型,倒斜角
theUfSession.Facet.AskSolidOfModel(faceted_model, out tag_of_solid );
theUfSession.Facet.AskModelsOfSolid(block_tag,out n_facet_models, out facet_models);
theUfSession.Modl.AskBodyEdges(block_tag, out edge_list);
theUfSession.Modl.CreateBlend("2.0", edge_list,0, 0, 0, 0.0,out blend_feature);
4、 分离切面模型
theUfSession.Modl.Update();
theUfSession.Facet.IsModelUpToDate(faceted_model,out up_to_date);
theUfSession.Facet.AskModelParameters(faceted_model, out faceting_params);
faceting_params.max_facet_edges = 4;
theUfSession.Facet.UpdateModel(faceted_model, ref faceting_params);
theUfSession.Facet.IsModelUpToDate(faceted_model, out up_to_date);
theUfSession.Facet.DisassocFromSolid(faceted_model);
new_faceted_model = faceted_model;
这里做切面模型分离,暂时还不知道有什么用,后面有用上的时候,再补充完整~