Kubotek Forum

KeyCreator & KeyCreator Viewer Technical discussion of CAD/CAM and integrated partner products
Subscribe to post
User avatar
Soli - (9/25/2021 8:54:38 AM)
RE:note fields
 
I'm curently work with standart parameters.
First I have to fill the Standart properties and the User properties for each solid entity.
I run a macro to fill those parameters and other macro if I need to edit them.
After, I run a macro GetEntity to get the solid entity ID 
 
If I want to create a note in the drawing I use this:
Where 20 after first Delimiter |402 |403 |404 ... is solid entity ID
For User properties the Delimiter is |413 followed by solid entity ID 20, a comma, name of User property and again |413 
=================================
Part Number = |40220|402 
Part Description = |40320|403 
Part Created By = |40420|404
Part Keywords = |40520|405 
Part Last Saved By = |40620|406 
Part Revision = |40720|407 
Part Material = |40820|408 
Part Vendor = |40920|409
Part Created Date = |41020|410 
Part Last Saved = |41120|411 
Part Comment = |41220|412  
 
TREATMENT = |41320,T TREAT|413
COATING = |41320,COAT|413
WEIGHT = |41320,WEIGHT|413
===================================
The problem is, if I change the solid Properties, this note doesn't update.
 
The solution is, to create a note with this macro:
================================
clear hEnt
HENTITY hEnt
 
int nSelFlag = 0
Int  nSelParent = 1
Int  bSelRefEnts = 0
Int  bAccept = 1
bActiveInstFlag = 1
MASKENTITY 32 
 
GetEnt "Select the component to get Label", hEnt,  , nSelFlag, nSelParent, bSelRefEnts,  , bAccept, bActiveInstFlag 
if (@key == -3)
goto end
 
MASKCLEAR
MASKMAINTAIN 0
 
clear nEntID
Int nEntID 
GetIDFromEnt hEnt , nEntID 
 
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 }
 
clear $name
string $name
sprint $name , "NAME = \|403%d\|403" , nEntID
 
clear $quantity 
string $quantity 
// comment : |413 is the field for User Properties and QT'Y is the name of User property
sprint $quantity , "QUANTITY = \|413%d,QT'Y\|413" , nEntID
 
clear $material
string $material
sprint $material , "MATERIAL = \|408%d\|408" , nEntID
 
clear $treatment
string $treatment
sprint $treatment , "T TREAT = \|413%d,T TREAT\|413" , nEntID
 
clear $coating
string $coating
sprint $coating , "COATING = \|413%d,COAT\|413" , nEntID
 
clear $weight
string $weight
sprint $weight , "WEIGHT = \|413%d,WEIGHT\|413 KG" , nEntID
 
clear $note
string $note
sprint $note , "%s\n%s\n%s\n%s\n%s\n%s",  $name ,$quantity , $material , $treatment , $coating , $weight 
 
clear position
DOUBLE position[3]
type_pos=0
 
GETPOS "Select the Note Position", type_pos, position
if (@key == -3)
exit
 
x=position[0]
y=position[1]
z=position[2]
 
worldtocplane x, y, z
NOTE $note , x , y , 0 , , , , 0, "Smooth", adTextAtt, anEntAtt
NoteState
 
CLEAR adTextAtt
DOUBLE adTextAtt[0]
ARRAY adTextAtt[13] = { 0, 8, 0.85, 0.6, 0, 0, 0, 1, 1, 0, 0, 0, 0}
CLEAR anEntAtt
INT anEntAtt[0]
ARRAY anEntAtt[8] = { 1, 0, 1, 1, 1, 0, 0, 0x0 }
 
clear $component_number
string  $component_number
// comment : |100 is the field for file number
sprint $component_number ,"\|100-\|402%d\|402" , nEntID
 
NOTE $component_number,x-10 , y+36 ,0 , , , , 0, "Smooth", adTextAtt, anEntAtt
NoteState
 
:end
MASKCLEAR
MASKMAINTAIN 0
=======================================

 
Login