admin 发表于 2014-12-18 16:45:22

NX二次开发源码分享:NXOpen C++获取当前加工模版和所有设置

NX二次开发源码分享:NXOpen C++获取当前模版和所有设置


void createCAMTool::do_it()
{


      // TODO: add your code here
      std::vector<NXString> types = theSession->CAMSession()->GetTemplateTypes();
      for(int i = 0 ; i < types.size();i++)
      {
                print("Types:"+ types+"\n");
                std::vector<NXString> ObjectSubtypeGeometrysubtypes = theSession->CAMSession()->GetTemplateSubtypes(types,NXOpen::CAM::CAMSession::ObjectSubtypeGeometry);
                print("\t----ObjectSubtypeGeometry-------");
                for(int ii = 0 ; ii < ObjectSubtypeGeometrysubtypes.size();ii++)
                {
                        print(ObjectSubtypeGeometrysubtypes);
                }
                std::vector<NXString> ObjectSubtypeMethodsubtypes = theSession->CAMSession()->GetTemplateSubtypes(types,NXOpen::CAM::CAMSession::ObjectSubtypeMethod);
                print("\t----ObjectSubtypeMethod-------");
                for(int ii = 0 ; ii < ObjectSubtypeMethodsubtypes.size();ii++)
                {
                        print(ObjectSubtypeMethodsubtypes);
                }
                std::vector<NXString> ObjectSubtypeOperationsubtypes = theSession->CAMSession()->GetTemplateSubtypes(types,NXOpen::CAM::CAMSession::ObjectSubtypeOperation);
                print("\t----ObjectSubtypeOperation-------");
                for(int ii = 0 ; ii < ObjectSubtypeOperationsubtypes.size();ii++)
                {
                        print(ObjectSubtypeOperationsubtypes);
                }
                std::vector<NXString> ObjectSubtypeProgramsubtypes = theSession->CAMSession()->GetTemplateSubtypes(types,NXOpen::CAM::CAMSession::ObjectSubtypeProgram);
                print("\t----ObjectSubtypeProgram-------");
                for(int ii = 0 ; ii < ObjectSubtypeProgramsubtypes.size();ii++)
                {
                        print(ObjectSubtypeProgramsubtypes);
                }
                std::vector<NXString> ObjectSubtypeSetupsubtypes = theSession->CAMSession()->GetTemplateSubtypes(types,NXOpen::CAM::CAMSession::ObjectSubtypeSetup);
                print("\t----ObjectSubtypeSetup-------");
                for(int ii = 0 ; ii < ObjectSubtypeSetupsubtypes.size();ii++)
                {
                        print(ObjectSubtypeSetupsubtypes);
                }
                std::vector<NXString> ObjectSubtypeToolsubtypes = theSession->CAMSession()->GetTemplateSubtypes(types,NXOpen::CAM::CAMSession::ObjectSubtypeTool);
                print("\t----ObjectSubtypeTool-------");
                for(int ii = 0 ; ii < ObjectSubtypeToolsubtypes.size();ii++)
                {
                        print(ObjectSubtypeToolsubtypes);
                }
}



结果如下:


Types:mill_planar
      ----ObjectSubtypeGeometry-------
MCS
WORKPIECE
MILL_AREA
MILL_BND
MILL_TEXT
HOLE_BOSS_GEOM
MILL_GEOM
      ----ObjectSubtypeMethod-------
MILL_METHOD
      ----ObjectSubtypeOperation-------
FLOOR_WALL
FLOOR_WALL_IPW
FACE_MILLING
FACE_MILLING_MANUAL
PLANAR_MILL
PLANAR_PROFILE
CLEANUP_CORNERS
FINISH_WALLS
FINISH_FLOOR
GROOVE_MILLING
HOLE_MILLING
THREAD_MILLING
PLANAR_TEXT
MILL_CONTROL
MILL_USER
      ----ObjectSubtypeProgram-------
PROGRAM
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
MILL
CHAMFER_MILL
BALL_MILL
SPHERICAL_MILL
T_CUTTER
BARREL
THREAD_MILL
MILL_USER_DEFINED
CARRIER
MCT_POCKET
HEAD
Types:mill_contour
      ----ObjectSubtypeGeometry-------
MCS
WORKPIECE
MILL_AREA
MILL_BND
MILL_TEXT
MILL_GEOM
      ----ObjectSubtypeMethod-------
MILL_METHOD
MOLD_ROUGH_HSM
MOLD_SEMI_FINISH_HSM
MOLD_FINISH_HSM
      ----ObjectSubtypeOperation-------
CAVITY_MILL
PLUNGE_MILLING
CORNER_ROUGH
REST_MILLING
ZLEVEL_PROFILE
ZLEVEL_CORNER
FIXED_CONTOUR
CONTOUR_AREA
CONTOUR_SURFACE_AREA
STREAMLINE
CONTOUR_AREA_NON_STEEP
CONTOUR_AREA_DIR_STEEP
FLOWCUT_SINGLE
FLOWCUT_MULTIPLE
FLOWCUT_REF_TOOL
SOLID_PROFILE_3D
PROFILE_3D
CONTOUR_TEXT
MILL_USER
MILL_CONTROL
      ----ObjectSubtypeProgram-------
PROGRAM
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
MILL
CHAMFER_MILL
BALL_MILL
SPHERICAL_MILL
BARREL
T_CUTTER
CARRIER
MCT_POCKET
HEAD
Types:mill_multi-axis
      ----ObjectSubtypeGeometry-------
MCS
WORKPIECE
MILL_AREA
MILL_BND
MILL_GEOM
      ----ObjectSubtypeMethod-------
MILL_METHOD
      ----ObjectSubtypeOperation-------
VARIABLE_CONTOUR
VARIABLE_STREAMLINE
CONTOUR_PROFILE
FIXED_CONTOUR
ZLEVEL_5AXIS
SEQUENTIAL_MILL
GENERIC_MOTION
MILL_USER
MILL_CONTROL
      ----ObjectSubtypeProgram-------
PROGRAM
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
MILL
CHAMFER_MILL
BALL_MILL
SPHERICAL_MILL
MILL_7_PARAMETER
MILL_10_PARAMETER
BARREL
T_CUTTER
CARRIER
MCT_POCKET
HEAD
Types:mill_multi_blade
      ----ObjectSubtypeGeometry-------
MCS
WORKPIECE
MULTI_BLADE_GEOM
      ----ObjectSubtypeMethod-------
MULTI_BLADE_FINISH
MILL_METHOD
      ----ObjectSubtypeOperation-------
MULTI_BLADE_ROUGH
HUB_FINISH
BLADE_FINISH
BLEND_FINISH
GENERIC_MOTION
MILL_USER
MILL_CONTROL
      ----ObjectSubtypeProgram-------
PROGRAM
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
MILL
CHAMFER_MILL
BALL_MILL
SPHERICAL_MILL
MILL_7_PARAMETER
MILL_10_PARAMETER
BARREL
T_CUTTER
CARRIER
MCT_POCKET
HEAD
Types:mill_rotary
      ----ObjectSubtypeGeometry-------
MCS
WORKPIECE
ROTARY_GEOM
      ----ObjectSubtypeMethod-------
MILL_METHOD
      ----ObjectSubtypeOperation-------
ROTARY_FLOOR
GENERIC_MOTION
MILL_USER
MILL_CONTROL
      ----ObjectSubtypeProgram-------
PROGRAM
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
BALL_MILL
SPHERICAL_MILL
CARRIER
MCT_POCKET
Types:hole_making
      ----ObjectSubtypeGeometry-------
MCS
WORKPIECE
MILL_AREA
FBM_GEOM
SIMPLE_HOLE
CB_HOLE
CS_HOLE
THD_SIMPLE_HOLE
THD_CB_HOLE
THD_CS_HOLE
SYMBOLIC_THREAD
CAP_SCREW_CB
CAP_SCREW_CS
FIT_HOLE
STANDARD_THREAD
ALL_FEATURES
HOLE_BOSS_GEOM
      ----ObjectSubtypeMethod-------
DRILL_METHOD
HOLE_MILL_METHOD
      ----ObjectSubtypeOperation-------
SPOT_DRILLING
DRILLING
COUNTERSINKING
TAPPING
HOLE_MILLING
HOLE_CHAMFER_MILLING
BOSS_MILLING
THREAD_MILLING
BOSS_THREAD_MILLING
MILL_CONTROL
HOLE_MAKING
HOLE_MILL
      ----ObjectSubtypeProgram-------
PROGRAM
OPTIMIZED_NC
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
STD_DRILL
CENTERDRILL
COUNTER_SINK
SPOT_DRILL
BORE
REAMER
STEP_DRILL
CORE_DRILL
COUNTER_BORE
TAP
THREAD_MILL
SPOT_FACING
CHAMFER_MILL
MILL
CARRIER
MCT_POCKET
HEAD
Types:drill
      ----ObjectSubtypeGeometry-------
MCS
WORKPIECE
DRILL_GEOM
HOLE_BOSS_GEOM
      ----ObjectSubtypeMethod-------
DRILL_METHOD
      ----ObjectSubtypeOperation-------
SPOT_FACING
SPOT_DRILLING
DRILLING
PECK_DRILLING
BREAKCHIP_DRILLING
BORING
REAMING
COUNTERBORING
COUNTERSINKING
TAPPING
HOLE_MILLING
THREAD_MILLING
MILL_CONTROL
MILL_USER
      ----ObjectSubtypeProgram-------
PROGRAM
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
SPOTFACING_TOOL
SPOTDRILLING_TOOL
DRILLING_TOOL
BORING_BAR
REAMER
COUNTERBORING_TOOL
COUNTERSINKING_TOOL
TAP
THREAD_MILL
CARRIER
MCT_POCKET
HEAD
Types:turning
      ----ObjectSubtypeGeometry-------
MCS_SPINDLE
WORKPIECE
TURNING_WORKPIECE
TURNING_PART
CONTAINMENT
AVOIDANCE
      ----ObjectSubtypeMethod-------
LATHE_METHOD
      ----ObjectSubtypeOperation-------
CENTERLINE_SPOTDRILL
CENTERLINE_DRILLING
CENTERLINE_PECKDRILL
CENTERLINE_BREAKCHIP
CENTERLINE_REAMING
CENTERLINE_TAPPING
FACING
ROUGH_TURN_OD
ROUGH_BACK_TURN
ROUGH_BORE_ID
ROUGH_BACK_BORE
FINISH_TURN_OD
FINISH_BORE_ID
FINISH_BACK_BORE
TEACH_MODE
GROOVE_OD
GROOVE_ID
GROOVE_FACE
THREAD_OD
THREAD_ID
PARTOFF
LATHE_CONTROL
LATHE_USER
      ----ObjectSubtypeProgram-------
PROGRAM
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
SPOTDRILLING_TOOL
DRILLING_TOOL
OD_80_L
OD_80_R
OD_55_L
OD_55_R
ID_80_L
ID_55_L
BACKBORE_55_L
OD_GROOVE_L
FACE_GROOVE_L
ID_GROOVE_L
OD_THREAD_L
ID_THREAD_L
FORM_TOOL
CARRIER
MCT_POCKET
Types:wire_edm
      ----ObjectSubtypeGeometry-------
MCS_WEDM
WORKPIECE
SEQUENCE_INTERNAL_TRIM
SEQUENCE_EXTERNAL_TRIM
WEDM_GEOM
      ----ObjectSubtypeMethod-------
WEDM_METHOD
      ----ObjectSubtypeOperation-------
NOCORE
EXTERNAL_TRIM
INTERNAL_TRIM
OPEN_PROFILE
WEDM_CONTROL
WEDM_USER
      ----ObjectSubtypeProgram-------
PROGRAM
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
WIRE
Types:probing
      ----ObjectSubtypeGeometry-------
MCS_MILL
WORKPIECE
      ----ObjectSubtypeMethod-------
MILL_METHOD
LATHE_METHOD
      ----ObjectSubtypeOperation-------
MILL_PART_PROBING
TURN_PART_PROBING
MILL_TOOL_PROBING
TURN_TOOL_PROBING
GENERIC_MOTION
      ----ObjectSubtypeProgram-------
PROGRAM
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
PROBE
GENERIC
Types:solid_tool
      ----ObjectSubtypeGeometry-------
      ----ObjectSubtypeMethod-------
      ----ObjectSubtypeOperation-------
      ----ObjectSubtypeProgram-------
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
GENERIC
PROBE
Types:machining_knowledge
      ----ObjectSubtypeGeometry-------
MCS
WORKPIECE
MILL_AREA
PROCESS_FEATURES
      ----ObjectSubtypeMethod-------
PRE_DRILL_METHOD
DEBURRING_METHOD
CSINK_THD_METHOD
TAP_METHOD
STEP_DRILL_METHOD
THREAD_MILL_METHOD
MILL_CB_METHOD
BREAKCHIP_DRILL_METHOD
BORE_METHOD
CENTER_DRILL_METHOD
CORE_DRILL_METHOD
CBORE_METHOD
CSINK_METHOD
DRILL_METHOD
PECK_DRILL_METHOD
REAMING_METHOD
SPOT_DRILL_METHOD
TAPPING_METHOD
HOLE_MILL_METHOD
MILL_METHOD_ROUGH
      ----ObjectSubtypeOperation-------
HOLE_MAKING
HOLE_MAKING_DRILL_TEXT
HOLE_MAKING_DRILL_DEEP
HOLE_MAKING_DRILL_BORE_DRAG
HOLE_MAKING_DRILL_BORE_NODRAG
HOLE_MAKING_DRILL_BORE_BACK
HOLE_MAKING_DRILL_BORE_MANUAL
SPOT_DRILLING
DRILLING
PECK_DRILLING
BREAKCHIP_DRILLING
COUNTERBORING
COUNTERSINKING
REAMING
BORING
HOLE_MILL
FLOOR_WALL
FACE_MILLING
CAVITY_MILL
TAPPING
      ----ObjectSubtypeProgram-------
PROGRAM
      ----ObjectSubtypeSetup-------
      ----ObjectSubtypeTool-------
CARRIER
MCT_POCKET
HEAD



页: [1]
查看完整版本: NX二次开发源码分享:NXOpen C++获取当前加工模版和所有设置