DG7.1 getColor

KernelCAD with Native Visual Basic
Post Reply
juergen
Posts: 6
Joined: Wed Jan 10, 2024 9:35 am

DG7.1 getColor

Post by juergen »

Hello,

Is it possible to read the current color value from an entity?

Prashant Kande
Posts: 121
Joined: Mon Apr 04, 2016 4:55 am

Re: DG7.1 getColor

Post by Prashant Kande »

Hello Juergen.

It is a bit confusing. IEntity_DG has SetColor(), but no GetColor(). IEntity_DG.SetColor() is a shortcut for more complex things.

It sounds like you need IEntity_DG.GetAppearance(), which returns IAppearance_DG. IAppearance_DG has Color property, but it is not always the actual one, from memory. It might work for you.

The more reliable method is to check if it is a surface or curve or point set first. If it is a surface, you can query IMaterial_DG out of IAppearance_DG to access the full information. See more at IAppearance_DG.

To confuse you more :), BRep solids can have per-face colors.

Regards

juergen
Posts: 6
Joined: Wed Jan 10, 2024 9:35 am

Re: DG7.1 getColor

Post by juergen »

Hello Prashant Kande

your answer was helpful,
I got it via IMaterial_DG.

Thanks

Prashant Kande
Posts: 121
Joined: Mon Apr 04, 2016 4:55 am

Re: DG7.1 getColor

Post by Prashant Kande »

Great, Juergen.

You have good questions. They are not really language specific. If you post them in the General Issues section, it would be helpful to many others as well. VB6 code is OK there also.

Regards

Post Reply