/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ #include <ProToolkit.h> #include <ProGraphic.h> #include <ProLayer.h> #include <ProObjects.h> #include <ProSelection.h> #include <ProMenu.h> #include <TestError.h> /*==========================================================================*\ Utility to report a selected menu action \*==========================================================================*/ int UserLayerAction (ProAppData dummy, int action) { ProMenuDeleteWithStatus(action); } /*==========================================================================*\ Utility to ask the user to select an element type for blanking \*==========================================================================*/ int UserBlankTypeChoose() { int menu_id; int action; ProError err; err=ProMenuFileRegister("ublank6","ublank6.mnu",&menu_id); ERROR_CHECK("UserSelectBlankType","ProMenuFileRegister",err); err=ProMenubuttonActionSet("ublank6","Part", UserLayerAction,NULL,PRO_PART); ERROR_CHECK("UserSelectBlankType","ProMenubuttonActionSet(Part)",err); err=ProMenubuttonActionSet("ublank6","Feature", UserLayerAction,NULL,PRO_FEATURE); ERROR_CHECK("UserSelectBlankType","ProMenubuttonActionSet(Feature)",err); err=ProMenubuttonActionSet("ublank6","Curve", UserLayerAction,NULL,PRO_CURVE); ERROR_CHECK("UserSelectBlankType","ProMenubuttonActionSet(Curve)",err); err=ProMenubuttonActionSet("ublank6","Quilt", UserLayerAction,NULL,PRO_QUILT); ERROR_CHECK("UserSelectBlankType","ProMenubuttonActionSet(Quilt)",err); err=ProMenubuttonActionSet("ublank6","Point", UserLayerAction,NULL,PRO_POINT); ERROR_CHECK("UserSelectBlankType","ProMenubuttonActionSet(Point)",err); err=ProMenubuttonActionSet("ublank6","ublank6", UserLayerAction,NULL,-1); ERROR_CHECK("UserSelectBlankType","ProMenubuttonActionSet(ublank)",err); ProMenuCreate(PROMENUTYPE_MAIN,"ublank6",&menu_id); ProMenuProcess("",&action); return(action); } /*=========================================================================*\ Function to add selected items to a layer called "blank" \*==========================================================================*/ int UserBlank() { ProLayer layer; ProLayerItem layer_item; ProMdl object, member; ProSelection *sel; ProModelitem model_item; int type; int nsel; int m; char *option; ProError err; /* PHILIPPE : The Layer examples have to be changed for rev 20 Until then, I make it unavailable */ return (PRO_TK_NO_ERROR); #if 0 /*-------------------------------------------------------------------------*\ Get handle for the active model. \*-------------------------------------------------------------------------*/ err=ProMdlCurrentGet(&object); ERROR_CHECK("UserBlank","ProMdlCurrentGet",err); /*-------------------------------------------------------------------------*\ Load model and name ("blank") information into layer struct. \*-------------------------------------------------------------------------*/ layer.owner=object; ProStringToWstring(layer.layer_name,"blank"); /*-------------------------------------------------------------------------*\ Create a layer \*-------------------------------------------------------------------------*/ err=ProLayerCreate(&layer); ERROR_CHECK("UserBlank","ProLayerCreate",err); /*--------------------------------------------------------------------------*\ Choose the type of element to be selected. \*--------------------------------------------------------------------------*/ type = UserBlankTypeChoose(); if (type < 0) return(0); layer_item.type=type; /*-------------------------------------------------------------------------*\ Set the ProSelect() option accordingly. \*-------------------------------------------------------------------------*/ switch (type) { case PRO_PART : option = "part" ; break; case PRO_FEATURE : option = "feature" ; break; case PRO_CURVE : option = "curve" ; break; case PRO_QUILT : option = "dtmqlt" ; break; case PRO_POINT : option = "point" ; break; } while ( ProSelect(option,1,NULL,NULL,NULL,NULL,&sel,&nsel)==PRO_TK_NO_ERROR && nsel>0 ) { err=ProSelectionModelitemGet(sel[0],&model_item); ERROR_CHECK("UserBlank","ProSelectionModelitemGet",err); layer_item.id = model_item.id; err=ProLayerItemAdd(&layer,&layer_item); ERROR_CHECK("UserBlank","ProLayerItemAdd",err); ProWindowRepaint(-1); } return(0); #endif }