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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

1/2 of a part

Dale_Rosema
23-Emerald III

1/2 of a part

We have a hardware kit that is shipped one per box of two components. We also have final drawings of the parts which have a quanitity of 0.5 for the hardware kit when just one part is shown. Using repeat regions, is there a way to have a half of a componenet in the bill of material?

Thanks, Dale


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
1 ACCEPTED SOLUTION

Accepted Solutions

Put this in the cell of the column: &rpt.rel.newqty

The "rpt_qty" is in the region, it just doesn't have to be displayed. the relation will control what gets shown in the column.

View solution in original post

24 REPLIES 24

You could add a parameter to the region, and write relations to do that parameter = rpt_qty/2 (if it worked). dunno, I never tried to split the rpt.qty in half before. You'd have to write relations to let all the other quantities stay as is, and only select certain ones to be either a value as shown above, or a manually-entered string value.

The parameter I have in my table: RPT_QTY

Model parameter: BOM_OBJECT_TYPE (integer)

The relations:

/*===================================================================

/*NOTES FOR BULK QTY "A/R" AND "REMOVED" QTY "" (NULL VALUE) PARTS BELOW:

/*

/*IF THE MODELS WERE ALL MADE WITH THE PROPER START PARTS ALL BULK ITEMS

/*WILL AUTOMATICALLY HAVE A QTY OF "A/R" (WELD FILLER, PAINT, OIL, ETC.) AND ALL

/*"REMOVED" ITEMS WILL ALL HAVE A NULL VALUE "" FOR QTY.

/*

/*THE BELOW RELATIONS AUTOMATICALLY REPLACE THE NUMERIC

/*QTY WITH EITHER "A/R" IF THE INTEGER PARAMETER "BOM_OBJECT_TYPE" IS A

/*VALUE BETWEEN 50 AND 998 INCLUSIVE, OR TO "" (NULL VALUE) IF THE VALUE IS 999.

/*

/*

/*THE BELOW RELATIONS ALSO ALLOW FOR THE MANUAL REPLACEMENT OF THE

/*NUMERIC QTY WITH EITHER "A/R" OR "" (OR ANY TEXT STRING) ON A LINE-BY-LINE

/*BASIS BY USING THE ITEM NO. (rpt_index) VALUE FOR BULK ITEMS, REMOVED ITEMS,

/*OR OTHER ITEMS. USE QTY "A/R" FOR BULK ITEMS, AND USE QTY "" FOR REMOVED

/*ITEMS. TO MAKE AN ITEM HAVE A QTY OF "A/R", SIMPLY REPLACE THE

/*ITEM NO. (0000) OF THE LINE(S) BELOW WITH THE ITEM NO. OF THE ITEM YOU WANT

/*TO CHANGE THE QUANTITY OF. THE SAME PROCEDURE APPLIES FOR THE REMOVED

/*OBJECTS. THERE ARE 1 OF EACH BELOW, AND THE "IF" THRU "ELSE" LINES CAN

/*BE COPIED AS A GROUP AS MANY TIMES AS NEEDED. ADD 1 "ENDIF" AT THE

/*BOTTOM FOR EACH ADDITIONAL COPY OF THIS 3-LINE GROUP.

/*

/*

/*AUTOMATIC BULK PART RELATIONS BELOW

IF asm_mbr_bom_object_type >= 50 & asm_mbr_bom_object_type <= 998

QTY_REQD = "A/R"

ELSE

/*

/*AUTOMATIC REMOVED PART RELATIONS BELOW

IF asm_mbr_bom_object_type == 999

QTY_REQD = ""

ELSE

/*

/*

/*MANUAL BULK PART RELATIONS BELOW

IF rpt_index == 0000

QTY_REQD = "A/R"

ELSE

/*

/*MANUAL REMOVED PART RELATIONS BELOW

IF rpt_index == 8888

QTY_REQD = ""

ELSE

/*

QTY_REQD = rpt_qty

ENDIF

ENDIF

ENDIF

ENDIF

Frank,

Thanks for the thought.

Maybe you or others could help me trouble shoot this:

Do I put this in the window for the drawing under Tools: Relations?

This is the error message I am getting:

if asm.mbr.pn = 9117

error Invalid number in relation.

qty_reqd=rpt_qty/2

else

if asm.mbr.pn = 9556

error Invalid number in relation.

qty_reqd=rpt_qty/2

else

qty_reqd=rpt_qty

error Invalid symbol 'rpt_qty' found.

endif

endif

Hi Dale...

You need to do a couple of things. First, your repeat region is likely using the system default report parameter &rpt.qty to drive the quantity column. To override this column, you need to use your own parameter. You can't override the system default quantity parameter... you must use a replacement.

Second, you need to add some Table Relations as Frank has suggested. You do not add these like normal relations. You can go to the relations window and select Table as the type (and then pick the BOM) to "place" them in the BOM table. But the preferred method to enter table relations is to go to Table->Repeat Region->Relations and then pick the BOM. A relations editor will pop open. Inside that editor, enter the following:

if asm_mbr_pn == "9556"

newqty = "0.5"

else

newqty = rpt_qty

endif

This assumes you have a parameter called "pn" in all your models. As each model in the BOM is evaluated, the value of "pn" is examined. If "pn" is set to "9556" then a new variable called newqty is set to "0.5". Otherwise this new variable called newqty is set to the system default quantity parameter.

Note that "." is not used in table relation although they are used everywhere else. Table relations have some weird idiosyncrasies that make them tricky for those who are new at using them. In table relations, the "." is replaced by an "_" underscore. Whenever I make new variables in a table relation, I always keep them to a single word. For instance, I could have called the new variable new_qty but I prefer not to introduce additional underscores. I've seen these additional underscores cause conflicts so I prefer to stick to a single word variable name.

The final piece to the puzzle is to go back and replace the system default quantity parameter with the new custom one you created in the table relation. The format for this is &rpt.rel.<user parameter name> .

So... your BOM should contain the relations above... and the quantity column should use the parameter &rpt.rel.newqty to report the quantity. Update the table once you've replaced the parameter. The table should look normal except you should now see "0.5" in the quantity column next to 9556.

Hope that made sense... give it a try and let us know if you get stuck.

Thanks!

-Brian

Dale_Rosema
23-Emerald III
(To:BrianMartin)

Does the assembly need the parameter, newqty, or does each component need that parameter?

Will that parameter be a real number, or a string?

Dale_Rosema
23-Emerald III
(To:BrianMartin)

I just added the newqty to the assemlby and this is what I got.

I'll try and add it to the components.

if asm_mbr_pn == "9556"

newqty = "0.5"

else

newqty = rpt_qty


error Invalid symbol 'rpt_qty' found.

endif

"rpt_qty" has to be in the region. "newqty" should be a string parameter.

Got the error fixed.

Is there a way to hide the column?

The "rpt_qty" has to be in the region but is there a way to hide it?

Getting close.

Thanks,

Put this in the cell of the column: &rpt.rel.newqty

The "rpt_qty" is in the region, it just doesn't have to be displayed. the relation will control what gets shown in the column.

Frank & Brian,

Thank you both very much.

I don't know if I can mark both of your answers as the correct answer, but between the two of you this works.

Thanks,

Dale

You're very welcome, and thanks to Brian again, as always.

The repeat regions seem daunting at first, but after a while you get the hang of them. You can also use parameters to sort models in your BOM by model type (sub-assy vs. patrt), or type of part (machined, purchased, bulk, etc.). That's what the "BOM_OBJECT_TYPE" parameter I had did. Good luck!

P.S. comments in ALL relations go a long way!

Dale_Rosema
23-Emerald III
(To:Dale_Rosema)

Just an update - The relation is case sensitive.

If asm_mbr_pn == "9556-ALT" returns the value of 0.5, "9556-alt" will still return a value of 1.

(Sometime we have -ALT for parts that are altered before assembly - i.e. cut to a shorter length.)

Glad you got it working Dale.

The rpt_qty parameter will always exist in your repeat region table. As Frank said, it doesn't have to be displayed. There are some funky rules about adding parameters to the table first- and THEN using them in relations. However, for rpt_index and rpt_qty, those rules don't apply.

Repeat regions and repeat region relations can be tricky. They'll drive you crazy, too. Hopefully this gives you a template for future work so you don't have to reinvent the wheel next time.

Take care...

-Brian

Dale_Rosema
23-Emerald III
(To:BrianMartin)

One more quick question: Does each part in the first level of the assembly need the parameter, NEWQTY?

I get to cement my lesson today by applying it to another part. A lot of BOM's here had been done manually, so I am trying to update the system as I get going.

Thanks again,

Dale

"newqty" need only exist in the table itself. You can cut and paste the relations out of the table, or, better yet, just save the table for use in other dwgs. We put it in our format, and also have it out there to use seperately.

One thing to be very aware of is that the table will fill the repeat region with the parts ONLY of whatever dwg model/simplified rep is active at thew time of table insertion, and the item bubbles are related to the table they're inserted from.

Hi Dale...

That newqty parameter only exists within the table. The only reason it's there is because you can't change the system default quantity (which is &rpt.qty).

Adding newqty to each assembly or part will actually have no effect except to add confusion.

There is a pretty cool technique you can use to create a quantity override variable if you wish. This isn't required to do what you're trying to do. Also, yes you CAN store the table and re-use it again and again so you don't have to re-enter the relations.

The technique you're using now checks the name of each component. If the name equals "9556" (or whatever it was), the quantity is altered.

The other technique I referred to works like this...

  • By default, all models use &rpt.qty (this is the default) to report the quantity
  • For models where you want to OVERRIDE the default, add a new string parameter called "QtyOverride" (or choose some other name... but keep it consistent).
  • Set the value of QtyOverride to be whatever you wish to appear in the quantity column of your BOM
  • Add a relation to your table that says:

if (exists"asm_mbr_qtyoverride") then

newqty = asm_mbr_qtyoverride

else

newqty = rpt_qty

endif

  • Use &rpt.rel.newqty to drive the quantity column in your BOM

You Could have called the parameter NewQty instead of QtyOverride. For this example I didn't do this because I thought it would be confusing. If I'd used this, the relation would look like this:

if (exists"asm_mbr_newqty") then

newqty = asm_mbr_newqty

else

newqty = rpt_qty

endif

The value of the parameter called newqty inside the table relation is DIFFERENT from the value of the parameter asm_mbr_newqty. The line that says newqty = asm_mbr_newqty illustrates this. Newqty is just a variable inside the table relations... it doesn't exist outside of the table. Asm_mbr_newqty tells Pro/E to look inside the MODEL itself for a parameter called newqty.

Hopefully you're starting to understand the difference. If not, write back and I'll try to illustrate it better.

Thanks!

-Brian

This is exactly what I want. Everything makes sense. I created a parameter called QTYOVERRIDE in the parts I want to change. However, I get the following errror:

if (exists"asm_mbr_qtyoverride") then
error Relation has an error.

newqty = asm_mbr_qtyoverride

else

newqty = rpt_qty

endif

Any help would be much appreciated.


Stan

Dale_Rosema
23-Emerald III
(To:ptc-673749)

Stan,

This is what I have in my relationship:

IF asm_mbr_pn == "9594"

NEWQTY = "0.5"

ELSE

NEWQTY = rpt_qty

ENDIF

If you need more things to sort, you add more "IF's" followed by the "NEWQTY" & "ELSE". You will also need to add more "ENDIF's" at the end.

IF asm_mbr_pn == "9594"

NEWQTY = "0.5"

ELSE

IF asm_mbr_pn == "9593"

NEWQTY = "0.5"

ELSE

NEWQTY = rpt_qty

ENDIF

ENDIF

In my repeat regoin area I have:

&rpt.rel.newqty

The repeat region will populate the table either with the value 0.5 if it finds a match else it will set the value to the rpt_qty value if it doesn't find a match. This way I sort for the PN that needs to be overridden and if it finds it, it applies the value in the relationship.

I hope this helps, Dale

Hopefully Brian can chime in because it looks like you are following the substitution instead.

Dale_Rosema
23-Emerald III
(To:ptc-673749)

Does you table have the &rpt.rel.newqty in the repeat region?

Yes, but the error message occurs after the first line of code. I don’t mention the &rpt.rel.newqty until the 2nd line.

I can delete all the subsequent lines and still get the error following the first if existsline.

if (exists"asm_mbr_qtyoverride") then

error Relation has an error.

newqty = asm_mbr_qtyoverride

else

newqty = rpt_qty

endif

I suspect a syntax error in my IF line?

this worked beautifully:

if exists ("asm_mbr_qtyoverride")

newqty = asm_mbr_qtyoverride

else
newqty = rpt_qty
endif

thanks. problem solved.

Dale_Rosema
23-Emerald III
(To:ptc-673749)

Syntax. Gotta love it.

Dale_Rosema
23-Emerald III
(To:BrianMartin)

Actually two questions: Can the relation be in a table that has been save out of the drawing so it can be imported to another drawing? or used as a master table?

And yes, it did work on the second drawing - Thanks again.

Dale

For companies that want to be able to override the quantity at will, they'd use the technique I specified above and save their BOM table with the relations already included.

This would create a master BOM that everyone could use. Hopefully that addresses your second question.

Thanks!

-Brian

Yes....but I see you figured that out.

Top Tags