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

Access username (like PTC_WM_CREATED_BY or other) from part .prt BEFORE saving into Windchill

MK_10035814
3-Visitor

Access username (like PTC_WM_CREATED_BY or other) from part .prt BEFORE saving into Windchill

I am using Creo Parametric 7.0 7.0.4.0

When creating a new part (.prt) with Creo parametric, I would like to assign a parameter named "CREATED_BY" with the current user logged into Windchill (peaple log into Windchill when launching Creo Parametric).

I know the PTC_WM_CREATED_BY (and PTC_WM_MODIFIED_BY, etc.) are recorded into the .prt when pushed into Windchill.
I would like to access the value stored into PTC_WM_CREATED_BY immediatly when a new part (.prt) is created.
Like this I can search into it and fetch first letters of name and surname from the email like : john.do@organization.com becomes --> jdo

Currently, our default .prt template has this relations :
CREATED_BY=EXTRACT(PTC_WM_CREATED_BY,SEARCH(PTC_WM_CREATED_BY,"(")+1,1)+EXTRACT(PTC_WM_CREATED_BY,SEARCH(PTC_WM_CREATED_BY,".")+1,2)

It work but only after saving AND pushing into Windchill, refreshing and save it again into Windchill (which is not very convignient).

Overall, I want a way to access the username when user has logged into Windchill trough PTC Creo Parametric.


Could you please help ?

1 ACCEPTED SOLUTION

Accepted Solutions

If I were tasked with this, I would first question the need to do all this - - the information is all there recorded in Windchill and in the part file.

You can build reports from Windchill, and for drawings, you can have the standard parameters PTC_WM_CREATED_BY / PTC_WM_MODIFIED_BY shown directly in your title block format...

 

Short-circuiting the whole upload/checkin process sounds convenient, but seems like wrong way to go for several reasons: 1) you have to maintain custom parameters that will be called out on the drawing title block 2) the information in these parameters will at best be redundant and can you ensure everything will be consistent? 3) the file history has the user's login name, but not their full name.

 

I submit that you are trying to tackle a problem without a need of a solution - namely, the inconvenience of having to first upload the model for the PTC_WM* parameters to become available.  Moreover, how often does anyone have the model finished and ready to check-in on the first save?

 

Now, the practice of saving and uploading your work into Windchill - that is a user training problem - from my past experience, users just don't get it (I don't blame them, Windchill is very complicated).

Anyway, if you must do this with part relations, then I suggest you bake into them some hints such as:

if exists("PTC_WM_MODIFIED_BY")
  TITLE_BLOCK_MODIFIED_BY =  PTC_WM_MODIFIED_BY
ELSE
  TITLE_BLOCK_MODIFIED_BY = "ERROR - PLEASE UPLOAD YOUR MODEL TO WINDCHILL AND REFRESH"
ENDIF

 

 

If you insist that you have to avoid the upload process and generate the CREATED_BY parameter, then you can build a mapkey that first starts the file history tool, then makes a system call to start an external script to parse the generated history information file and saves this information to another file, which is then brought into the table.  The other posts in this thread have the details.  To add my final 2cents - on my system, the file modiflist.inf is created / updated in the working directory whenever the tools->investigate->file history function is used.  So building a mapkey around that file might simplify things...

View solution in original post

7 REPLIES 7

Hi,

I guess requested functionality is not available OOTB.


Martin Hanák

Hmm and something not OOTB ?

Is there any workaround availlable ? 

 

We are making more than +2000 drawing per year (per designer) with shared config.sup and config.pro environnemnt.

Our organization do not allow us to have a custom config.pro. So it is very painful and time consuming to manually type the "designer" name on each page of each drawing everyday.

A solution from PTC would be very appreciate 🙂

 

Thx

BenLoosli
23-Emerald II
(To:MK_10035814)

Have you looked at using a Restricted Parameters file to drive your fixed names?

I use one for all of the names used by my local Drawn_by, Engineered_by, Checked_by and 4 or 5 other 'signature' names that go into our drawings. Makes it easy to get the names with correct formatting (uppercase and appearance) so the user does not have to worry about that. Just select the name from a drop-down list.

You cane use them for any parameter driven field used in your drawings or notes where you want to restrict what may be entered.

In my case, we enter 'first_name Last_name' in some fields while other fields are 'Initial Initial Last_name'. We also have a couple of regulatory markings on our drawings that have variable text for approvals that need assigned depending on the drawing status.

TomU
23-Emerald IV
(To:MK_10035814)

We use a mapkey to read the contents of a text file from the working directly and paste it into a table cell.  Just change the text file contents to match the designer's name or initials.

 

date.txt

&todays_date
J.Doe

mapkey:

mapkey dt @MAPKEY_NAMESet date in revision table;@MAPKEY_LABELDate;\
mapkey(continued) ~ Command `ProCmdDwgTblDeleteContents` ;~ Command `ProCmdDwgTblProperties` ;\
mapkey(continued) ~ Command `ProCmdDtlTextFromFile` ;\
mapkey(continued) ~ Activate `file_open` `computer_pb`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `c:`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `ptc`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `workspaces`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `date.txt`;\
mapkey(continued) ~ Key `main_dlg_cur` `proe_win` 65536 `Esc`;\
mapkey(continued) ~ Command `ProCmdDtlSetCenterJustify`  1;\
mapkey(continued) ~ Command `ProCmdDtlSetMiddleJustify`  1;\
mapkey(continued) ~ Command `ProCmdDtlSetTextFont`  `gothic`;\
mapkey(continued) ~ Command `ProCmdDtlSetTextHeight`  0.062500;\
mapkey(continued) ~ Command `ProCmdOaDeselectAll`;

 


@MK_10035814 wrote:

Hmm and something not OOTB ?

Is there any workaround availlable ? 

 

We are making more than +2000 drawing per year (per designer) with shared config.sup and config.pro environnemnt.

Our organization do not allow us to have a custom config.pro. So it is very painful and time consuming to manually type the "designer" name on each page of each drawing everyday.

A solution from PTC would be very appreciate 🙂

 

Thx


Hi,

you can create new part in Windchill environment and then open it in Creo. Such part contains PTC_WM_CREATED_BY parameter filled by current Windchill user name.


Martin Hanák
Chris3
20-Turquoise
(To:MK_10035814)

I would strongly suggest you try and keep this out of the relations. Having it in the relations means that it is one more thing that needs to be processed every time the part gets a regen. When you start having 1000s of parts all with this relation it will add up to a performance hit.

 

If this was my task, I would create a mapkey that clicked Tools -> Investigate -> File History -> File

 

Then I would launch a system script (batch, vbs, etc) that parsed the modification history to find the line that says 

ABC123.PRT The model was copied from: 0001-START-PART.PRT

 

And strip out the next column which has the user name. You could save this as a seperate text file (with the script) and then import that text file back into the CREATED_BY parameter with a continuation of the original mapkey.

 

See this example here:

https://community.ptc.com/t5/System-Administration/Re-Mapkey-Writing-Editing-Tips/m-p/760718/highlight/true#M27487

If I were tasked with this, I would first question the need to do all this - - the information is all there recorded in Windchill and in the part file.

You can build reports from Windchill, and for drawings, you can have the standard parameters PTC_WM_CREATED_BY / PTC_WM_MODIFIED_BY shown directly in your title block format...

 

Short-circuiting the whole upload/checkin process sounds convenient, but seems like wrong way to go for several reasons: 1) you have to maintain custom parameters that will be called out on the drawing title block 2) the information in these parameters will at best be redundant and can you ensure everything will be consistent? 3) the file history has the user's login name, but not their full name.

 

I submit that you are trying to tackle a problem without a need of a solution - namely, the inconvenience of having to first upload the model for the PTC_WM* parameters to become available.  Moreover, how often does anyone have the model finished and ready to check-in on the first save?

 

Now, the practice of saving and uploading your work into Windchill - that is a user training problem - from my past experience, users just don't get it (I don't blame them, Windchill is very complicated).

Anyway, if you must do this with part relations, then I suggest you bake into them some hints such as:

if exists("PTC_WM_MODIFIED_BY")
  TITLE_BLOCK_MODIFIED_BY =  PTC_WM_MODIFIED_BY
ELSE
  TITLE_BLOCK_MODIFIED_BY = "ERROR - PLEASE UPLOAD YOUR MODEL TO WINDCHILL AND REFRESH"
ENDIF

 

 

If you insist that you have to avoid the upload process and generate the CREATED_BY parameter, then you can build a mapkey that first starts the file history tool, then makes a system call to start an external script to parse the generated history information file and saves this information to another file, which is then brought into the table.  The other posts in this thread have the details.  To add my final 2cents - on my system, the file modiflist.inf is created / updated in the working directory whenever the tools->investigate->file history function is used.  So building a mapkey around that file might simplify things...

Top Tags