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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Repeat Region question again

GrahameWard
12-Amethyst

Repeat Region question again

Hi. This time I have a repeat region in an assembly drawing with "asm.mbr.name" giving the filename of the parts and subassemblies in the drawing. Trouble is, I have several components that are family table versions of the parts, because the parts are stretchy, and will expand in assembly. The generic version is the way it's made and drawn, and the instance is the way it would look when expanded in assembly.

I was asked to do it this way so we wouldn't have lines overlapping. Trouble is, they want the table to show the part name of the generic, not this stretched version. In each case the cell displays, for example, "1234", "1235", etc for part names, but for 4 instances it's "1236_INASM", "1237_INASM", etc.

Does anyone know how I can override the value, or do some other trick to remove the "_INASM" off the end of the word?


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.
22 REPLIES 22

Avoid modelling an "extra family instances" at all and use flexibility function in assembly mode to make your parts "stretchy".

Hi,

you can apply repeat region relations to analyze and transform asm_mbr_name into new parameter (eg. MYPAR) and replace asm.mbr.name with rpt.rel.MYPAR.

MH


Martin Hanák

Do you know how I would do this? I mean, the exact syntax?

StephenW
23-Emerald III
(To:GrahameWard)

I read that, it would require writing a relation for each specific part number. I could do that I guess. There are only 4.

StephenW
23-Emerald III
(To:GrahameWard)

I've always had to write one for each name change. It may be possible to build some smarts in to a relation but I've never tried it.

BenLoosli
23-Emerald II
(To:GrahameWard)

We use a custom parameter in every file called PDM_NUMBER which is usually set by a relation of PDM_NUMBER = rel_model_name.

In the bom, we use asm_mbr_pdm_number for our number field.

In your case, set a parameter for each instance to a shortened version of rel_model_name by using a relation like this: pdm_number = extract(rel_model_name,1.xx) where xx is the number of characters of the name you want. Example

asm_number = extract(rel_model_name,1,4) where rel_model_name is 1234_inasm and asm_number is 1234.

In your repeat region use asm_mbr_asm_number instead of asm_mbr_name.

Alternatively, you can do it in a repeat region relation, but this would be a lot of manual editing for the required results.

F asm_mbr_name == "1237_inasm"

asm_mbr_name = "1237"

elseif asm_mbr_name == "1236_inasm"

asm_mbr_name = '1236"

endif

I've renamed all the "INASM" instances so they just have an underscore after the number. But apparently that isn't good enough.

Ben, I tried your relation with just one component, but it does nothing.

if asm_mbr_name == "7440_"

asm_mbr_name = "7440"

endif

This does nothing to my table. The other suggestion wouldn't work as some of my part numbers are 4 digit and some are 5

BenLoosli
23-Emerald II
(To:GrahameWard)

I am wondering if you cannot do that with a system parameter.

We use a custom parameter for our BOM table.

StephenW
23-Emerald III
(To:GrahameWard)

No, you can't change asm_mbr_name. You need to use asm_mbr_name to create an alternate and change that.

For example, in your table, change the column that uses &asm.mbr.name to use &rpt.rel.prtnum

In the table relations, add the following:

prtnum = asm_mbr_name

IF asm_mbr_name == "7440_"

prtnum = "7440"

ELSE

prtnum = asm_mbr_name

ENDIF

The secret to this is before you do the relations, make sure your table has both the &rpt.rel.prtnum and &asm.mbr.name in a column, otherwise the relations won’t verify. Once you get everything working, delete the column that has &asm.mbr.name

Hi,

I attached files created in CR2 M070.

Repeat region relations:

if search(asm_mbr_name, "_") == 0

  /* component name does not contain "_"

  my_mbr_name=asm_mbr_name

else

  /* component name contains "_"

  my_mbr_name=extract(asm_mbr_name, 1, search(asm_mbr_name, "_")-1)

endif

MH


Martin Hanák

We do something similar to Ben and Martin in our start parts and drawing tables.

We use a model parameter called OPTIPARTNUM for the part number in the BOM and we use the following relations to remove everything in the model name from the "_" and beyond.

/* First set PART_NUM to be the model name

PART_NUM=REL_MODEL_NAME

/* Then search the PART_NUM parameter for "_" and set OPTIPARTNUM to be everything to the left of "_"

IF SEARCH(PART_NUM,"_")==0

OPTIPARTNUM=PART_NUM

ELSE

OPTIPARTNUM=EXTRACT(PART_NUM, 1, (SEARCH(PART_NUM,"_")-1))

ENDIF

Agree with John Frankovich. Think this is very elegant solution...

This is very interesting. I'd like to do something similar in model relations. Can you help me out with the relation syntax?

Basically, we have part numbers like 7012345678andmaybemore.prt

I'd like:

if the first two digits are "70"

then extract digits from third to 10th position

and assign these 8 extracted digits to a parameter called WT_PART_NO


The result would be a model parameter WT_PART_NO with (text)value being "12345678".


Is such a thing possible? Where can I find commands and syntax for model relations?

Hi,

model relations:

if (extract(rel_model_name(),1,2) == "70"

  WT_PART_NO=extract(rel_model_name(),3,8)

endif

Start with http://help.ptc.com/creo_hc/creo30_pma_hc/usascii/#page/pma/fundamentals/fund_seven_sub/Terminology_Used_in_Relations_an…

MH


Martin Hanák

Wow, that simple? Thank you very much also for the link to the relations documentation. This will help with other ideas we wanted to implement but didn't know how. Tremendous!

Note: The if statement contains 3 left brackets but only 2 right brackets.

Add another right bracket before the == and it works great.

Thanks again Martin!

jbob
12-Amethyst
(To:GrahameWard)

We remove part of the part number for generics family tables as the all end in -ft, here is what we use

/*RELATION TO TRUNCATE THE FILE NAME TO FILL IN THE PARAMETER

tmp_prt_no=REL_MODEL_NAME()

PART_NUMBER=extract(tmp_prt_no,1,9)

the 1 in this case is where we start collecting the part number, the 9 is where we stop collecting the part number. Our par numbers are all the same length in characters. If you have different length part numbers then you would need to use the method John shows.

mbonka
16-Pearl
(To:jbob)

In my opinion it´s better to to use John Frankovich‌ method immidiatly. It´s much more complex.

We can say: "-" is a divide mark that HAVE TO occur ONLY ONCE in  EACH FILE NAME.

Than you don´t have to care about how many letters your files have. It works everytime.

l´m using similar relation in my start parts.

File name is in the shape: project_number-drawing_number

If you only need to change a couple of values to "stretch" your part, I would agree that Flexibility is the way to go.

Here is what I use for the rare occasion that I have to modify the BOM for an instance or as installed model:

CHANGING PART NUMBER IN BOM TABLE

  1. Select first cell in region column (e.g. cell below PART_NUMBER)
  2. Right click and select “Report Parameter” from menu.
  3. Select “rpt…” then “rel…” then “User Defined” from menus.
  4. Type “PRTNUM” for symbol text.
  5. Select ”Repeat Region” from menu.
  6. Select “Relations” from menu then select the table.
  7. Enter text to make change required and select OK/Done.
    • IF asm_mbr_name=="S12345_XXX"
    • PRTNUM="S12345"
    • ELSE
    • PRTNUM=asm_mbr_name
    • ENDIF
  8. Select “Update Tables” from menu.

I have heard there is a way to make one rule to cover all instances of names with an underscore, but do not know what it is.


There is always more to learn in Creo.

I haven't tried this in a repeat region relation, but I would assume it would work.

/* Search the asm_mbr_name for "_" and set PRTNUM to be everything to the left of "_"

IF SEARCH(asm_mbr_name,"_")==0

PRTNUM=asm_mbr_name

ELSE

PRTNUM=EXTRACT(asm_mbr_name, 1, (SEARCH(asm_mbr_name,"_")-1))

ENDIF

Thanks everyone for your help. For various reasons I think I will in future go with the flexible model version of parts, rather than use a family table instance simply for this purpose. There are other occasions where we use family tables and we want to display the name of the instance, rather than the generic, or some truncated version of the instance name.

By the way, I found that the repeat region parameter "&asm.mbr.top_generic.name" gives the generic name - no relation needed. When there is no family table it gives the part name.

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags