Announcements

Announcement: We’re aware of an issue affecting starting a new topic from category pages and creating new blog posts. New topics can still be started directly from the relevant board. Learn more here.

Unsupress machinings in weld assembly

Unsupress machinings in weld assembly

mowag
Enthusiast Enthusiast
457 Views
4 Replies
Message 1 of 5

Unsupress machinings in weld assembly

mowag
Enthusiast
Enthusiast

Hi all,

I've managed to suppress machinings in a weld assembly.  How do i unsupress these features again ??

Our milling machine operator wants a simpliefied part of the assembly with AND without the machinings(supressed). It's the intention to make 2 simplified parts of the weld assy ( one with and one without the machinings). 

            if (_inventordataService.oInvDoc.DocumentType == DocumentTypeEnum.kAssemblyDocumentObject)
            {
                if (_inventordataService.oInvDoc.SubType == CLSID_InventorWeldAssembly_RegGUID )
                {
                    Inventor.CommandManager cm = _inventordataService.invApp.CommandManager;
                    ControlDefinitions cds = cm.ControlDefinitions;

                    BrowserPane oPane = _inventordataService.oInvDoc.BrowserPanes["AmBrowserArrangement"];
                    foreach (BrowserNode oWNode in oPane.TopNode.BrowserNodes)
                    {
                        if (oWNode.BrowserNodeDefinition.Label == "Machining")
                        {
                            foreach (BrowserNode oMNode in oWNode.BrowserNodes)
                            {
                                oMNode.DoSelect();
                                _inventordataService.invApp.SilentOperation = true;
                                cds["AssemblySuppressFeatureCtxCmd"].Execute2(true);
                                _inventordataService.invApp.SilentOperation = false; 
                            }
                        }
                    }

                }

 

Kind Regards

 

Johan

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

JelteDeJong
Mentor
Mentor
Accepted solution

Machinings are just features that you can suppress or un suppress. Your code could look something like this:

 

if (_inventordataService.oInvDoc.DocumentType != DocumentTypeEnum.kAssemblyDocumentObject) return;
if (_inventordataService.oInvDoc.SubType != CLSID_InventorWeldAssembly_RegGUID) return;

AssemblyDocument doc = _inventordataService.oInvDoc as AssemblyDocument;

foreach (PartFeature item in doc.ComponentDefinition.Features)
{
    item.Suppressed = false;
}

 

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 5

mowag
Enthusiast
Enthusiast

Hi,

 

Thank you for pointing me to that 'route' !

 

I changed ExtrudeFeature to PartFeature, so i can supress and unsupress all features in one go ! 

The 'command' route isn't the way to go then ( no AssemblyUnSuppressFeatureCtxCmd method ) ?

 

Anyways thanks alot !!

 

                    foreach (PartFeature item in doc.ComponentDefinition.Features)
                    {
                        item.Suppressed = true;
                    }

 

 

Kind Regards

 

Johan

0 Likes
Message 4 of 5

mowag
Enthusiast
Enthusiast
I'am new to the forum and i accidentely pressed the wrong 'accept as solution button'. Now it looks like is solved this too, which i haven't. Can this be undone ?
0 Likes
Message 5 of 5

JelteDeJong
Mentor
Mentor

The ExtrudeFeature was a typo. As you mentioned it should be PartFeature. I have updated the original post. 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes