Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hello, I would like to to override a few items in a BOM table and keep all the items programed.
I have the following code entered but its not working,
I would like "XX" to be renamed to the actual part name "HEX BOLT"
Are there any specific settings I need to review?
Does the type need to be defined, if so where do I do that?
The view contains an assembly with a simplified rep.
I'm using Creo 7.0
Solved! Go to Solution.
@RL_4555254 wrote:
Thank you!
That helps. I did not know I needed to add the original parameters
I can now get everything to load.
key point is defining the other items as well.
The if statements will work by themselves, but I cannot get multiple to work.
the syntax seams very specific with spaces and "
right now it won't accept the second endif.
it would not accept Elseif with a space "Else if"
is there a syntax guide?
Hi,
elseif is not implemented.
Use following code
if asm_mbr_name == "28632"
PRTNUM="88888"
else
if asm_mbr_name == "19451_TETHER_STRAP_MSB"
PRTNUM="19541"
else
PRTNUM=asm_mbr_name
endif
endif
Here are my cheat sheet instructions: Looks like you are missing the rename in the repeat region and the else statement.
CHANGING ITEM IN BOM TABLE
Thank you for the response,
I still seem to be missing something.
I left the index alone.
The BOM is not populating after changing the parameter name, and relations won't recognize the old parameter name now.
I ensured the model/rep was selected and updated tables.
@RL_4555254 wrote:
Thank you for the response,
I still seem to be missing something.
I left the index alone.
The BOM is not populating after changing the parameter name, and relations won't recognize the old parameter name now.
I ensured the model/rep was selected and updated tables.
Hi,
please replay uploaded video. It will help you to solve your problems.
Thank you!
That helps. I did not know I needed to add the original parameters
I can now get everything to load.
key point is defining the other items as well.
The if statements will work by themselves, but I cannot get multiple to work.
the syntax seams very specific with spaces and "
right now it won't accept the second endif.
it would not accept Elseif with a space "Else if"
is there a syntax guide?
Also I did create separate if statements, but the last one trumps the first.
so only the last one functions and I assume you must use the elseif function.
@RL_4555254 wrote:
Thank you!
That helps. I did not know I needed to add the original parameters
I can now get everything to load.
key point is defining the other items as well.
The if statements will work by themselves, but I cannot get multiple to work.
the syntax seams very specific with spaces and "
right now it won't accept the second endif.
it would not accept Elseif with a space "Else if"
is there a syntax guide?
Hi,
elseif is not implemented.
Use following code
if asm_mbr_name == "28632"
PRTNUM="88888"
else
if asm_mbr_name == "19451_TETHER_STRAP_MSB"
PRTNUM="19541"
else
PRTNUM=asm_mbr_name
endif
endif
Perfect!
Thank you!
This could get very large with the amount of else if I will need.
I added a 3rd one without issues.
Maybe you need to rethink some of the if clauses and move some of that information to a part parameter with a relation.
Instead of this in a repeat region:
if asm_mbr_name == "19451_TETHER_STRAP_MSB"
PRTNUM="19541"
Try this relation in the part file:
prtnum = extract(name,1,5)
This will create a parameter in your part file named prtnum with 19541 as the value. Then you can use this in the assembly BOM.
not a part numbers will be 5 digits
if this needs to be in the .prt file I do not have modification access as it's released.
I might not be following what you are thinking, but I will say the relations are working for me now.
This is a fine way to do a few. I would look for a different solution to your problem if you have a substantial number to change. Likely easier to just manually type in a text BOM.
Agree, manual entry would be easier, but in programing there is less risk when files are update.
there are many people working on these parts and we want to ensure content/qty is accurate when something is updated.
@MartinHanak wrote:
@RL_4555254 wrote:
Thank you!
That helps. I did not know I needed to add the original parameters
I can now get everything to load.
key point is defining the other items as well.
The if statements will work by themselves, but I cannot get multiple to work.
the syntax seams very specific with spaces and "
right now it won't accept the second endif.
it would not accept Elseif with a space "Else if"
is there a syntax guide?
Hi,
elseif is not implemented.
Use following code
if asm_mbr_name == "28632" PRTNUM="88888" else if asm_mbr_name == "19451_TETHER_STRAP_MSB" PRTNUM="19541" else PRTNUM=asm_mbr_name endif endif
Hi,
FYI ... you can also use the following relations, that is, don't use the else branch.
PRTNUM=asm_mbr_name
if asm_mbr_name == "28632"
PRTNUM="88888"
endif
if asm_mbr_name == "19451_TETHER_STRAP_MSB"
PRTNUM="19541"
endif