ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change the color of a nested AcDbSolid in a custom entity

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
kubitMarco
758 Views, 2 Replies

Change the color of a nested AcDbSolid in a custom entity

Hi,

 

I use an AcDbSolid as AcGiDrawable in the call geometry.draw() in the wordlDraw function of a custom entity.

 

Here the part of the code inside worldDraw:

 

AcDbSolid* pSolid = new AcDbSolid();

//draw the solid

//calculate the transformation matrix xForm

//pSolid is managed outside the custom entity, the lifetime is longer then the custom entity itsself 

//pSolid can used in more than one entity

 

mode->geometry().pushModelTransform(xForm);

mode->geometry().draw(pSolid);

mode->geometry().popModelTransform();

 

I have also overridden the function setAttributes in my custom entity. There I set to kDrawableIsCompoundObject:

 

Adesk::UInt32 MyEntity::subSetAttributes (AcGiDrawableTraits *traits)

{

assertReadEnabled ();

Adesk::UInt32 ret = AcDbEntity::subSetAttributes (traits);

return ret | kDrawableIsCompoundObject;

}

 

And most is fine. I see the solid as graphical representation of my entity.

 

But I can't change the color of my entity. If I choose a new color in the property window the entity keeps the color of the layer.  Only if I move the entity to a layer with another color the color of the entity changes too.

 

What do I do wrong?

 

Regards,

Marco

2 REPLIES 2
Message 2 of 3
kubitMarco
in reply to: kubitMarco

I found a solution. I don't know if it's right, but it seems to work.

 

I set the the color of the AcDb3dSolid to ByBlock (ColorIndex = 0). It's like when you define a block definition where you want to change the color of the entities inside by the settings of the block reference.

 

If there is a better solution, reply please.

 

 

Regards, Marco

 

 

Message 3 of 3
owenwengerd
in reply to: kubitMarco

Color kByBlock is the correct solution.

--
Owen Wengerd
ManuSoft

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost