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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Is it possible to add a short delay between mapkey commands?

cstarnes
10-Marble

Is it possible to add a short delay between mapkey commands?

I have an assembly with a lot of program-driven sub-assemblies, so I created a mapkey that launches a regen and then automatically clicks the "current values" for each subassembly. Besides fixing the annoyance of clicking through 20 subassemblies just to complete a regen, it also works from within some excel automation without user-intervention.

The problem is... the mapkey executes the current values clicks faster than Creo can run the programs...so I end up with regen aborted errors. If I step through them manually (even as fast as I can click), there is no problem.

Is there a way to add a few milliseconds of delay between the "current values" commands in the mapkey?

6 REPLIES 6

I think a better way to fix this is to pass the input values from the top level pro-program via the "execute" blocks.

Here is an program example

VERSION 3.0
REVNUM 15
LISTING FOR ASSEMBLY PRO_PROGRAM_EXAMPLE

INPUT
 PARAMETER_1 NUMBER
 PARAMETER_2 NUMBER
 PARAMETER_3 STRING
 PARAMETER_4 STRING
END INPUT

RELATIONS
END RELATIONS

 EXECUTE ASSEMBLY COMPONENT1
 PARAMETER_1 = PARAMETER_1
 PARAMETER_2 = PARAMETER_3
 END EXECUTE

 EXECUTE PART COMPONENT3
 PARAMETER_1 = PARAMETER_2
 PARAMETER_2 = PARAMETER_4
 END EXECUTE


 ADD FEATURE (initial number 1)
 INTERNAL FEATURE ID  2
 TYPE = COORDINATE SYSTEM
 NAME = ACS0


    FEATURE IS IN LAYER(S) :
      20_ALL_FEATURES - OPERATION = SHOWN
      02_ALL_CSYS - OPERATION = SHOWN

 END ADD

 ADD SUBASSEMBLY COMPONENT1
 INTERNAL COMPONENT ID 6
 END ADD

 ADD PART COMPONENT3
 INTERNAL COMPONENT ID 8
 END ADD

MASSPROP
END MASSPROP

In the execute block you map the input prompts from the child with parameters and/or dimensions from the parent.

child_parameter = parent_parameter

By doing this the "Get Input" menu will shown only once.

I use execute commands extensively and pass several top level parameters down to sub-models. Unfortunately, that isn't an option with a large number of parameters, especially with parameters of the same name in a varying number of sub-models.

It complicates things significantly and won't work within the structure of the automation program.

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

there is a technique to run a system script.

the script could use 'ping' command - 'ping localhost -n 2 > nul' for a delay.

HIH.

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


@FV wrote:

there is a technique to run a system script.

the script could use 'ping' command - 'ping localhost -n 2 > nul' for a delay.

HIH.


the article picture got disappeared for whatever reason...

here is a link

https://www.ptc.com/en/support/article?n=CS151240&language=en&posno=1&q=system%20script&source=search

 

RPN
17-Peridot
17-Peridot
(To:cstarnes)

I can‘t  believe that. My guess is that model regen will run on a sigle thread. If you call an external command, Creo will wait until this finished, doing a sleep command would not help. You may need to wait until the user interface is idle. I would include some dummy picks in the mapkey. But I still think that your program may have an issue. Check your trail file against your mapkeys, you may find commands which where not executed.

cstarnes
10-Marble
(To:RPN)

I didn't think so either, but true story. Creo definitely throws regen errors and doesn't update parameters consistently when stringing together several "current value" clicks in a macro, but works just fine when clicking through them manually. And I see this behavior on multiple machines (running Windows 7).

I solved it by creating a loop in VB (excel program) that runs a macro with a single "current value" click, followed by a short adjustable delay (around 120ms) . Seems to solve the problem. If I go any lower than 100ms or so on the delay, I get the errors.

Top Tags