admin 发表于 2014-9-21 08:49:47

UG NX二次开发源码分享:选择草图对象并返回草图


UG NX二次开发源码分享:选择草图对象并返回草图


NXOpen::Sketch* SelectSketch()
{       
       
        UI *theUI = UI::GetUI();

        NXOpen::Selection::SelectionScope scope = Selection::SelectionScopeWorkPart;
        NXOpen::Selection::SelectionAction action = Selection::SelectionActionClearAndEnableSpecific;
        std::vector<NXOpen::Selection::MaskTriple>selectionMask_array(1);
        selectionMask_array.Type = UF_sketch_type;
        selectionMask_array.Subtype = 0;
        selectionMask_array.SolidBodySubtype = 0;
        NXOpen::TaggedObject *selectedObject = NULL;
        Point3d cursor;
        cursor.X = 0.0;
        cursor.Y = 0.0;
        cursor.Z = 0.0;

        theUI->SelectionManager()->SelectTaggedObject("Select Sketch","Sketch Selection",scope,action,true,false,selectionMask_array,&selectedObject,&cursor);

        Sketch *sketch1(dynamic_cast<Sketch *>(selectedObject));
        if(sketch1==NULL)
        {
                return NULL;
        }

        return sketch1;       

}

页: [1]
查看完整版本: UG NX二次开发源码分享:选择草图对象并返回草图