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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Create Mapkey to select the last balloon created

MuriloSilva
10-Marble

Create Mapkey to select the last balloon created

Hello everyone.

Does anyone know how to create a mapkey to select the last balloon created?

I need that when a user finish creating the balloon it be already selected. It's possible?

Thank you very much.


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.
ACCEPTED SOLUTION

Accepted Solutions

Hi,

It turns out that I was right on this little theory of mine above saying that the last balloon added to the drawing might be the last symbol instance as seen in an array by J-Link.

Bellow is the core of the Java code that happens to select the last balloon or any symbol instance for that matter that has been added to the drawing.

Window window = session.GetCurrentWindow();

Model model = window.GetModel();

// autoselect all symbol instances

ModelItems modelItems = model.ListItems(ModelItemType.ITEM_DTL_SYM_INSTANCE);

// retrieve the symbol positioned at the end of the array

ModelItem modelItem = modelItems.get(modelItems.getarraysize() - 1);

// add the symbol to a new selection

Selection selection = pfcSelect.CreateModelItemSelection(modelItem, null);

// get the current selection buffer

SelectionBuffer selBuffer = session.GetCurrentSelectionBuffer();

// erase the current selection buffer

selBuffer.Clear();

// add the selection to a the selection buffer

selBuffer.AddSelection(selection);

Hopefully you will be able to figure out how to run J-Link and set it up throught your company. If you run into any trouble just throw me a PM.

View solution in original post

12 REPLIES 12

I don't think it can be done using say find tool within a regular mapkey.

It'd propably require J-Link or maybe any other API that can see the bom balloon symbol instances in an array. That way all it would take is to select programatically the last member of the array, if they are added to the array in the same order as they are created.

To select programatically means having J-Link to load it into the selection buffer.

Can you explain a bit better why would you need anything like this?

Hello James. Thank you for your comment.

Sorry I haven't answered before.

Here in our company the lead-time is greatly reduced and any gain is important.

When we create a balloon always we need to adjust the "edit attachment" and the balloon's position, so it would be interesting a mapkey to create a balloon in first click, the second click to indicate the surface for attachment and the third click the definition of its location.

I've created two mapkeys, one only to create the balloon and the other mapkey that makes the others procedures, but together these mapkeys would gain the most.

What remains to join the two mapkeys is to create a means to select the last created balloon.

All i can tell right now is that i'd be interested in seeing such macro, because ballooning assemly drawings in Creo is just pain and torture.

I'll try to remember this and try if J-Link can possibly select the last balloon, but right now just bear with me, it's gonna take me a while to get to that.

Hi James.

Really, ballooning assembly drawings in Creo is just pain and torture.

Actually I've created about 200 mapkeys to optimize the work in our company.
Some used by menu and others by key sequence.

Here are some mapkeys:

!**** MAPKEY TO CREATE BALLOON ************

mapkey cb @MAPKEY_LABELCREATE BALLOON;~ Command `ProCmdDwgTblBlnShowCompVw`;\

mapkey(continued) @PAUSE_FOR_SCREEN_PICK;~ Activate `GET SELECT` `done_sel`;

!**** MAPKEY ONLY TO EDIT ATTACHEMNT ************

mapkey ea @MAPKEY_LABELEDIT ATTACHMENT;\

mapkey(continued) ~ Timer `UI Desktop` `UI Desktop` `popupMenuRMBTimerCB`;\

mapkey(continued) ~ Close `rmb_popup` `PopupMenu`;~ Command `ProCmdDwgPopEditAtt` ;#ON SURFACE;\

mapkey(continued) @PAUSE_FOR_SCREEN_PICK;#DONE/RETURN;

!**** MAPKEY TO EDIT ATTACHEMNT AND POSITION ************

mapkey bb @MAPKEY_NAMEBALOES;@MAPKEY_LABELCONFIG. BALOES;\

mapkey(continued) ~ Open `main_dlg_cur` `Sst_bar.filter_list`;\

mapkey(continued) ~ Close `main_dlg_cur` `Sst_bar.filter_list`;\

mapkey(continued) ~ Activate `main_dlg_cur` `page_Table_control_btn` 0;\

mapkey(continued) ~ Open `main_dlg_cur` `Sst_bar.filter_list`;\

mapkey(continued) ~ Close `main_dlg_cur` `Sst_bar.filter_list`;\

mapkey(continued) ~ Select `main_dlg_cur` `Sst_bar.filter_list` 1 `40_BOM Balloon_SEL FILTER`;\

mapkey(continued) ~ Timer `UI Desktop` `UI Desktop` `popupMenuRMBTimerCB`;\

mapkey(continued) ~ Close `rmb_popup` `PopupMenu`;~ Command `ProCmdDwgPopEditAtt` ;#CHANGE REF;\

