Skip to main content
10-Marble
August 9, 2016
Solved

Create Mapkey to select the last balloon created

  • August 9, 2016
  • 2 replies
  • 5189 views

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.
Best answer by James62

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.

2 replies

1-Visitor
August 10, 2016

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?

10-Marble
August 11, 2016

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.

1-Visitor
August 12, 2016

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.

12-Amethyst
August 12, 2016

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;

10-Marble
August 12, 2016

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.

1-Visitor
November 9, 2016

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