Kubotek Forum

KeyCreator CAD & CKD Viewer Technical discussion of CAD/CAM and integrated partner products
Subscribe to post
User avatar
Soli - (4/27/2021 5:15:09 AM)
Entity name for fasteners
This utility selects all fasteners in the model and saves the entity name and standard properties name for each fastener.
Works with KeyCreator 2020 and 2021 only.

---------------------------------------------------------------------- 
CLEAR nNumSel
INT nNumSel
maskentity 35
  // This will invoke the Universal Selection Menu
  
 
GenSel "Select solids to be analized...",  nNumSel, 0, 1, 0, 0, 1, 0
  if (@error != 0)
      EXIT
  CLEAR aGenSelEnts
  //Populate variable with the entities just selected
 
//copy selected entities to aGenSelEnts
GETSELECTED aGenSelEnts
 
clear $message
string $message
 
sprint $message , "NUMBER OF SELECTED ENTITIES = %d\nCONTINUE?" , nNumSel 
 
Int  nType = 4
MessageBox $message,  nType 
if (@error == 7)
goto end
 
clear number
int number
number=0
:loop
 
clear hEnt 
HENTITY hEnt 
HCopy  hEnt , aGenSelEnts[number]
 
clear hLev 
HLEVEL hlev
ENTLEVEL hEnt, hLev 
 
//GetFastenerData
 
clear  $strType , $strLength ,$strThreadLen
string $strType , $strLength , $strThreadLen
 
GetFastenerData hEnt ,  $strType,  $strLength, $strThreadLen
 
clear $new_name
string $new_name
 
sprint $new_name , "%s\|eolSIZE %s" , $strType ,  $strLength
//Create entity name and Standard properties name
 
//StrMakeUpper $new_name
SetLevelDescriptor hLev, $new_name
setLevel hLev
notestate
 
clear $$acsStandard , $$acsUser
 
SList  $$acsStandard
SList  $$acsUser
Sprint  $$acsStandard[1] , "%s" ,  $new_name
SetEntityProperties hEnt , $new_name , $$acsStandard , $$acsUser
notestate
 
if (number > nNumSel-2)
goto end
number=number+1
goto loop
 
goto read_entity
 
:end
MASKCLEAR
MASKMAINTAIN 0
--------------------------------------------------------------------------------------
Login