mapkey(continued) #ON SURFACE;#FILLED DOT;@PAUSE_FOR_SCREEN_PICK;#DONE/RETURN;\

mapkey(continued) ~ Timer `UI Desktop` `UI Desktop` `popupMenuRMBTimerCB`;\

mapkey(continued) ~ Close `rmb_popup` `PopupMenu`;~ Command `ProCmdEditProperties`;\

mapkey(continued) ~ Activate `drawing_sym_asynch` `Move_modif_sym`;\

mapkey(continued) ~ Move `drawing_sym_asynch` `drawing_sym_asynch` 2 20.499523 25.571020;\

mapkey(continued) @PAUSE_FOR_SCREEN_PICK;\

mapkey(continued) ~ Move `drawing_sym_asynch` `drawing_sym_asynch` 2 0.427073 8.648236;\

mapkey(continued) ~ Activate `drawing_sym_asynch` `OK_modif_push`;\

mapkey(continued) ~ Open `main_dlg_cur` `Sst_bar.filter_list`;\

mapkey(continued) ~ Close `main_dlg_cur` `Sst_bar.filter_list`;\

mapkey(continued) ~ Select `main_dlg_cur` `Sst_bar.filter_list` 1 `48_Table Context \

mapkey(continued) Default_SEL FILTER`;

!**** MAPKEY CREATE DIMENSION ************

mapkey dd @MAPKEY_LABELDRAWING DIMENSION;\

mapkey(continued) ~ Activate `main_dlg_cur` `page_Annotate_control_btn`1;\

mapkey(continued) ~ Command `ProCmdDwgCrStdNewRefDim`;

mapkey nn @MAPKEY_LABELDRAWING NOTE;~ Command `ProCmdDwgCreateNote`;

See below for a demonstration of some Mapkeys:

Video Link : 7156

Hi,

It turns out that I was right on this little theory of mine above saying that the last balloon added to the drawing might be the last symbol instance as seen in an array by J-Link.

Bellow is the core of the Java code that happens to select the last balloon or any symbol instance for that matter that has been added to the drawing.

Window window = session.GetCurrentWindow();

Model model = window.GetModel();

// autoselect all symbol instances

ModelItems modelItems = model.ListItems(ModelItemType.ITEM_DTL_SYM_INSTANCE);

// retrieve the symbol positioned at the end of the array

ModelItem modelItem = modelItems.get(modelItems.getarraysize() - 1);

// add the symbol to a new selection

Selection selection = pfcSelect.CreateModelItemSelection(modelItem, null);

// get the current selection buffer

SelectionBuffer selBuffer = session.GetCurrentSelectionBuffer();

// erase the current selection buffer

selBuffer.Clear();

// add the selection to a the selection buffer

selBuffer.AddSelection(selection);

Hopefully you will be able to figure out how to run J-Link and set it up throught your company. If you run into any trouble just throw me a PM.

Hi,

Through J-Link can able to retrieve all balloon's text/index available in the current drawing?

James62
12-Amethyst
(To:sekambaram)

Sure, I'd say yeah. J-Link can read texts of all balloons.

How? You have any example code for that please reply and explain me, because,I search the name of BOM Balloon in J-Link API i can't find that details.

James62
12-Amethyst
(To:sekambaram)

I haven't been looking into J-Link for a month or so now, but as i remember the BOM Balloon is a symbol instance. Well, looking at the code in my previous reply I guess that's kinda obvious for some of us geeky enough. I even say that in the text. Once you got that symbol instance you could try to cast it to a note and then retrieve text from the note. To get all texts you'd have to put that all in a loop.

Anyway, if you really wanna know and challenge yourself with it i recommend you to start a new discussion. Just so in case you get the right answer it is easier to search for it for someone else having the same problem in the future.

When you place a balloon, the ballon stays selected until you pick a point on screen to deselect it.

So, you just have to end your first mapkey before the ballon is deselected, then call the following mapkeys.

Look at the example bellow, mapkey F10 will create a balloon and in the end will call mapkey F11 do edit attachment.

Hope it helps.

Jose

mapkey $F10 ~ Command `ProCmdDwgCreateBallon` ;#WITH LEADER;#MAKE NOTE;@PAUSE_FOR_SCREEN_PICK;\

mapkey(continued) @PAUSE_FOR_SCREEN_PICK;#;#DONE/RETURN; %$F11;

mapkey $F11 ~ Command `ProCmdDwgModAtt` ;@PAUSE_FOR_SCREEN_PICK;#DONE/RETURN;

Hi Jose Costa.

Thank you by your comment, but this balloon type don't is used here.

We use only the balloon  "created by component" (controled by table with repeat region), and this type of balloon don't stay selected after your creating.

James62 is right I think. This cannot be solved by macro, you have to use J-Link or Pro/Toolkit code...

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags