Kubotek Forum

KeyCreator CAD & CKD Viewer Technical discussion of CAD/CAM and integrated partner products
Subscribe to post
User avatar
Soli - (7/27/2020 10:52:04 AM)
RE:BOM
Dana, Hello,

I have something similar.
I also use Entity Standart Properties but I use Entity User Properties to keep
Quantity, Termic Treatment and Coating for specific components,
I input Quantity manually.

For Fastner I use Entity Name instead of  Entity Standart Properties 
The program counts the quantity, automatically.

How did you solved the quantity for specific components?

I use the same parameters to create an associative Label in the component dreawigs.

-----------------------------------------------------
clear hEnt , $number , $name , $quantity , $material , $treatment ,$coating , $scale  , $tool_number ,$nEntID 
HENTITY hEnt
string $number , $name , $quantity , $material , $treatment , $coating , $scale ,$tool_number ,$nEntID 
clear number
int number
 
:start
int nSelFlag = 0
Int  nSelParent = 1
Int  bSelRefEnts = 0
Int  bAccept = 1
bActiveInstFlag = 1
MASKENTITY 0, 32 ,26 ,35
MASKMAINTAIN 1
 
GetEnt "Select the component to get Label", hEnt,  , nSelFlag, nSelParent, bSelRefEnts,  , bAccept, bActiveInstFlag 
if (@key == -3)
goto end
 
MASKCLEAR
MASKMAINTAIN 0
 
ENTLEVEL hEnt, hLev 
GETLEVELINFO hLev , $name_from_level
 
clear $$acsStandard , $$acsUser
SList  $$acsStandard
SList  $$acsUser
 
getEntityProperties hEnt, $csName , $$acsStandard , $$acsUser
 
clear nEntID
Int nEntID 
GetIDFromEnt hEnt , nEntID 
 
:scale
 
clear hEnt
HEntity hEnt
clear hInstance , nMode , nHLDisplayMethod 
HDrawInst hInstance
string $csName
int nHLDisplayMethod
Int  nMode
Int  bPHLV5
 
MASKENTITY 0, 22
MASKMAINTAIN 1
 
getent "Select Instance to read the scale", hEnt ,   , 0 , 1 ,  1 ,   , 0 , 1 , 1
if (@key == -3)
exit
if(!IsValid(hEnt))
exit
MASKCLEAR
MASKMAINTAIN 0
HEntityToHDrawInst hInstance, hEnt
 
GetDrawInstData hInstance , pos , dRotation , dWidth , dHeight , adBaseMatrix ,\
 ViewCenterPos , ViewCenterLoc , $csName , dScale ,  ,  ,  ,nMode ,   , nHLDisplayMethod
if ( dScale == 1) 
$scale= "1:1"
if ( dScale == 0.875) 
$scale= "7:8"
if ( dScale == 0.75) 
$scale= "3:4"
if ( dScale == 0.5) 
$scale= "1:2"
if ( dScale == 0.4) 
$scale= "1:2.5"
if ( dScale == 0.2) 
$scale= "1:5"
if ( dScale == 0.1) 
$scale= "1:10"
if ( dScale == 2) 
$scale= "2:1"
if ( dScale == 2.5) 
$scale= "2.5:1"
if ( dScale == 5) 
$scale= "5:1"
//if (( dScale != 1)&&( dScale !=0.875) &&( dScale != 0.75)&&( dScale != 0.5)&&( dScale != 0.4)&&( dScale != 0.2)&&( dScale != 0.1)&&\
//( dScale != 2)&&( dScale != 2.5)&&( dScale != 5))
//getstr "Manually enter the scale" , $scale ,$scale
 
CLEAR first_position
DOUBLE first_position[3]
:f_point
type_pos=0
 
GETPOS "Select the label position", type_pos, first_position 
if (@key == -3)
exit
 
x=first_position[0]
y=first_position[1]
z=first_position[2]
worldtocplane x, y, z
clear hComposite
 
CLEAR adTextAtt
DOUBLE adTextAtt[0]
ARRAY adTextAtt[13] = { 0, 5, 0.85, 0.6, 0, 0, 0, 1, 1, 0, 0, 0, 0}
CLEAR anEntAtt
INT anEntAtt[0]
ARRAY anEntAtt[8] = { 3, 0, 1, 1, 1, 0, 0, 0x0 }
 
sprint $number ,"\|405%d\|405" , nEntID
 
sprint $name , "NAME = \|403%d\|403" , nEntID
 
sprint $scale , "SCALE = %s" , $scale
 
sprint $quantity , "QUANTITY = \|413%d,QT'Y\|413" , nEntID
 
sprint $material , "MATERIAL = \|408%d\|408" , nEntID
 
sprint $treatment , "T TREAT = \|413%d,T TREAT\|413" , nEntID
 
sprint $coating , "COATING = \|413%d,COAT\|413" , nEntID
 
clear $date
string $date
sprint $date , "DATE= \|412%d\|412" , nEntID
 
CLEAR $note
string $note
sprint $note , "%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n%s", $number , $name ,$scale , $quantity , $material , $treatment , $coating , $date
 
NOTE $note , x , y-18 , 0 , , , , 0, "Smooth", adTextAtt, anEntAtt
NoteState
 
 
Int  nType = 4
MessageBox "Continue ?",  nType 
error=@error
if (error == 6)
goto start
if (error == 7)
set NoteHt , 5
if (error == 7)
exit
-------------------------------------------------------------

To return the conponente name for example, I use:
sprint $name , "NAME = \|403%d\|403" , nEntID

instead of:
sprint $name , "NAME = %s" , $$acsStandard[1]

because the first option doesn't keep the associativity.



Login