Document scale always returns 1

On 05/02/2014 at 07:59, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   13,14,15 
Platform:   Windows  ;   
Language(s) :     C++  ;

Hi, if I insert a primitive cube in a document, it defaults to a certain size.
If I then scale up the document by a factor of 10, then insert a new cube, this new cube is 10 times smaller.

What I need is to detect the scale of this C4D "world", because I want so scale up a newly created object, so that it visually has the same size, regardless of the C4D "world scale".

This code is totally useless:

   BaseContainer* bc = doc->GetSettingsInstance(DOCUMENTSETTINGS_DOCUMENT);
   UnitScaleData* usd = (UnitScaleData* )bc->GetCustomDataType(DOCUMENT_DOCUNIT, CUSTOMDATATYPE_UNITSCALE);
   Real docScale = 0;
   DOCUMENT_UNIT docunit = 0;
   usd->GetUnitScale(docScale, docunit);

It is useless because docScale always == 1. I scale up the document ten times. Still returns 1.
How can I get hold of the scale of the C4D world for the current document? So that I can use this value to scale the objects I programmatically insert into C4D?

On 05/02/2014 at 08:11, xxxxxxxx wrote:

Ok folks,
I found the solution myself.
And instead of deleting my post, I will give you the solution here, in case someone else might need it:

   BaseSceneHook* baseSceneHook = doc->FindSceneHook(180000100);
   GeData geData;
   baseSceneHook->GetParameter(DescID(10001), geData, DESCFLAGS_GET_0);    
   Real scale = geData.GetReal();

The number 10001 = WORLD_SCALE
I have no idea where the number 180000100 comes from. I just found this brilliant post by Scott in this forum:

It is a super thread, I have bookmarked it!
Thanks to Scott for this!!