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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

how to play macro from relation

rsobecki
13-Aquamarine

how to play macro from relation

I wish to review the main relation in my complex part and also relations putted into Footer feature to review and be able to stop the pro/program workflow, so my idea is to play a mapkey with several annotation using comment functionaluty in mapkeys and be able to resume the workflow when I want.

Question: how can I run the mpkey from relation script?

ACCEPTED SOLUTION

Accepted Solutions
TomU
23-Emerald IV
(To:rsobecki)

Relations can't call mapkeys.  Relations simply process the lines inside them, top to bottom.

View solution in original post

19 REPLIES 19
TomU
23-Emerald IV
(To:rsobecki)

Relations can't call mapkeys.  Relations simply process the lines inside them, top to bottom.

rsobecki
13-Aquamarine
(To:TomU)

Thanks Tom, this explain a lot, but maybe you have an idea how the best debug the workflow?

Changing lines in relations into comments is painful..

Hi,

 

I am sorry I do not understand your question. Please provide some examples (pictures with comments).


Martin Hanák
rsobecki
13-Aquamarine
(To:MartinHanak)

to comment a relation we need to use "/*" for example:

/********** WALL THICKNESS CALCULATION **********
/* FIRST  CALCULATE A NEW WALL THICKNESS TO TRY AND OBTAIN THE REQUIRED \
/*CAPACITY.
/* MAKE SURE IT IS NOT TOO BIG OR TOO SMALL.
/* THEN IF A WALL THICKNESS OVERRIDE IS SET, MAKE IT EQUAL THE OVERRIDE VALUE.
/*  IF A WALL THICKNESS OVERRIDE IS SET, SKIP OVER THE CAPACITY CHECK THAT \
/*TRIES TO CHANGE THE WALL THICKNESS
/* OTHERWISE IT MAY NOT GO GREEN.

/* WALL_THICKNESS MANUALLY SET
IF (WALL_THICKNESS_OVERRIDE >1)
WALL_THICKNESS = WALL_THICKNESS_OVERRIDE
ENDIF

and if you wish to check and review some conditions and see if during regenerations and update Creo run specific way or as I call it workflow (perhaps purly driven by Pro/Program) using this combination "/*" to switch on / off some part of relation script is really painful.

Maybe ther is some smart solution to visualize where we are in the process during regeneration as for example:

1° flow through the relation in PART script first

2° then follow each part feature (as in Pro/Program)

3° do what is in Footer at the end (I have here also long relation script for annotations wisible on screen to have them up to date)

4° user press regenerate if relations still adjusting some parameters like WALL_THICKNESS for example...

 

this is because I was thinking about using a mapkey raised by relations to see where is the process currently 🙂

Hi,

 

from your explanation I understand that sometimes you need to comment several relations. Maybe you can enclose these relations into IF command and use parameter to turn it on/off, for example:

/* set MYPAR1 = 0 to turn relations OFF

/* set MYPAR1 = 1 to turn relations ON

IF (MYPAR1 == 1)

  IF (WALL_THICKNESS_OVERRIDE >1)
  WALL_THICKNESS = WALL_THICKNESS_OVERRIDE
  ENDIF

ENDIF


Martin Hanák
rsobecki
13-Aquamarine
(To:MartinHanak)

thanks, but not exactly - I shown as just tad example of my relations in real I have something about 400 lines of relations partly locaded in main PART relations some in features and some in Footer features, so Pro/Program of my template is build from 5243 lines...

 

My need is to have something like breakpoints and have ability to set them as many I want without necessity to reprogramming the relations as you displayed so we are looking farther...

Hi,

 

so ... your model is complex and you cannot describe all its details using words, only. If you want to get information from user community, you have to provide Creo model for testing purposes. If you cannot upload your real part, you can create its simplified version.


Martin Hanák
rsobecki
13-Aquamarine
(To:MartinHanak)

if you have solution in maind how to add such breakpoint to stop running the regeneration process and also ability to resume the process = you have the knowledge and no parts example is needed for this Smiley Tongue

Hi,

 

1.) clicking Regenerate button starts regeneration process which is uninterruptible

2.) to simulate regeneration step by step, user can use Tools > Model Player

3.) a solution you are looking for is probably Toolkit application


Martin Hanák
TomU
23-Emerald IV
(To:rsobecki)

The only other thing you might be able to do is use IF statements to create "fake" breakpoints based on the value of some parameter.

 

IF BREAKPOINTS > 0

  /* Do Stuff

  /*

  /*

ENDIF

 

IF BREAKPOINTS > 1
  /* Do Stuff
  /*
  /*
ENDIF

 

IF BREAKPOINTS > 2
  /* Do Stuff
  /*
  /*
ENDIF

 

IF BREAKPOINTS > 3
  /* Do Stuff
  /*
  /*
ENDIF

 

An so on...

Hi,

 

I have never used them myself before, but maybe the INTERACT statement could help you in this case.

 

Using INTERACT Statements as Place Holders 
INTERACT statements provide a placeholder for creating interactive part and 
assembly features. They can be inserted anywhere within the 
FEATURE ADD - END ADD or PART ADD - END ADD statement. Interact mode works similarly to Insert mode accessed from Pro/ENGINEER. Executing an INTERACT Statement When the system encounters an INTERACT statement in the program,
the execution of the program is interrupted. At this point, you
can add new features. Also at this point, the system displays an
incomplete model built up according to the last instruction before
the INTERACT statement. In Interact mode, the model is frozen
and cannot be modified. After you are in Interact mode, select any feature you want to add
from the FEAT CLASS menus and proceed to specify all required parameters.
After you have created a new feature, the system asks whether you want to
continue adding features. If you answer N, program execution resumes.
After execution is completed, any new features added within the INTERACT
statement replace the INTERACT statement in the model design. Note: You can quit interacting immediately after the program moves
into the INTERACT phase (before you start to create features).
Choose Done/Return from the FEAT CLASS menu and answer N to the
system prompt asking if you want to continue. The program resumes
execution and proceeds to the end.

Hope this helps

It seems like my first post, which I edited for markup, was lost...so here goes again.

 

I haven't used them myself, but maybe the INTERACT statement is something to look into

 

Using INTERACT Statements as Place Holders
INTERACT statements provide a placeholder for creating interactive part and
assembly features. They can be inserted anywhere within the FEATURE ADD - END
ADD or PART ADD - END ADD statement.

 

Interact mode works similarly to Insert mode accessed from Pro/ENGINEER.

 

Executing an INTERACT Statement
When the system encounters an INTERACT statement in the program, the execution
of the program is interrupted. At this point, you can add new features. Also at this
point, the system displays an incomplete model built up according to the last
instruction before the INTERACT statement. In Interact mode, the model is frozen
and cannot be modified.


After you are in Interact mode, select any feature you want to add from the FEAT
CLASS menus and proceed to specify all required parameters. After you have
created a new feature, the system asks whether you want to continue adding
features. If you answer N, program execution resumes. After execution is completed,
any new features added within the INTERACT statement replace the INTERACT
statement in the model design.


Note: You can quit interacting immediately after the program moves into the
INTERACT phase (before you start to create features). Choose Done/Return from
the FEAT CLASS menu and answer N to the system prompt asking if you want to
continue. The program resumes execution and proceeds to the end.

Hmmm...it seems like you don't have access to the RELATIONS when the PRO/PROGRAM hits the INTERACT statement. In fact, the options you have a very limited.

if you are debugging, suppress all features below the one that's failing for starters.

also reorder your relations (if they call one another or specific dimensions) and verify the references of the failing feature first.

the first part is tedious, because you will have to delete all the IF clauses, reorder and then reinstate them.

 

also if you develop those templates, try to use at least some version control (not just .1, .2, .3.... file history). add new features in smallish chunks, verify that they are working and backup it before doing any more changes.

 

as the relations go, it's better to export them and edit them in notepad++ for any major changes, if you ask me.

it's also best to keep history of working releases.

 

what kind of an assembly do you have, if you don't mind me asking?

rsobecki
13-Aquamarine
(To:rmcboaty)

This is single part model, but complexity comes due to self adjustable parameters (like for example WALL_THICKNESS driven by the analysis results located into model tree.

At the end of the tree in Footer I have last relations set to review if all parameters are ok or not and if not user need to regenerate again to get better or the best wall thickness simulation within required accuracy.
Disadvantages for the moment is unknown number of required regenerations to go to green status (no further regeneration required) and knowledge why sometimes it is done after 2-3 cycles and in some cases it needs much more...
This is nothing about failure in features - the model working well and I can't supress some features or set insert here in the middle of the tree because all model structure is vital for final results.
This is more about debugging how it works and improve it 🙂

Hi,

 

I have decided to practise J-Link programming. I'm not an expert in Java and J-Link programming but I am able to develop simple application using examples and J-Link API help.

 

Some time ago I created mybottle.prt and gave me a task to find out height of water level, if I fill the bottle with 1,000,000 cubic millimeters. The model contains post-regeneration relations, which enable me to find dimension value related to DTM1.

 

Today I created J-Link which repeatedly regenerates the model and check the value of MYSTATUS parameter. When its value is set to FINISHED using relations, the application stops.

 

If you are interested, please see attached  video regen_until_finished.mp4


Martin Hanák
rsobecki
13-Aquamarine
(To:MartinHanak)

Wow thank you for you engagement!
I see this can be useful also for me in future!
Currently I'm focused to really speed up the final result and to decrease as much as possible number of regeneration and due to this my aim is to be able to debug the regeneration process.
When my regeneration process will be the fastest possible - then maybe I'll be able to follow your solution 🙂
Good work by the way!

maybe you could separate logic from the model itself.

encapsulate the logic (wall thickness calc etc) in an Excel sheet for example and use the model just for geometry (reading values from that excel).

these creo/ wf relations are very limited and it will probably just come back to you one day.

rsobecki
13-Aquamarine
(To:HamsterNL)

Thanks for this entry - I need to play with this INTERACT - songs promising 🙂
Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags