Kubotek Forum

KeyCreator CAD & CKD Viewer Technical discussion of CAD/CAM and integrated partner products
Subscribe to post
User avatar
Dana - (7/27/2020 7:51:20 AM)
RE:BOM
Rather than creating the BOM from levels using virtual objects, use the actual solids.  Using generic edit*, open the "standard properties" page for each solid.  Here, you can set part number, description, vendor, etc.  Then you create a BOM (using a previously created template), pick "add/remove entities", and presto, you have a BOM listing all the parts and quantities.

* or rather than using generic edit, here is a kxl I use, which allows you to set multiple solids at the same time:



// EntProps.kxl
// D.M. Hague 2019
// This program applies specified properties to selected entities for later BOM use


:select
MASKCLEAR
MASKENTITY 32, 52, 35, 36, 8, 6  // Solids, sheets, DP fasteners, mech elements, composites, splines
CLEAR hEnt, hFace, hInst, hdialog, hlev, hsel, nument, num, $level
cancel = 0
GETENTM "Select Entities:", 1, nument, 0, 1, 0, 0
//er = @error
//pause "%i %i %i", nument, er, @key
IF (@key < 0)
    cancel = 1
IF (cancel == 1)
    GOTO end
GetSelected hsel

GetNext type // to determine if first entity selected is a fastener
// pause "entity is type %i", type

// take information for dialog from first selected entity
GetEntityProperties hsel[0], $name, $$acsStandard, $$acsUser
EntLevel hsel[0], hlev

GetLevelInfo hlev, $level
SPRINT $partnum, $$acsStandard[0]
SPRINT $descrip, $$acsStandard[1]
SPRINT $createdby, $$acsStandard[2]
SPRINT $keywords, $$acsStandard[3]
SPRINT $savedby, $$acsStandard[4]
SPRINT $revision, $$acsStandard[5]
SPRINT $material, $$acsStandard[6]
SPRINT $vendor, $$acsStandard[7]
SPRINT $comment, $$acsStandard[8]

if (type != 35) // DP fastener
    GOTO notfast
STRING $Type, $Length, $ThdLength
GetFastenerData hsel[0], $Type, $Length, $ThdLength
//pause "error is %i", @error
//pause "%s    %s    %s", $Type, $Length, $ThdLength
SPRINT $descrip, $Type
SPRINT $partnum, $Length
SPRINT $name, "%s %s", $partnum, $descrip
//GOTO end

:notfast

StrLen $name, namlen
IF (namlen == 0) // name isn't set yet, so get it from the level
    SPRINT $descrip, $level // set description from level name

:dialog
cancel = 0
width = 90
height = 20
dg_init_dialog height, width,,"Edit Properties"
hdialog = @error
dg_add_button hdialog, 1, height-3, 10, 10, "Cancel",,,8
dg_add_button hdialog, 2, height-3, width-20, 10, "OK",,,8192
dg_add_note hdialog, 3, 2, 3, "Name "
dg_add_text_string hdialog, 4, 2, 15, width-19, , $name
dg_add_note hdialog, 5, 4, 3, "Part Number"
dg_add_text_string hdialog, 6, 4, 15, width-30, , $partnum
dg_add_note hdialog, 9, 4, width - 14, "Rev."
dg_add_text_string hdialog, 10, 4, width - 9, 5, , $revision
dg_add_note hdialog, 7, 6, 3, "Description"
dg_add_text_string hdialog, 8, 6, 15, width-19, , $descrip
dg_add_note hdialog, 11, 8, 3, "Vendor"
dg_add_text_string hdialog, 12, 8, 15, width-19, , $vendor
dg_add_note hdialog, 13, 10, 3, "Comment "
dg_add_text_string hdialog, 14, 10, 15, width-19, , $comment
dg_draw_dialog hdialog
dg_move_focus hdialog, 6
dg_run_dialog hdialog
if (@error == 1) //cancel
    cancel = 1
if (cancel == 1)

    GOTO close

dg_get_text_string hdialog, 4
SPRINT $name, @strdat
dg_get_text_string hdialog, 6
SPRINT $partnum, @strdat
SPRINT  $$acsStandard[0], $partnum
dg_get_text_string hdialog, 8
SPRINT $descrip, @strdat
SPRINT  $$acsStandard[1], $descrip
dg_get_text_string hdialog, 10
SPRINT $revision, @strdat
SPRINT $$acsStandard[5], $revision
dg_get_text_string hdialog, 12
SPRINT $vendor, @strdat
StrLen $vendor, venlen
IF (venlen == 0) // vendor isn't set yet
    SPRINT $vendor, "-"
SPRINT $$acsStandard[7], $vendor
dg_get_text_string hdialog, 14
SPRINT $comment, @strdat
SPRINT $$acsStandard[8], $comment

StrLen $name, namlen
IF (namlen == 0) // name isn't set yet
    SPRINT $name, "%s %s", $partnum, $descrip

SetEntityProperties hsel, $name, $$acsStandard, $$acsUser

:close
dg_erase_dialog hdialog
dg_free_dialog hdialog

:end
   CLEAR hEnt, hFace, hInst, hdialog, nEntType, nEnts, nFaces, ID, i, $Name, $$acsStandard, $$acsUser, hsel, nument
   CLEAR $name, $partnum, $revision, $descrip, $vendor, $comment
   MASKCLEAR
   CLEARSEL
  IF (cancel == 0)
    GOTO select
   EXIT
Login