你好,欢迎来到UG二次开发专业技术交流论坛! 会员登录 | 快速注册 | 忘记密码?
UG二次开发最新技术资料
  • 关于录制操作记录

    发布者:zzzjj234 查看次数:38 评论条数:0 发布时间:2018-5-20
    想请教下各路大神,UG8.5用C++录制操作记录对CAM程序进行添加切屑区域,生成的代码怎么改才能自己选择CAM程序,录制的代码直接固定你录制的那条程序,求大神帮忙解答下
  • 怎么让圆柱函数里的char*后的参数变为控件里用户输入的值double类型

    发布者:tt526778665 查看次数:77 评论条数:2 发布时间:2018-5-15
    /设置控件值double012->GetProperties()->SetDouble("value",true);expression0->GetProperties()->SetDouble("value",true);double021->GetProperties()->SetDouble("value",true);double031->GetProperties()->SetDouble("value",true);//获得控件值doubleL  =double012->value();doubled  =expression0->value();doubled1=double021->value();doublel0=double031->value();doublepoint[3]; doubledirection[3]; tag_t  dplane_tag; point[0]=0.0;//参考点 point[1]=0.0; point[2]=0.0; direction[0]=1.0;//法矢方向 direction[1]=0.0; direction[2]=0.0; UF_MODL_create_fixed_dplane(point,direction,&dplane_tag);//生成固定基准面 UF_FEATURE_SIGNsign=UF_NULLSIGN; doubleorigin[3]; char  *height="50";//变为height=d这样 char  *diam="10";   doubledirection_cyl[3]; tag_t  cyl_tag1; origin[0]=0.0;//圆柱基准点 origin[1]=0.0; origin[2]=0.0; direction_cyl[0]=0.0;//圆柱方向 direction_cyl[1]=0.0; direction_cyl[2]=1.0; UF_MODL_create_cyl1(sign,origin,height,diam,direction_cyl,&cyl_tag1);//生成第一个圆柱
  • 如何判斷點在實體的哪個面上

    发布者:leeweitsang 查看次数:78 评论条数:2 发布时间:2018-5-9
    各位好,    請教如何快速判斷空間中的某一點在實體的哪個面上?    目前用的方式為,量測點到實體的每個面的距離,當與某面距離為0時即判斷為在該面上。但目前遇到的問題是,若點和實體面的數量極多,則在整個運算上花費非常多的時間。    以上,謝謝。
  • 点击查看GRIP全套视频教程
  • GRX文件做成图标菜单的问题

    发布者:小小de火柴人 查看次数:85 评论条数:2 发布时间:2018-5-6
    我按照GRIP视频教程将bmp、grx、tbr放在了一个文件夹下,还修改了custom_dirs.dat,但是我在加载工具条文件时却没有我的trb文件
  • 得到CAM所有的后处理,并打印输出后处理的名字

    发布者:nxopen 查看次数:105 评论条数:1 发布时间:2018-5-5
    //得到CAM所有的后处理,并打印输出后处理的名字int  post_count;//得到的后处理的数量constchar**post_names;//得到的后处理名称数组for(inti=0;i<post_count;i++){ u->print(post_names[i]);}if(post_count>0)UF_free_string_array(post_count,(char**)post_names);//释放内存
  • UG二次开发NXOpen c++导出STP程序代码

    发布者:nxopen 查看次数:124 评论条数:0 发布时间:2018-5-5
    //UG二次开发NXOpen导出STP程序代码//需要的头文件#include<uf_defs.h>#include<NXOpen/NXException.hxx>#include<NXOpen/Session.hxx>#include<NXOpen/Builder.hxx>#include<NXOpen/DexManager.hxx>#include<NXOpen/NXObject.hxx>#include<NXOpen/ObjectSelector.hxx>#include<NXOpen/ObjectTypeSelector.hxx>#include<NXOpen/Part.hxx>#include<NXOpen/PartCollection.hxx>#include<NXOpen/SelectNXObjectList.hxx>#include<NXOpen/Session.hxx>#include<NXOpen/Step214Creator.hxx>//C++程序代码Step214Creator*step214Creator1;step214Creator1=theSession->DexManager()->CreateStep214Creator();//设置要被导出的PRTstep214Creator1->SetInputFile("E:\\NXdata\\UGpart\\NX7.5\\constrainTemp3\\assmRoot.prt");//设置导出的位置和文件名step214Creator1->SetOutputFile("E:\\test\\4\\assmRoot.stp");step214Creator1->ObjectTypes()->SetCurves(true);step214Creator1->ObjectTypes()->SetSurfaces(true);step214Creator1->ObjectTypes()->SetSolids(true);step214Creator1->ObjectTypes()->SetCsys(true);step214Creator1->ObjectTypes()->SetProductData(true);step214Creator1->SetValidationProperties(true);step214Creator1->SetValidationProperties(false);step214Creator1->SetFileSaveFlag(false);step214Creator1->SetLayerMask("1-256");NXObject*nXObject1;nXObject1=step214Creator1->Commit();step214Creator1->Destroy();
  • NXOpen创建中心约束(2对2)函数,可直接传入参数创建约束

    发布者:nxopen 查看次数:95 评论条数:0 发布时间:2018-5-2
    //创建中心约束(2对2)intConstraintCreate_UGAPI_COM::ConstraintCreateAPI::Create_center22_contraint(tag_tobjectTags[4],boolfixHits[4],Point3dhelpPoint[4],tag_p_tconstraintTag){ tag_t  compTag=NULL_TAG; logicalisOcc=NULL_TAG; *constraintTag=NULL_TAG; Session*theSession=Session::GetSession(); Part*workPart(theSession->Parts()->Work()); Part*displayPart(theSession->Parts()->Display()); Positioning::ComponentPositioner*componentPositioner1; componentPositioner1=workPart->ComponentAssembly()->Positioner(); componentPositioner1->ClearNetwork(); componentPositioner1->BeginAssemblyConstraints(); boolallowInterpartPositioning1; allowInterpartPositioning1=theSession->Preferences()->Assemblies()->InterpartPositioning(); Positioning::Network*network1; network1=componentPositioner1->EstablishNetwork(); Positioning::ComponentNetwork*componentNetwork1(dynamic_cast<Positioning::ComponentNetwork*>(network1)); componentNetwork1->SetMoveObjectsState(true); Assemblies::Component*nullAssemblies_Component(NULL); componentNetwork1->SetDisplayComponent(nullAssemblies_Component); componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting); Positioning::Constraint*constraint1; constraint1=componentPositioner1->CreateConstraint(); Positioning::ComponentConstraint*componentConstraint1(dynamic_cast<Positioning::ComponentConstraint*>(constraint1)); componentConstraint1->SetConstraintType(Positioning::Constraint::TypeCenter22); componentConstraint1->ReverseDirection(); componentNetwork1->Solve(); componentNetwork1->ResetDisplay(); componentNetwork1->ApplyToModel(); theSession->UpdateManager()->AddToDeleteList(componentNetwork1); componentPositioner1->ClearNetwork();   componentPositioner1->DeleteNonPersistentConstraints(); Assemblies::Arrangement*nullAssemblies_Arrangement(NULL); componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement); componentPositioner1->EndAssemblyConstraints(); //获取约束标识符 *constraintTag=componentConstraint1->GetTag(); return(0);}
  • 点击查看VIP会员特权
  • NXOpen装配中获得每个Component相关对应的约束

    发布者:nxopen 查看次数:102 评论条数:0 发布时间:2018-5-1
    //获得每个Component相关对应的约束,获得数据保存到map中,tag_t为组件的TAG,vector为组件对应的约束TAGvoidGetComCorresConstraints(map<tag_t,vector<tag_t>>&pComConstraints){ vector<Positioning::DisplayedConstraint*>displayedallConstraints=GetDisplayedallConstraints();//显示部件的显示约束 for(inta=0;a<displayedallConstraints.size();a++) { Positioning::Constraint*iConstraint=displayedallConstraints[a]->GetConstraint(); vector<NXOpen::Positioning::ConstraintReference*>iConstraintReference=iConstraint->GetReferences(); //获得约束参考 for(intb=0;b<iConstraintReference.size();b++) { NXOpen::NXObject*pMovableObject=NULL; pMovableObject= iConstraintReference[b]->GetMovableObject(); if(pMovableObject!=NULL) { map<tag_t,vector<tag_t>>::iteratoriter=pComConstraints.find(pMovableObject->Tag()); if(iter==pComConstraints.end()) { } else { if(iter->second.end()==std::find(iter->second.begin(),iter->second.end(),iConstraint->Tag())) { iter->second.push_back(iConstraint->Tag()); } } } } }}
  • 递归方式获得装配下指定节点下的所有子组件Component

    发布者:nxopen 查看次数:98 评论条数:0 发布时间:2018-5-1
    比如你要获得组件所有的装配节点,可以从根节点进行遍历,如果你只想获得你指定节点下面的子组件,传入的第一个参数就传入你指定的节点Component即可。例:获得根节点下的所有子组件(及装配全部子组件,用NXOpen方式)//获得根节点Assemblies::Component*rootComponent=theSession->Parts()->Display()->ComponentAssembly()->RootComponent();vector<Assemblies::Component*>pComponents;GetAppointComponents(rootComponent,pComponents);//获得根节点下所有组件//-------以下为递归函数------//获得指定节点下的所有组件函数(采用递归方式)voidGetAppointComponents(Assemblies::Component*component,vector<Assemblies::Component*>&pComponents){                  for(inti=0;i<childComponent.size();i++)        {                pComponents.push_back(childComponent);                GetAppointComponents(childComponent,  pComponents);        }}
  • Assemblies::Component 将组件向上提升一级函数,传入一个组件Component,即可返回提升后的Component

    发布者:nxopen 查看次数:130 评论条数:0 发布时间:2018-4-17
    //将组件提升一级Assemblies::Component*tempCS::PromptComponentLevel(Assemblies::Component*origComponent){Assemblies::Component*newComponent=NULL;Assemblies::Component*pParComponent=NULL;pParComponent=origComponent->Parent();//获得父项if(pParComponent!=NULL){  Part*workPart(theSession->Parts()->Work());  pParComponent=pParComponent->Parent();//再次获得父项  if(newComponents.size()==1)newComponent=newComponents[0];}returnnewComponent;}
  • NXOpen C++ 创建约束功能代码

    发布者:nxopen 查看次数:116 评论条数:0 发布时间:2018-4-17
    Part*workPart(theSession->Parts()->Work());Part*displayPart(theSession->Parts()->Display());Assemblies::Arrangement*arrangement1=workPart->ComponentAssembly()->ActiveArrangement();//获得当前活的ArrangementPositioning::ComponentPositioner*componentPositioner1=workPart->ComponentAssembly()->Positioner();componentPositioner1->ClearNetwork();componentPositioner1->SetPrimaryArrangement(arrangement1);//设置主安排componentPositioner1->BeginAssemblyConstraints();//开始装配约束//boolallowInterpartPositioning1=theSession->Preferences()->Assemblies()->InterpartPositioning();  //获取是否允许跨零件定位Positioning::Network*network1=componentPositioner1->EstablishNetwork();Positioning::ComponentNetwork*componentNetwork1(dynamic_cast<Positioning::ComponentNetwork*>(network1));Assemblies::Component*nullAssemblies_Component(NULL);componentNetwork1->SetDisplayComponent(nullAssemblies_Component);componentNetwork1->SetNetworkArrangementsMode(Positioning::ComponentNetwork::ArrangementsModeExisting);//设置安排模式安排现有模式componentNetwork1->SetMoveObjectsState(true);//设置移动对象状态,在约束创建或编辑设置时,对象的显示位置立即更新Positioning::ConstraintReference*constraintReference1=componentConstraint1->CreateConstraintReference(component1,geometryObject1,false,false,false);//Point3dhelpPoint1(0.0,0.0,0.0);//constraintReference1->SetHelpPoint(helpPoint1);//设置帮助点Positioning::ConstraintReference*constraintReference2=componentConstraint1->CreateConstraintReference(component2,geometryObject2,false,false,false);//Point3dhelpPoint2(0.0,0.0,0.0);//constraintReference2->SetHelpPoint(helpPoint2);constraintReference2->SetFixHint(true);componentNetwork1->Solve();componentPositioner1->ClearNetwork();componentPositioner1->DeleteNonPersistentConstraints();Assemblies::Arrangement*nullAssemblies_Arrangement(NULL);componentPositioner1->SetPrimaryArrangement(nullAssemblies_Arrangement);componentPositioner1->EndAssemblyConstraints();//终止装配约束
  • 点击查看SNAP技术资料
  • 【求助 】删除当前窗口所有 点 、线、面 ?

    发布者:apple88 查看次数:134 评论条数:0 发布时间:2018-4-13
    删除当前窗口所有点、线、面的代码怎么写??谢谢@+@
  • 请教下各路大神关于CAM加工程序问题

    发布者:zzzjj234 查看次数:175 评论条数:3 发布时间:2018-4-13
    请问NXOPEN添加加工程序的切削区域或底面是哪个API函数呢?知道的大神们麻烦告诉下小弟
  • 我的学习

    发布者:xiangzanyang 查看次数:112 评论条数:1 发布时间:2018-4-10
    我在学习SNAP,做了个小程序!
  • 求助!ug分析里面偏差度量功能怎么样显示参考对象曲线上对应点的坐标值?

    发布者:心语拼搏 查看次数:131 评论条数:0 发布时间:2018-4-1
    请问:利用ug分析里面偏差度量功能,信息里面默认显示出了对象曲线的坐标,那怎么样才能把对应的参考曲线上的坐标也显示出来呢?感谢
NX二次开发热门资料
点击查看VIP会员特权
技术帖子评论排行
最新评论技术帖子