Skip to main content
1-Visitor
June 8, 2017
Solved

IS IT POSSIBLE TO AUTOMATE THE SELECTION PROCESS

  • June 8, 2017
  • 17 replies
  • 6616 views

Hi Everyone,

Dim selections As IpfcSelections
Dim selectionOptions As IpfcSelectionOptions

       

           
            selectionOptions = (New CCpfcSelectionOptions).Create("dtl_symbol")
            selectionOptions.MaxNumSels = 1
            selections = session.Select(selectionOptions, Nothing)

         

 

Here what i am trying to do is after the selection of one SYMBOL. is it possible to loop the selection process so that all same type SYMBOLshould be selected from the current sheet.

i tried to pass the selected SYMBOL to  "IpfcDetailItems". But is it possible to loop this so that i can get hold of all symbols by selecting one symbol. I tried using For loop but it didn't worked well.

Please tell me a method to select similar kind of symbols from a drawing template.

With Regards
Aghil.M

Best answer by sjuraj

Try this (I use j-link methods, but there are similar in VB):

String symbolName = "B"; // this is text value to compare

DetailItems items = owner.ListDetailItems(pfcDetail.DETAIL_SYM_INSTANCE, null);

DetailSymbolInstItem item = items.get(i);

DetailSymbolInstInstructions instructs = item.GetInstructions(false);

DetailVariantTexts textVals = instructs.GetTextValues();

DetailVariantText textVal = textVals.get(0);

String text = textVal.GetValue(); // this is String value of symbol instance


then you can compatre value:


if (text.equals(symbolName))

    item.Remove();

I hope this will help you.

17 replies

15-Moonstone
June 9, 2017

If your goal is to select all symbols of same type you can easily use search tool and search for symbol by its name:

sym_selecting.PNG

If you need to do it programmically you can create macro in you application. Remebmer your macro will run only after your program returns control to Creo. You can however do it pure programmically:

User will pick instance -> get name of it -> select all model items of dtl_symbol type with name of selecten instance -> remember to put your selections into buffer if the user will need to handle with this selection

1-Visitor
June 9, 2017

Hi skvarka,

Thanks for the reply. As you can see in the image all these balloons are having same symbol name. But my requirement is from this i need to select instances of same name. for Eg: I want to select all symbols with name "B".

I tried the find option but there i didnt find any option to select a perticular instance.Is there any way to get hold to that.

Capture.PNG

The second method what you said that looks interesting. Using selection option i selected one instance and later what i tried is i tried to pass the selection to "IpfcDetailItems" then i created a FOR loop to get the list of Symbol instance.

But its not working well.

Can you please explain me after user selecting one instance how to create a loop so that all symbol with same name should be selected or is there any other method to get this done. I want to delete the symbols of same name by one click.

With Regards

Aghil.M

15-Moonstone
June 9, 2017

In J-link there is method: pfcDetail.DetailSymbolInstInstructions.GetTextValues

I think there is similar in VBScript. This method should return all text values. You have only one text val. so you can compare if selected symbol has specific value.