Mtext background mask offset default

Mtext background mask offset default

john.uhden
Mentor Mentor
2,094 Views
5 Replies
Message 1 of 6

Mtext background mask offset default

john.uhden
Mentor
Mentor

I 've googled around and found for myself that DXF 45 can be modified to change the offset, but where is the default stored?  It seems to be 1.5 but I'd rather have a default of 1.1.  Yes, I've already created a c:backgroundoffset function, but it seems stupid to have to post-process.  You know... you may have to unlock layers and then lock them again.  Yeah, I can automate that too, but I prefer to have MY defaults.

John F. Uhden

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

artc2
Autodesk
Autodesk
The default of 1.5 is hardcoded in the acdb dll.
0 Likes
Message 3 of 6

Ranjit_Singh
Advisor
Advisor
Accepted solution

Maybe give this a try.

Message 4 of 6

john.uhden
Mentor
Mentor

There it is, in C3D 2014 as well.  Except that changing it in the registry had no effect.  In fact it seemed to change the default to 0.0 in AutoCAD, which of course is not allowed.  The factor must be >= 1 and preferably <= 5.

 

I changed the value in...

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.1\ACAD-D000:409\MTEXT

which apparently automatically updated

HKEY_USERS\S-1-5-21-3174490996-1184374969-4093637027-1000\Software\Autodesk\AutoCAD\R19.1\ACAD-D000:409\MTEXT

 

Maybe you need to restart AutoCAD for it to take effect.

John F. Uhden

0 Likes
Message 5 of 6

Anonymous
Not applicable

Those simple objectarx code can auto add background to mtext .

#pragma warning( push)
#pragma warning (disable: 4189 4100 )
#include <Windows.h>
#include <arxHeaders.h>
#pragma warning( pop)

class EditorReactor :
	public AcEditorReactor {
public:
	inline void databaseConstructed(AcDbDatabase*);
};

class DatabaseReacotr :
	public AcDbDatabaseReactor {
public:
	inline void objectAppended(
		const AcDbDatabase*,
		const AcDbObject* dbObj) /*override*/ {
		AcDbMText * varMtext = AcDbMText::cast(dbObj);
		if (varMtext) {
			double varBF = 0;
			varMtext->getBackgroundScaleFactor(varBF);
			if (std::abs(varBF - 1.005) < 0.0001) {
				return;
			}

			if (Acad::eOk == varMtext->upgradeOpen()) {
				varMtext->setBackgroundFill(true);
				varMtext->setUseBackgroundColor(true);
				varMtext->setBackgroundScaleFactor(1.005);
			}
		}
	}
};

DatabaseReacotr * globalDatabaseReacotr = 0;
EditorReactor *   globalEditorReactor   = 0;

void EditorReactor::databaseConstructed(AcDbDatabase* var) {
	var->addReactor(globalDatabaseReacotr);
}

extern "C" AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt) {
	switch (msg) {
	case AcRx::kInitAppMsg: {
		acrxDynamicLinker->unlockApplication(pkt);
		acrxRegisterAppMDIAware(pkt);
		/*****************************************/
		globalDatabaseReacotr = new DatabaseReacotr;
		globalEditorReactor = new EditorReactor;
		acedEditor->addReactor(globalEditorReactor);
		/*****************************************/		
		break;
	}
	case AcRx::kUnloadAppMsg: {break;}
	default:break;
	}
	return AcRx::kRetOK;
}
0 Likes
Message 6 of 6

john.uhden
Mentor
Mentor

Thanks, but that code doesn't look "simple" to me.

It doesn't really matter though since I can change the DXF 45 value using AutoLisp.

John F. Uhden

0 Likes