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

Using config.pro for Your Own App's Config Data

mark_stallard
1-Visitor

Using config.pro for Your Own App's Config Data


Hi Everyone -

I'm a the point where I need to add configuration data to my tool.
In the past, I have defined environment variables in proe.psf (now
parametric.psf), but that approach is messy for a large number of
config options.

I was searching around for a C++ configuration library when I
remembered that Pro/Toolkit has these functions for config.pro
support:

• ProConfigoptGet()
• ProConfigoptArrayGet()

Has anyone defined their own config.pro options successfully?

Will Creo 2 read, tolerate and propagate options that it doesn't
recognize?

I think my support team would be happier without Yet Another
Configuration File for them to maintain.

|+| M a r k |+|

Mark Stallard
Rapid Response Development
Business Application Services
Enterprise Services Information Technology
Global Business Services
Raytheon Company




(business)
339-645-6423
(cell)
617-331-5443



-



235 Presidential Way
Woburn, MA 01801-1060
www.raytheon.com

This message contains information that may be confidential and privileged.
Unless you are the addressee (or authorized to receive mail for the
addressee), you should not use, copy or disclose to anyone this message or
any information contained in this message. If you have received this message
in error, please so advise the sender by reply e-mail and delete this
message. Thank you for your cooperation.






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

I don’t see why that wouldn’t work. I usually use the registry.

Patrick Williams | Engineering Systems | c: 616.947.2110
[cid:image001.jpg@01CEAA24.D7504670]

Patrick -

Thanks for your reply:

> I don’t see why that wouldn’t work.

I agree - and I don't see why it SHOULDN'T work, but it DIDN'T work
when I tried it a moment ago. Creo 2 didn't complain about my self-
defined config.pro options, but - ProConfigoptGet() returned
PRO_TK_E_NOT_FOUND when I tried to read them.

> I usually use the registry.

I might someday use that for user preferences, once I overcome my
phobia of corrupting the Windows OS.

For now, I want to give the user and/or administrator control over
parameters that shouldn't be hard-coded. I'm going to look for
other libraries.

|+| M a r k |+|

Mark Stallard
Rapid Response Development
Business Application Services
Enterprise Services Information Technology
Global Business Services
Raytheon Company




(business)
339-645-6423
(cell)
617-331-5443



-



235 Presidential Way
Woburn, MA 01801-1060
www.raytheon.com

This message contains information that may be confidential and privileged.
Unless you are the addressee (or authorized to receive mail for the
addressee), you should not use, copy or disclose to anyone this message or
any information contained in this message. If you have received this message
in error, please so advise the sender by reply e-mail and delete this
message. Thank you for your cooperation.









Hi Patrick -

Thanks for getting back to me. I tried writing my own config.pro options
and got my answer.

> I don’t see why that wouldn’t work.

I also don't see why it SHOULDN'T work, but it didn't work.
ProConfigoptGet()
returned PRO_TK_E_NOT_FOUND, which implies that Creo ignored the options it
did not recognize.

> I usually use the registry.

For me, for now, plain text files are best. I'm looking for other
libraries.

|+| M a r k |+|

Mark Stallard
Rapid Response Development
Business Application Services
Enterprise Services Information Technology
Global Business Services
Raytheon Company




(business)
339-645-6423
(cell)
617-331-5443



-



235 Presidential Way
Woburn, MA 01801-1060
www.raytheon.com

This message contains information that may be confidential and privileged.
Unless you are the addressee (or authorized to receive mail for the
addressee), you should not use, copy or disclose to anyone this message or
any information contained in this message. If you have received this message
in error, please so advise the sender by reply e-mail and delete this
message. Thank you for your cooperation.









In the <text> dir, there is a config.cdb which has config option
definitions. You might try adding your config option to that file.

Bob Monat

Bob Monat
Jerand Technical Services, Inc.
bob@jerand.com
www.jerand.com
1-317-875-6087


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

Hi all,


Mark, this would not work - Pro/E filters out invalid (from Pro/E point of view) config options on start up - you could see this in std.err file whichcould be found in the Pro/E start up directory.


On the other hand it is quite atrivial taskto write a text file parser which would mimic config.pro functionality. Also there are a number of code samples to get application configuration options from XML files.


The main thing to remember when writing your own config option parser is to stay as close as possibleto Pro/E approach oftraversing config.pro containing directories otherwise you and your users would be thoroughly confused on the long run.


1. Pro/E start up directory


2. application text directory


3. user $home directory


4. working directory


(I'm not quite sure what the precedence is:2 and3 or3 and 2)


HIH.


Feliks.

Announcements
NEW Creo+ Topics: PTC Control Center and Creo+ Portal


Top Tags