iLogic shortcut to Content Center Family Customize Window

iLogic shortcut to Content Center Family Customize Window

mtresky
Contributor Contributor
1,162 Views
13 Replies
Message 1 of 14

iLogic shortcut to Content Center Family Customize Window

mtresky
Contributor
Contributor

Hi, I am looking to create a custom tool pallet form which includes shortcuts to the customize menu of content center parts.  I know how to place CC parts via iLogic, but I want the pop up window to customize the part directly from iLogic. See screen shot below...

 

I have also tried a work around since I could not figure this out, which would place the component, then launch the "Change Size" command on said component.  I cannot figure out how to select the component in order to launch the window FOR that component... Ultimate goal, is to just launch the window directly, but I can make it work simply selecting and changing size afterwards... any help would be appreciated!

 

 

mtresky_0-1702562906884.png

 

0 Likes
Accepted solutions (1)
1,163 Views
13 Replies
Replies (13)
Message 2 of 14

mtresky
Contributor
Contributor

Below is my work around code for selecting the component after placing, and launching the "change size" command. This code works great, if the assembly is the top level (open itself). However, majority of the time this will be a sub-assembly within multiple other assemblies. There is no way to tell what level deep in the browser it will be on any given assembly, so this code will not work.  If I cannot place a new and launch the customize menu, how can I tweak this code to select the "NewCC" part no matter the levels deep in the browser it is?

 

 

Dim AssyDoc As AssemblyDocument = ThisDoc.Document

CC = Components.AddContentCenterPart("NewCC", "Tube & Pipe:Fittings:Elbows", "EMT 090 - CUT", "3/4 in EMT GALV-10-10-7")
Dim C90 As ComponentOccurrence
C90 = AssyDoc.ComponentDefinition.Occurrences.ItemByName("NewCC")
Dim occNode As BrowserNode = AssyDoc.BrowserPanes.ActivePane.GetBrowserNodeFromObject(C90)
occNode.DoSelect()
ThisApplication.CommandManager.ControlDefinitions.Item("CCV2ChangeSizeButton").Execute
0 Likes
Message 3 of 14

yuzeaa
Advocate
Advocate

Directly selecting parts may also work for changing sizes.

Dim AssyDoc As AssemblyDocument = ThisDoc.Document
CC = Components.AddContentCenterPart("NewCC", "Tube & Pipe:Fittings:Elbows", "EMT 090 - CUT", "3/4 in EMT GALV-10-10-7")
Dim C90 As ComponentOccurrence
C90 = AssyDoc.ComponentDefinition.Occurrences.ItemByName("NewCC")
ThisApplication.CommandManager.DoSelect(C90)
ThisApplication.CommandManager.ControlDefinitions.Item("CCV2ChangeSizeButton").Execute

 

0 Likes
Message 4 of 14

A.Acheson
Mentor
Mentor

Hi @mtresky 

How are you going to select the part to change size? You have available the manual method using command manager.Pick sample here. If automatically you can search through leaf occurrences or search all occurrences using a loop through assembly sub occurrences. Samples for working with assemblies in article here.

 

In my expierience opening that dialogue is only partial automation you can reach into the family and pull the data in that dialogue box and present it to the user. It is more work but you can limit the choices the user has and or fully automate the change size method. There is samples available on this forum to work with cc family. If you want to go this route I can see if I can find  a sample. 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 14

mtresky
Contributor
Contributor

I do not want them to have to select themselves, the goal of this is to eliminate mouse clicks by having them click once of what they want then customize.  I will review your examples to see if there is something i have not tried yet. thanks!

0 Likes
Message 6 of 14

mtresky
Contributor
Contributor

I am trying to programmatically select the part, I don't want the user to have to take another step selecting for themselves. 

0 Likes
Message 7 of 14

yuzeaa
Advocate
Advocate

Have you tried it?

2023121423105552.png

0 Likes
Message 8 of 14

mtresky
Contributor
Contributor

Yes, that does not actually "select" the component, it just highlights it for you.  if you notice, it is not selected in the browser, thus, the command when run does not tweak THAT component at all... I tried this previously, and ended up going the "browserNode" route, since that actually selects it. however, the browser node approach i did does not work if it is within a sub-assembly.

 

mtresky_0-1702567450938.png

 

0 Likes
Message 9 of 14

A.Acheson
Mentor
Mentor

Hi @mtresky 

You will need a recursion loop to reach the node. See this post here

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 10 of 14

mtresky
Contributor
Contributor

I have the code working like it should, IF I open the assembly in its own tab, which I do not want to do.  Open in its own tab, it truly "selects" the item i call in code, when in the master assembly however, it only highlights the component(s).  I'm looking for a way to run the below code, while I am in an active sub-assembly in the browser (see screen shot).  I cannot figure out why "DoSelect" ONLY works if the selected item is at the top level assembly level. Any ideas?

mtresky_0-1702652083894.png

Dim AssyDoc As AssemblyDocument = ThisDoc.Document

CC = Components.AddContentCenterPart("NewCC", "Tube & Pipe:Fittings:Elbows", "EMT 090 - CUT", "3/4 in EMT GALV-10-10-7")
Dim C90 As ComponentOccurrence
C90 = AssyDoc.ComponentDefinition.Occurrences.ItemByName("NewCC")
ThisApplication.CommandManager.DoSelect(C90)

  

0 Likes
Message 11 of 14

A.Acheson
Mentor
Mentor

Hi @mtresky 

You have to also remember you can only change the part size while in edit mode of the sub assembly occurrence and you will need to do that while working through the browser node tree. Have you tried the recursion method linked earlier. I would expect you will need this eventually. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 12 of 14

mtresky
Contributor
Contributor

I have, same results. I have tried to select the "NewCC" component in about 5 different ways now with no luck other than highlighting it.

 

mtresky_0-1702654251738.png

 

0 Likes
Message 13 of 14

A.Acheson
Mentor
Mentor
Accepted solution

This rule here is working for me. The key is to edit the parent before selecting the occurrence this I believe will set the right context for the command to fire. Checking the active occurrence and exiting to the top will also ensure your not in another assembly and effectively reset the starting point for the editing. 

 

 

Dim assyDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim assyDef As AssemblyComponentDefinition = assyDoc.ComponentDefinition

For Each occ As ComponentOccurrence In assyDef.Occurrences.AllLeafOccurrences
	If occ.Name = "Flange" Then
		Dim activeOcc As ComponentOccurrence = assyDef.ActiveOccurrence
		If Not IsNothing(activeOcc) Then
			activeOcc.ExitEdit(ExitTypeEnum.kExitToTop)
			occ.ParentOccurrence.Edit
		Else
			occ.ParentOccurrence.Edit
		End If

		ThisApplication.CommandManager.DoSelect(occ)
		ThisApplication.CommandManager.ControlDefinitions.Item("CCV2ChangeSizeButton").Execute
	End If
Next

  

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 14 of 14

mtresky
Contributor
Contributor
That did it, thank you for your help, much appreciated!
0 Likes