cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How to add the BOM quantity listed in a note?

DVsantacruz
6-Contributor

How to add the BOM quantity listed in a note?

Is there any way to create a user defined parameter in the .asm file to capture quantities of parts then use that in a note?

I know you can get the quantity from the BOM but in I need more detailed because we use a lot of parts and subassembly so the subassembly can be shown in the BOM but not as a note in order to show it in the selected sheet of each part from the subassembly. currently we put this note manually so we have a several of issues   

1 ACCEPTED SOLUTION

Accepted Solutions

1. In this case you need to create model level parameter - item_no. Create in model "Name_001b" a parameter item_no = "b". Then change int table &asm.mbr.cparam.item_no to &asm.mbr.item_no and in the relations asm_mbr_cparam_item_no to asm_mbr_item_no

 

2. Table borders

How to hide internal borders, not outline

https://community.ptc.com/t5/3D-Part-Assembly-Design/Hide-table-border-lines/m-p/271391#M40548

 

To hide whole table you need to change border color. Need to set not printable color (print by white color on white paper). Depending on you pen table setting.

https://community.ptc.com/t5/3D-Part-Assembly-Design/table-color/m-p/43903

 

View solution in original post

17 REPLIES 17


@DVsantacruz wrote:

Is there any way to create a user defined parameter in the .asm file to capture quantities of parts then use that in a note?

I know you can get the quantity from the BOM but in I need more detailed because we use a lot of parts and subassembly so the subassembly can be shown in the BOM but not as a note in order to show it in the selected sheet of each part from the subassembly. currently we put this note manually so we have a several of issues   


Hi,

unfortunately I do not know of any simple solution.

 

You can do following manually:

  • in assembly save textual BOM
  • run application that searches textual BOM for part quantities and generates relations defining parameter values
    • for example ... QTY_PART1_NAME=123
  • in assembly open Relation dialog box and paste generated relations into it
    • there may be problems with the length of the parameter name
  • regenerate assembly
  • in assembly open Relation dialog box and remove generated relations
  • regenerate assembly
  • use parameters in notes

I hope you can automate the above mentioned procedure using mapkey. Also you can ask someone to develop Toolkit application for you.


Martin Hanák

Use table with repeat region and summation. Place the table outside drawing frame. See the video

Thank you so much for you respond, It helped me a lot.... but look what I need is to add the real quantity not the sum of all the pieces... we currently have this note which they made long time ago, I put the &rep.qty in the #REQ value so it changed to the sum of all of them not just the 6, this value we put it manually  

 

DV_10098275_1-1635797828396.png

DV_10098275_2-1635798012162.png

In drawing symbol do you want to show qnty = 6 for item - d ?

Of course! it should be 6 not 26, the sum of all the items is 26

Ok. For this we need find a way to link a note to the part by item_no or f_cat_id_no.

So, one more question:

I see you use f_cat_id_no parameter in symbol variable text: This parameter is a model parameter? Drawing parameter? Or asm level parameter?

 

For now I don't understand how you show part parameters in the symbol from dedicate item (for example, &DET, &THKNESS for item "a" or "b").

As I see we do a lot of hard work doing it all manually, so I got some additional questions, Is there a way to put the item automatically by alphabet? and to take the "&F_CAT_ID_NO"  equal as the name of the part? but the main question here is how to add automatically the quantity of each item (rpt_qty) in the note instead of put manually "#REQ"?

 

 

DV_10098275_0-1635859488817.png

 

Hi,

do you need to get something like this ?

MartinHanak_0-1635859494957.png

See attached files created in Creo 4.0.


Martin Hanák

Thanks for your respond, it's pretty pretty similar it could work, Could you pls explain me how to make that kind of notes?

 

well in this case I'm guessing that I should put asm.mbr.name in the "#REG" parameter so it should change depending on the table, isn't it? but sadly it didn't work at all probably I did something wrong. 

 

DV_10098275_0-1635861377104.png 

DV_10098275_1-1635861629625.png

 

 


@DVsantacruz wrote:

Thanks for your respond, it's pretty pretty similar it could work, Could you pls explain me how to make that kind of notes?

 

well in this case I'm guessing that I should put asm.mbr.name in the "#REG" parameter so it should change depending on the table, isn't it? but sadly it didn't work at all probably I did something wrong. 

 

DV_10098275_0-1635861377104.png 

DV_10098275_1-1635861629625.png

 

 


Hi,

you cannot include repeat region parameters into note. You have to create custom symbol and use it to show BOM balloons related to repeat region. Please watch https://www.youtube.com/watch?v=6LZoXarSSyU video.


Martin Hanák

One more way. Replace drawing symbol by the table with repeat region.

item_no - is a component level parameter.

Create string parameter in the relations for the repeat region - DISPLAY.

This parameter will be drive the visibility the components in the table by item_no component parameter.

In the relations for repeat region

FILTER = 0
IF asm_mbr_cparam_item_no ==  DISPLAY
  FILTER = 1
ENDIF

The filter for the repeat region:

&rpt.rel.filter  == 1

 

 

ps: I'm not clear understand the structure of your assembly, but think this is close to what you asked. 

Thank you so much for your response. 

First at all, the structure of my assembly is

Name.asm

Name_001.asm subassembly 

Name_001a

Name_001a

Name_001b

Name_002.asm subassmebly

Name_002a

Name_002b

an so on

So sometimes we put Name_001a and Name_002a into the same sheet and sometimes they (operators) dont have the main table to see the real qty of each item becuase they just have the printing sheet they're working, so that's why we put a custom symbol (a note) to each item into the drawing.

......

 

And second one. I have tried this one, and of course that's what I exactly need, it works, I just have a question right here (see image), how to set the "B" as the same name as the other ones, l mean all "Name_001b" is going to have "B" to avoid changing it one by one. and other question, can it be shown just as a text without the lines of the table?

 

 

DV_10098275_0-1636479173283.png

 

 

 

1. In this case you need to create model level parameter - item_no. Create in model "Name_001b" a parameter item_no = "b". Then change int table &asm.mbr.cparam.item_no to &asm.mbr.item_no and in the relations asm_mbr_cparam_item_no to asm_mbr_item_no

 

2. Table borders

How to hide internal borders, not outline

https://community.ptc.com/t5/3D-Part-Assembly-Design/Hide-table-border-lines/m-p/271391#M40548

 

To hide whole table you need to change border color. Need to set not printable color (print by white color on white paper). Depending on you pen table setting.

https://community.ptc.com/t5/3D-Part-Assembly-Design/table-color/m-p/43903

 

Hi mates,

I just want to add this attributes that works for every level of the assemble, not just in the main level so you select Attributes, then clic on the table and select the following "No Duplicates", "Recursive", "Bln By Part", "No Cbl Info" and that's it

Thank you all. 

 

DV_10098275_0-1636635066339.png

 

FV
17-Peridot
17-Peridot
(To:DVsantacruz)

Hi all,

As previous discussion participants had mentioned already

  • each model has to have a model level parameter ('BOM_QTY' for example);
  • drawing sheet note's text to include 'Session ID' in pro/relation lingo or 'RelationId' in OTK lingo - for example, let' say NAME_001A.PRT has session id being 5, the note-text would look like '&BOM_QTY:5'
  • the main obstacle(s) to this approach would be to populate a model level parameter with the data from BOM table row and there is no easy way to do it without some programming.

The good news is: there is 'Creo.JS' and its 'Testing Web Tool' - this is from Creo.JS User's Guide.

FV_0-1636577181792.png

 

Here is a javascript code to run.

 

 

 

 

 

var columnNumberForRptQty = 2;
var paramNameForQty = "TEST_QTY";
var rowStartNumber = 2;

function MdlParamAssign( mdlObj, intValueToAssign) {
		
	var param_val = pfcCreateIntParamValue(intValueToAssign);
	if( !param_val){
			return (false);
	}
	
	var paramObj = mdlObj.GetParam( paramNameForQty);
	if (paramObj == null){
		mdlObj.CreateParam (paramNameForQty, param_val);
		paramObj=mdlObj.GetParam(paramNameForQty);
	}
	
	if( paramObj == null) {
		return false;
	}
	
	try{
		paramObj.Value=param_val;
	}
	catch (err){
		return(false);
	}
	return( true);
}

function BomTableRowTextToMdlParam( table, currentRowNumber) {

	var txt ="";	
	
	var cell = pfcTableCell.Create( currentRowNumber, columnNumberForRptQty);
	if( ! cell) {
		return(txt);
	}
	var qty = table.GetText( cell, pfcParamMode.DWGTABLE_NORMAL)
	
	var mdl = table.GetCellReferenceModel(cell);
	if( !mdl) {
		txt = "Cannot get model object... Qty was extracted: " + qty;
		return(txt);
	}
	var result = MdlParamAssign( mdl, qty);
	if( result) {
		txt += mdl.FullName + " : " + paramNameForQty + " ParamValue assigned: " + qty;
	}
	else {
		txt = "===============Cannot create or modify model parameter for " + mdl.FullName;
	}
	return(txt);
}


function BomTableToMdlParams() {
   // Click Run to execute this script
	
	
	const session = pfcGetCurrentSession ();
  var selBuff = session.GetCurrentSelectionBuffer();
	var selected = selBuff.GetContents();
	if( selected == null ) {
		alert ("Must select BOM table...");
		return;
	}
	if( selected.Count < 1 ) {
		return;
	}
	
	selected.forEach( sel => {

		let table = sel.GetSelItem();
		if( ! table ) {
			return;
		}
		let rowCount = table.GetRowCount();
	  
		for( var i = rowStartNumber; i <= rowCount; i++) {
			let txt = BomTableRowTextToMdlParam( table, i);
			print(txt);
		}
		
	});

}
BomTableToMdlParams();

 

 

 

 

 

 

This code will populate model level parameter with the value from BOM table cell

 

How to do it:

  • delete all text lines in web-editing window

FV_1-1636578402879.png

 

  • and insert this code. Replace a column number and parameter name, row starting number in the pasted code with your values. (row and column count start with 1) 

FV_0-1636584927607.png

 

  • open drawing with BOM table. Preselect BOM table - use 'Table' selection filter.
  • click on 'Clear' button and 'Run' button.

This is about all to it.

 

HIH.

FV.

 

 

 

DVsantacruz
6-Contributor
(To:FV)

Woow FV, This seems very complex, I'll try it but I have no idea how to open the CreoJ.C. I'll figure it out.

Thank you.

FV
17-Peridot
17-Peridot
(To:DVsantacruz)

Hello all,

 

to open Creo.JS interactive shell :

while in web browser panel:

  1. click on '+' tab to add an empty browser tab
  2. go to navigation tab and type in or paste the text of the full file path where to your  creo's "Common Files\apps\creojs\creojsweb" folder is located 

FV_0-1636652737077.png

double-click on 'script_engine_testing.html' file.

 

FV_1-1636652961562.png

 

HIH.

 

Top Tags