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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

JLink Question

BrianToussaint
19-Tanzanite

JLink Question

Okay, I've got a question concerning JLink. Are you able to run a mapkey through JLink, and if so how?

What I would like to do is run a mapkey through JLink so that I can output a 3D PDF. I want to be able to do a lot at once and/or be able to do it from Intralink without too much intervention.

Any help will be appreciated.

Sincerely,

Brian Toussaint

CAD Administrator

Hoshizaki America

3 REPLIES 3

Yes - you can do this. But you have to use the RAW Mapkey Code with no line continuations - and definitely not the MAPKEY Shortcut itself.

You also may be able to do this via the Adobe API more directly - been a while since I looked at that.

Dave

Brian,
you can use the Session method RunMacro(String) for this.
Use the raw mapkey string as written in your config file when recorded,
but without the keywords mapkey and mapkey(continued).

If you mapkey sequence is split into several lines, you must call
RunMacro(String) with each line in reverse order, as they are stored on a
FILO stack internal to Jlink.
I store my mapkeys in a text file and then read them in and put them on a
temporary stack in my application. Then popping the stack for each line to
call RunMacro(String). This makes it easy to update the mapkey, as you
store it in the right order.
This also allows you to tokenize some data in the mapkey and replace it
will correct data at runtime. This adds a great deal of flexiblity to the
mapkey.
You can also your own stack to append different mapkey sequences to each
other and build a customized mapkey from programming logic.

Be aware, that the mapkey will not start executing until the J-link
apllications exits. If you need to run several mapkeys with J-link
functionality in between, you must let your mapkey start the next J-link
application and so forth.

Good luck.
Bjarne



"Brian Toussaint" <->
16-03-2009 17:50
Please respond to
"Brian Toussaint" <->


To
-
cc

Subject
[proecus] - JLink Question






Okay, I've got a question concerning JLink.  Are you able to run a mapkey
through JLink, and if so how?
What I would like to do is run a mapkey through JLink so that I can output
a 3D PDF.  I want to be able to do a lot at once and/or be able to do it
from Intralink without too much intervention.
Any help will be appreciated.
Sincerely,
Brian Toussaint
CAD Administrator
Hoshizaki America
----------


> Are you able to run a mapkey through JLink, and if so how?

Mapkeys can be used, but can be tricky to implement when it comes to the Pro/E API's.

As Bjarne mentioned, if you are using the typical synchronous application, the macro is
not executed until control is returned to Pro/E (i.e. all of your code is done and the
user can make menu picks). Trying to mix code and mapkeys together will make your
program really, really complicated, but it can be done.

On the other hand, asynchronous applications execute their mapkey sequences immediately,
without having to wait for control to return to Pro/E. However, async apps don't get
started with Pro/E automatically making them slightly more difficult to implement for
end users. I can provide you with an example asynchronous app that can play a macro if
you'd like.


If you use the same syntax for embedding a mapkey within a mapkey, you can use that in
your application. For example if your mapkey is called "abc", then this would execute
the mapkey in a J-Link application (same concept works for the other API's):
session.RunMacro("%abc");

One benefit to this approach is that the mapkey content is managed by a config.pro file,
not by your application. One drawback is that you cannot change the sequence on the fly
as Bjarne is doing with some of his stuff. Whether this is useful depends on what you're
trying to do.


> What I would like to do is run a mapkey through JLink so that I can output a 3D PDF.
> I want to be able to do a lot at once and/or be able to do it from Intralink without
> too much intervention.

If you're using Intralink 3.x, you might want to consider using trail files, because the
execution can be automated more directly. Trail files and mapkeys are essentially
identical with some formatting differences.

Here's an example for customizing trail files on the fly in Java with Intralink Scripting:
http://inversionconsulting.blogspot.com/2008/04/intralink-scripting-creating.html




Marc
--
Marc Mettes
-
Visit My CAD/PDM AutomationBlog
Or, Subscribe to My CAD/PDM Automation Blog by Email





Top Tags