Inventor API Material Reading Issue

Inventor API Material Reading Issue

Anonymous
Not applicable
693 Views
7 Replies
Message 1 of 8

Inventor API Material Reading Issue

Anonymous
Not applicable

I have attached Inventor 2019 assembly.

Please refer the assembly “Fishing Rod Assembly.iam”.

Loading the part file "Fishing Rod.ipt" gives different face colours. But when we load the top-level assembly (_Fishing Rod Assembly.iam) it gives the same color for(Fishing Rod.ipt) all the faces.

 

0 Likes
694 Views
7 Replies
Replies (7)
Message 2 of 8

HideoYamada
Advisor
Advisor

Hello,

 

I downloaded attached file and got same colored views about "_Fishing Rod Assembly.iam", "Rod Assembly.iam" and "Fishing Rod.ipt".

(I tested it with Inventor 2019 Japanese)

 

If you have changed the color in the top assembly, you can do "clear" overridden colors.

See the video.

 

 

=====

Freeradical

 Hideo Yamada

 

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes
Message 3 of 8

HideoYamada
Advisor
Advisor

If you can't see the video in the last post, click the link follows.

https://autode.sk/2zD1Tek

 

 

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes
Message 4 of 8

Anonymous
Not applicable

Hi

 

I used to call "ClearAppearanceOverrides()" function to clear the overridden colors on top assembly, parts and bodies. But still, we get the override color. 

 

Eg:- 

#pragma implementation_key(1090)
inline HRESULT AssemblyComponentDefinition::ClearAppearanceOverrides ( const VARIANT & AppearanceOverrideObjects ) {
return _com_dispatch_raw_method(this, 0x600022b, DISPATCH_METHOD, VT_EMPTY, NULL,
L"\x080c", &AppearanceOverrideObjects);
}

 

0 Likes
Message 5 of 8

Darkforce_the_ilogic_guy
Advisor
Advisor

inventor for some reason do not update new colour before change form one view to a other in representations.

 

remember also that your iam files need to chosse the same representations - views at the part in the assambly  that you are making the change colour on

0 Likes
Message 6 of 8

HideoYamada
Advisor
Advisor

Hello,

 

I just run this code and color override is cleared.

ThisApplication.ActiveDocument.ComponentDefinition.ClearAppearanceOverrides

It seems that you are using C++, but try copy above code, paste immediate window in VBA, and run.

Overridden color will be restored.

 

=====

Freeradical

 Hideo Yamada

 

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes
Message 7 of 8

Anonymous
Not applicable

I'm running with Inventor 2020. But when I execute "ClearAppearanceOverrides()" method on top-level assembly It returns "E_NOTIMPL Not implemented". I have added a sample code that I have used to call that function.

 

CComPtr<ApprenticeServerDocument> m_pApprenticeServerDocument;

.......

CComPtr<ComponentDefinition> pCompDef;
hr = m_pApprenticeServerDocument->get_ComponentDefinition(&pCompDef);
if (pCompDef->GetType() == kAssemblyComponentDefinitionObject)
{
CComPtr<AssemblyComponentDefinition> assemblyDef;
HRESULT hrOfQuery= pCompDef->QueryInterface(DIID_AssemblyComponentDefinition, reinterpret_cast<void**>(&assemblyDef));
if (SUCCEEDED(hrOfQuery))
{
     auto retVal = assemblyDef->ClearAppearanceOverrides();//Returns E_NOTIMPL Not implemented.
}

}

}

0 Likes
Message 8 of 8

HideoYamada
Advisor
Advisor

Hello,

 

Sorry I've never coded for Inventor in C++, so I can't help you anymore.

 

Have you already tried to change the view representation of sub assembly or part to "Default" and set Associative?

Capture.PNG

This will cause reset face colors also.

 

=====

Freeradical

 Hideo Yamada

 

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes