Programming Relations
Programming Relations
(OP)
Howdie,
Does anyone know if it is possible to have programming loops inside of a relation?
Also, is there a good, handy programming reference out there for relations outside of the ProE Online Help system?
Thanks.
treddie
Does anyone know if it is possible to have programming loops inside of a relation?
Also, is there a good, handy programming reference out there for relations outside of the ProE Online Help system?
Thanks.
treddie





RE: Programming Relations
http://www.designkb.com/show_tip.php?tip=37
<tg>
RE: Programming Relations
Mathematical Operators used in Pro/E Relations (FAQ554-970)
Using relation editor backdoor to parameters (FAQ554-1132)
Best regards,
Matthew Ian Loew
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips Fora.
RE: Programming Relations
Create a variable "i" or whatever, then in relations add something like this:
i = i+1
if i>= 10
i=0
endif
Then every time you make a regen i will increase with 1, until it reaches 10 and then is reseted.
Im this way I made a roller following a cam between two precise angles (between 20 and 90 degerees) with an increment of 5 degrees.
I start with an agular dimension which controls the a plane orientation and I create a "FLAG" parameter which can have two values: 0 and 1 and I added these relations:
IF D346:10 <= 20
D346:10 = 20
FLAG=0
ENDIF
IF D346:10 >= 90
D346:10 = 90
FLAG=1
ENDIF
IF FLAG == 1
D346:10 = D346:10 - 5
ELSE
D346:10 = D346:10 + 5
ENDIF
Create a mapkey for regen , like "R" key, and every time you touch R key, the system will update.
If this is what you want do with your loop, then give it a try.
-Hora
RE: Programming Relations
I went to great lengths to develop a particular relation (months, in fact), tested it in Visual Basic to ensure its functionality, and then ran into this last stumbling block when trying to implement it as a PRoE relation (which is the TRUE litmus test). There was no analytical solution to the problem so a loop is mandatory. Regen will give me that ability even though the amount of iterations will slow things down a bit. But that is much better than going the "manual" route.
Thanks again.
treddie
RE: Programming Relations
You can create your own interactive program to drive model geometry through relations. Consider the following information on creating user programs:
The User Prog command is available only in Part and Sketcher modes.
Only one user program may be edited or run at a time. However, you can write multiple programs for each part and then run them sequentially.
Each program is limited to a single entry subroutine, called "USRMAIN ()." The entry subroutine can call other subroutines in that program file.
Pro/ENGINEER provides a C file template usermain.c to help you write and use user programs.
You must capitalize Pro/ENGINEER dimensions in user programs.
Use D[i] to refer to a dimension on the screen. This symbol corresponds to di in Part or Assembly mode or to sdi in Sketcher mode. The system does not accept a user-assigned symbol name, such as width, instead of the system-assigned dimension symbol.
Do not use exit statements in any of your routines. To build error handling into your program, use printf or fprintf statements.
You cannot drive assembly dimensions or pattern instance numbers using user programs.
To use an interactive program, you must complete the following steps:
Create a program. Alternatively, you can create a program by editing an existing program.
Compile and link the program.
Run the program to implement the changes.
When the program is finished running, regenerate the model to update geometry.
RE: Programming Relations
RE: Programming Relations
Best regards,
Matthew Ian Loew
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips Fora.
RE: Programming Relations
treddie
RE: Programming Relations
Best regards,
Matthew Ian Loew
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips Fora.
RE: Programming Relations
treddie
RE: Programming Relations
Do you have the linked C programming functionality working on your machine? I tried it a while ago with no success. I'd be interested in finding out what compiler you use and and what steps you had to take to get it to compile the code. Being able to program in C would solve a few problems I've had in the past (mind you, anyone who has programmed C knows that I'm just inviting a host of OTHER problems)
RE: Programming Relations
Was he right, or was he wrong? I don't know. The problem I find is that so much of the professional programming world is built around C, and at SOME point, I'll probably just have to dig in and do it. I use ProE a lot, and as I get into more and more of these elaborate problems, I may have no choice in the matter. But I still try to look for simple alternatives like ProE Program Tool, so that I can avoid C. But that tool is so limited (lack of branching and looping, for instance) that I can't use a lot of the standard practices I'm so familiar with. I hope that PTC will put a lot more functionality in the Program Tool and relations.
treddie
RE: Programming Relations
Only going to ProToolkit can solve the problem, but making a specific program to be linked with specific dimension is time consuming. Especially because ProToolkit is not at all "user friendly" with the majority of compilers.
-Hora
RE: Programming Relations
You other option is to use an Excel Analysis. Link the dimensions to an Excel spreadsheet, and then write up the program in VB in the spreadsheet, or use Excel's tools for iterative solving.
RE: Programming Relations
The Excell/VB thing sounds like another cool alternative. Would be simple, too.
tr
RE: Programming Relations
Try the JKG solution (excel &VB) because is simple. If is not working, then you can try the C programming. For this one, you must have Visual C++ installed.
-Hora
RE: Programming Relations
tr