[Inventor API] Change size Content Center with API

[Inventor API] Change size Content Center with API

Khoa_NguyenDang
Advocate Advocate
1,093 Views
4 Replies
Message 1 of 5

[Inventor API] Change size Content Center with API

Khoa_NguyenDang
Advocate
Advocate

Hi all you guys

I am want to use this command Change Size Content Center with API (When I select a content center member and click the button in window form, it will show the dialog to change the Content Center Member). Like in the picture.

Khoa_NguyenDang_1-1632414335660.png

I am trying with this code below, but it has error

Khoa_NguyenDang_2-1632414527346.png

If someone knows about this, hope you can help me.

Thank you so much

 

0 Likes
Accepted solutions (2)
1,094 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

Hi @Khoa_NguyenDang.  This has been a fairly popular subject in the past.  What programming language are you using, C#?  Anyways, here are some links to some other posts where they are changing content center components.  I don't think any of them are in C# though.  Do you need to get the component from the browser node, or would it be OK to get it another way?

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/for-loop-for-changing-the-size-of-conte... 

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/access-quot-change-size-quot-for-a-cont... 

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/ilogic-change-size-of-custom-bolt/m-p/1... 

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/content-center-component-change-size-on... 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 5

Khoa_NguyenDang
Advocate
Advocate

Hi @WCrihfield 

 

I use C# in API 

Thanks for your link above. I also checked it before. But it not related to my requried

I just want to show the dialog, not change to the specific member of the content center component

 

Do you have heard before? Thank you so much

0 Likes
Message 4 of 5

A.Acheson
Mentor
Mentor
Accepted solution

Here is the command button for change size with Inventor 2020. A note you can only selected one occurrence and change it's size using this method. If you select more than one manually the command is unavailable  in the menu. So if you select more than one with the API only the first selected will be changed. 

 

Dim oCDs As ControlDefinitions
 oCDs = ThisApplication.CommandManager.ControlDefinitions
  
Dim oCD As ControlDefinition
oCD = oCDs("CCV2ChangeSizeButtonCM")
 Call oCD.Execute

 

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

Khoa_NguyenDang
Advocate
Advocate
Accepted solution

Thank you so much, It works

I also share my code in C#

ComponentOccurrence oOcc = (ComponentOccurrence)_invApp.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select a Content Center Member");

SelectSet oSel_Occ = _invApp.ActiveDocument.SelectSet;
oSel_Occ.Select(oOcc);
ControlDefinitions oCDs = default(ControlDefinitions);
oCDs = _invApp.CommandManager.ControlDefinitions;
ControlDefinition oCD = default(ControlDefinition);
oCD = oCDs["CCV2ChangeSizeButtonCM"];
oCD.Execute();
oSel_Occ.Clear();