How to PROGRAMATICALLY make exported WorkFeatures invisible in the assembly

How to PROGRAMATICALLY make exported WorkFeatures invisible in the assembly

oransen
Collaborator Collaborator
472 Views
5 Replies
Message 1 of 6

How to PROGRAMATICALLY make exported WorkFeatures invisible in the assembly

oransen
Collaborator
Collaborator

Now, thanks to this forum, I know how to how to make exported WorkFeatures invisible in the assembly manually I need to know how to do it with the Inventor API.

 

I presume there is a function which takes the assembly definition and the part occurrence,  but I can't find it in the API docs, or an example...

 

0 Likes
Accepted solutions (1)
473 Views
5 Replies
Replies (5)
Message 2 of 6

MechMachineMan
Advisor
Advisor
Accepted solution

What do you mean by exported work feature?

Are you talking about work features from parts that also appear in assemblies? (work feature proxies?)

 

And what is your criteria for deciding which work feature to toggle on and off?

 

What you need to do, regardless, is get the proxy of the work feature as it exists in the context of the assembly and modify that in order to control the visibility of the work feature for that specific occurrence.

 

However, you could also access the part directly and just modify the visibility of the work feature in the part so that work feature shows up in none of the instances of that part.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 3 of 6

Anonymous
Not applicable

if you already have the partOcc defined try this

 

 

partOcc.Definition.Workplane.Item("workplaneName").visible = False

 

 

It should work the same for axis and points just substitute accordingly.

 

 

Hope it helps

 

kl

 

 

 

 

0 Likes
Message 4 of 6

oransen
Collaborator
Collaborator

>>  partOcc.Definition.Workplane.Item("workplaneName").visible = False

 

I think that refers to the original part and not the part as it exists in proxy form inside the assembly.

 

0 Likes
Message 5 of 6

oransen
Collaborator
Collaborator

Thanks MechMachine, the trick was getting the proxy of the workplane. I only have it in C++ but here's how I do it...

 

    CComPtr<WorkPlane> pPianoSupWP=nullptr ; 
    hRes = pFondCompDef->WorkPlanes->get_Item(CComVariant (L"PianoSuperiore"),&pPianoSupWP);
    if (FAILED(hRes)) {
        ShowCOMError(hRes, L"Could not get PianoSuperiore of the fondello");
        return;
    }

    CComPtr<WorkPlaneProxy> pWPProxyA ;
    hRes = pFondOcc->CreateGeometryProxy (pPianoSupWP,(IDispatch**)&pWPProxyA) ;
    if (FAILED(hRes)) {
        ShowCOMError(hRes, L"Could not get proxy PianoSuperiore of the fondello");
        return;
    }

    hRes = pWPProxyA->put_Visible(VARIANT_FALSE);
    if (FAILED(hRes)) {
        ShowCOMError(hRes, L"Could not get set proxy visibility");
        return;
    }

 

Message 6 of 6

oransen
Collaborator
Collaborator

>> However, you could also access the part directly and just modify the visibility of

>> the work feature in the part so that work feature shows up in none of the instances of that part.

 

I forgot to mention that this is how the problem started. If the feature exported is in the iPart table then it seems to be always visible in the assembly that uses that iPart. Even if you set it to be invisible in the iPart itself...

 

 

0 Likes