<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Invoke a function after object rotation in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9764057#M4061</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/845950"&gt;@tbrammer&lt;/a&gt;&amp;nbsp;, I'm trying to write reactor, this is the skeleton&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;#pragma once
#include &amp;lt;dbmain.h&amp;gt;
class Reattore :
	public AcDbEntityReactor
{

public:
	void openedForModify(const AcDbObject* dbObj) {
		acutPrintf(L"Inizio");
	}

	void modified(const AcDbObject* dbObj) {
		acutPrintf(L"Fine");
	}


};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know if it is correct ... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I'm not understanding how to add reactor to this snippet of code also provided from you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;void cmdDrawCar()
{
	Acad::ErrorStatus es;
	LPCWSTR blockname = L"*U"; // Blockname. This is for an unnamed block.
	blockname = L"car"; // And this for a named block

	AcDbDatabase *db = acdbHostApplicationServices()-&amp;gt;workingDatabase();
	AcDbObjectId BtrID;
	if (blockname[0] != L'*') // '*' as first char means: Unnamed block. Don't search for it.
		BtrID = FindBlock(db, blockname); // Search for an existing named block 

	if (BtrID.isNull())
		BtrID = insertDwgAsBlock(db,L"C:\\Users\\Marco\\source\\dwg\\AutoSoloScocca.dwg",blockname); // For "*U" AutoCAD will create unique names like "*U1", "*U2", ...

	if (BtrID.isNull())
	{
		acutPrintf(L"\nFailed.");
		return;
	}

	// Now create a block reference
	AcDbBlockReference *bref = new AcDbBlockReference;
	bref-&amp;gt;setDatabaseDefaults();
	bref-&amp;gt;setBlockTableRecord(BtrID);

	AcGeVector3d insertionPoint;
	acedGetPoint(nullptr, L"\nInsertion point: ", asDblArray(insertionPoint));
	AcGeMatrix3d trans; // the transformation matrix
	trans.setToTranslation(insertionPoint);
	bref-&amp;gt;setBlockTransform(trans);

//HERE I'd like to add reactor
	bref-&amp;gt;addReactor(MY REACTOR);

	// Append it to modelspace
	AcDbObjectId BrefID;
	es = PostToDb(db, BrefID, bref);
	if (!es)
		bref-&amp;gt;close();
	else
		delete bref;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
    <pubDate>Wed, 23 Sep 2020 16:34:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-09-23T16:34:42Z</dc:date>
    <item>
      <title>Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9740270#M4052</link>
      <description>&lt;P&gt;Hi to all,&lt;/P&gt;&lt;P&gt;I'd like to have a block that when The user rotate the block I can call automatically a custom function and print of how much degrees is rotated. Could you give me some examples or idea ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 15:22:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9740270#M4052</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-10T15:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9740303#M4053</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:foo (/ s o)
  ;; RJP » 2020-09-10
  (if (setq s (ssget))
    (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
      (if (vlax-property-available-p (setq o (vlax-ename-&amp;gt;vla-object e)) 'rotation)
	(princ (strcat "\nRotation: "
		       (vl-princ-to-string (* (/ (vla-get-rotation o) pi) 180.0))
		       " degrees."
	       )
	)
      )
    )
  )
  (princ)
)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 10 Sep 2020 15:33:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9740303#M4053</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2020-09-10T15:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9740310#M4054</link>
      <description>&lt;P&gt;Sorry but I'm not very confident with ObjectArx, this is an function that is invoked automatically ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 15:37:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9740310#M4054</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-10T15:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9740366#M4055</link>
      <description>&lt;P&gt;Oops .. just realized this was the ARX forum. My solution is in lisp.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 15:53:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9740366#M4055</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2020-09-10T15:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9740372#M4056</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;, do you mean how much it was rotated from the before rotation&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say,&amp;nbsp; a block is insert with a say 30 degree , and user ROTATE it 15 degree . Then the lisp must tell you it was rotated 15 , but if you read the ROTATION property&amp;nbsp; &amp;nbsp;it will be 45 degree.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For better understanding, and, maybe, get further help, please upload such sample.dwg , with a before and an after&amp;nbsp; situation&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 15:56:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9740372#M4056</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2020-09-10T15:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9741752#M4057</link>
      <description>&lt;P&gt;First: I assume that you mean "block reference" (&lt;FONT face="courier new,courier"&gt;AcDbBlockReference&lt;/FONT&gt; or short "BREF" ) when you write "block".&lt;/P&gt;
&lt;P&gt;In ObjectARX you can use various reactor classes to monitor changes on entities.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example an &lt;FONT face="courier new,courier"&gt;AcDbEntityReactor&lt;/FONT&gt;. You can derive your own class from it and implement these virtual methods.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;openedForModify(const AcDbObject* dbObj)&amp;nbsp;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;Here you have to store the old block transform matrix of your BREF&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;AcDbBlockReference::cast()-&amp;gt;blockTransform()&lt;BR /&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;modified(const AcDbObject* dbObj)&lt;/FONT&gt;&lt;BR /&gt;Here you read the new block transform matrix and calculate the rotation&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You must explicitely add your&amp;nbsp;&lt;FONT face="courier new,courier"&gt;AcDbEntityReactor&lt;/FONT&gt; to each BREF that you want to watch by calling&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;bref-&amp;gt;addReactor(myReactor)&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use an &lt;FONT face="courier new,courier"&gt;AcDbDatabaseReactor&lt;/FONT&gt;. For each modified entity in a drawing this one will&amp;nbsp; call&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;objectOpenedForModify(const AcDbDatabase* dwg, const AcDbObject* dbObj)&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;objectModified (const AcDbDatabase* dwg, const AcDbObject* dbObj);&lt;/FONT&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I would recomment to use the &lt;FONT face="courier new,courier"&gt;AcDbEntityReactor&lt;/FONT&gt; for performance reasons.&lt;/P&gt;
&lt;P&gt;To collect new BREFs and attach your&amp;nbsp;&lt;FONT face="courier new,courier"&gt;AcDbEntityReactor&lt;/FONT&gt; to them you can use&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;AcDbDatabaseReactor&lt;/FONT&gt;::&lt;FONT face="courier new,courier"&gt;objectAppended(const AcDbDatabase* dwg, const AcDbObject* dbObj)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I recomment to check out the ARXDBG sample project in &amp;lt;ARX&amp;gt;\samples\database\ARXDBG. Build the project and load ArxDbg.arx. It implements the command "Reactors" that lets you play with the various reactor types. With the command "SnoopEnts" you can see which reactors are attached to an entity. You can also check out the source code to learn how to use the reactor classes.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 08:39:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9741752#M4057</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2020-09-11T08:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9741776#M4058</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;&lt;/P&gt;
&lt;DIV id="areafixed" class="Element710" style="width: 772px;"&gt;
&lt;DIV class="Element92"&gt;
&lt;DIV class="Element5"&gt;&lt;STRONG&gt;AcDbTransformOverrule&lt;/STRONG&gt; can help you. You have to override &lt;STRONG&gt;transformBy&lt;/STRONG&gt; method. In this method you have calculate rotation from matrix.&lt;BR /&gt;
&lt;DIV class="Element92"&gt;
&lt;DIV class="Element5"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 11 Sep 2020 08:52:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9741776#M4058</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-09-11T08:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9741794#M4059</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/845950"&gt;@tbrammer&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm thinking that reactor is a good way but I'm not confident with them. I'll detail more specifically my needs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you remeber the Wheel block ? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to insert the Wheel block on my draw. After insert the total rotation from original insertion is 0 degrees. After some times I'll decide to rotate the whell to the right side of 30°. Finished the rotation I'd like to store on my xData resbuf the value : "totalRotation" = "30°". This process should be automatic after rotation command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you give me any other suggestion or example ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your Reply,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S. thank to&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/481027"&gt;@Alexander.Rivilis&lt;/a&gt;&amp;nbsp;for your response &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 09:02:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9741794#M4059</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-11T09:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9741810#M4060</link>
      <description>&lt;P&gt;&lt;A class="content-nav-prev" href="https://adndevblog.typepad.com/autocad/2013/01/get-the-rotation-angle-and-axis-from-acgematrix3d.html" target="_blank"&gt;Get the Rotation Angle and Axis from AcGeMatrix3d&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 09:10:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9741810#M4060</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-09-11T09:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9764057#M4061</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/845950"&gt;@tbrammer&lt;/a&gt;&amp;nbsp;, I'm trying to write reactor, this is the skeleton&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;#pragma once
#include &amp;lt;dbmain.h&amp;gt;
class Reattore :
	public AcDbEntityReactor
{

public:
	void openedForModify(const AcDbObject* dbObj) {
		acutPrintf(L"Inizio");
	}

	void modified(const AcDbObject* dbObj) {
		acutPrintf(L"Fine");
	}


};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know if it is correct ... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I'm not understanding how to add reactor to this snippet of code also provided from you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;void cmdDrawCar()
{
	Acad::ErrorStatus es;
	LPCWSTR blockname = L"*U"; // Blockname. This is for an unnamed block.
	blockname = L"car"; // And this for a named block

	AcDbDatabase *db = acdbHostApplicationServices()-&amp;gt;workingDatabase();
	AcDbObjectId BtrID;
	if (blockname[0] != L'*') // '*' as first char means: Unnamed block. Don't search for it.
		BtrID = FindBlock(db, blockname); // Search for an existing named block 

	if (BtrID.isNull())
		BtrID = insertDwgAsBlock(db,L"C:\\Users\\Marco\\source\\dwg\\AutoSoloScocca.dwg",blockname); // For "*U" AutoCAD will create unique names like "*U1", "*U2", ...

	if (BtrID.isNull())
	{
		acutPrintf(L"\nFailed.");
		return;
	}

	// Now create a block reference
	AcDbBlockReference *bref = new AcDbBlockReference;
	bref-&amp;gt;setDatabaseDefaults();
	bref-&amp;gt;setBlockTableRecord(BtrID);

	AcGeVector3d insertionPoint;
	acedGetPoint(nullptr, L"\nInsertion point: ", asDblArray(insertionPoint));
	AcGeMatrix3d trans; // the transformation matrix
	trans.setToTranslation(insertionPoint);
	bref-&amp;gt;setBlockTransform(trans);

//HERE I'd like to add reactor
	bref-&amp;gt;addReactor(MY REACTOR);

	// Append it to modelspace
	AcDbObjectId BrefID;
	es = PostToDb(db, BrefID, bref);
	if (!es)
		bref-&amp;gt;close();
	else
		delete bref;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 16:34:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9764057#M4061</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-23T16:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9765196#M4062</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once again, I recommend to use &lt;STRONG&gt;AcDbTransformOverrule&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 07:41:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9765196#M4062</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-09-24T07:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9765250#M4063</link>
      <description>&lt;P&gt;You can find a sample that demonstrats the usage of various reactors in &amp;lt;ARX&amp;gt;\samples\reactors\dbreact_dg.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The common way is to have a global or static pointer to a singleton reactor object.&lt;/P&gt;
&lt;P&gt;You have to initialize your reactor &lt;U&gt;class&lt;/U&gt; during initialization of your app and to remove the class when the app is unloaded:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;static Reattore *scMyEntityReactor=nullptr;

void initReattore() {
	Reattore::rxInit();
}

void cleanupReattore() {
	if (scMyEntityReactor) {
		delete scMyEntityReactor;
		scMyEntityReactor = nullptr;
	}
	deleteAcRxClass(Reattore::desc());
}

extern "C" AcRx::AppRetCode 
acrxEntryPoint( AcRx::AppMsgCode msg, void* pPkt ) {
	switch (msg) 	{
		case AcRx::kInitAppMsg:
			initReattore();
			break;
			
		case AcRx::kUnloadAppMsg:
			cleanupReattore();
			break;
	}
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create your &lt;FONT face="courier new,courier"&gt;scMyEntityReactor&lt;/FONT&gt; instance when you first need it. &lt;BR /&gt;You can implement a function like this, that adds your reactor to an object:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;bool AddReattore(AcDbEntity *ent) {
	if (!scMyEntityReactor)
		scMyEntityReactor = new Reattore();
	return scMyEntityReactor-&amp;gt;addToObject(ent);
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 08:05:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9765250#M4063</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2020-09-24T08:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9765266#M4064</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/481027"&gt;@Alexander.Rivilis&lt;/a&gt; 's suggestion to use &lt;FONT face="courier new,courier"&gt;AcDbTransformOverrule&lt;/FONT&gt; makes sense. You should give it a try.&lt;/P&gt;
&lt;P&gt;The biggest advantage is, that the its methods &lt;FONT face="courier new,courier"&gt;transformBy()&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;getTransformedCopy()&lt;/FONT&gt; provide the applied transformation matrix directly. If you use a reactor, you have to analyse the modified entity and you don't know whether it was transformed or changed otherwise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However it is up to you to decide what to use. Maybe using a reactor has other advantages in your case.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 08:14:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9765266#M4064</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2020-09-24T08:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768111#M4065</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/845950"&gt;@tbrammer&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/481027"&gt;@Alexander.Rivilis&lt;/a&gt;&amp;nbsp;,&amp;nbsp; thank you both for your answers.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/481027"&gt;@Alexander.Rivilis&lt;/a&gt;&amp;nbsp;Between the two solutions I preferred to choose the reactor because I'm doing experiments for a university thesis. Your solution apparently seems faster but I would like to go into detail on the reactors. But anyway, thank you so much for the details you provided me with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/845950"&gt;@tbrammer&lt;/a&gt;&amp;nbsp;&amp;nbsp;Thank you so much for the code you provided me, now I am having trouble understanding how to write the two reactor functions in order to calculate the rotation of the block. Could you help me with an example if you can? I'm not confident with the Matrixs you mentioned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 12:20:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768111#M4065</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-25T12:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768231#M4066</link>
      <description>&lt;P&gt;@Anonymous &lt;/P&gt;
&lt;P&gt;Only with AcDbTransformOverrule you can get transform matrix of entity and calculate rotation angle.&lt;/P&gt;
&lt;P&gt;With reactor you can only check the fact of modifying entity and new state of entity, but has not previous state of entity.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 13:11:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768231#M4066</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-09-25T13:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768274#M4067</link>
      <description>&lt;P&gt;An &lt;FONT face="courier new,courier"&gt;AcGeMatrix3d&lt;/FONT&gt; is a 4 x 4 matrix.&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;class AcGeMatrix3d {
  double         entry[4][4];    // [row][column]
};&lt;/LI-CODE&gt;
&lt;P&gt;It can represent a translation, rotation and scaling and more.&lt;/P&gt;
&lt;P&gt;You can retrieve the coordinate system of a&amp;nbsp;&lt;FONT face="courier new,courier"&gt;AcGeMatrix3d&lt;/FONT&gt; using&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;AcGeMatrix3d::getCoordSystem(
    AcGePoint3d&amp;amp; origin,
    AcGeVector3d&amp;amp; xAxis,
    AcGeVector3d&amp;amp; yAxis,
    AcGeVector3d&amp;amp; zAxis
);&lt;/LI-CODE&gt;
&lt;P&gt;For a matrix that represents translation and rotation the &lt;FONT face="courier new,courier"&gt;entry[4][4]&lt;/FONT&gt; values are like this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;xAxis.x, yAxis.x, zAxis.x, origin.x      &amp;lt;- entry[0][0..3]
xAxis.y, yAxis.y, zAxis.y, origin.y      &amp;lt;- entry[1][0..3]
xAxis.z, yAxis.z, zAxis.z, origin.z      &amp;lt;- entry[2][0..3]
0,       0,             0,        1&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;origin&lt;/FONT&gt; can be seen as the translation vector of the matrix.&lt;/P&gt;
&lt;P&gt;You want to calculate the rotation axis and angle of the matrix. &lt;A href="https://en.wikipedia.org/wiki/Rotation_matrix#Axis_and_angle" target="_blank" rel="noopener"&gt;This article&lt;/A&gt; describes a general solution for an arbitrary rotation axis.&lt;/P&gt;
&lt;P&gt;Things are much easier, if you only have to deal with rotations around the Z axis. In this case your matrix will look like this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;xAxis.x, yAxis.x, 0, origin.x       cos(a), -sin(a), 0, origin.x
xAxis.y, yAxis.y, 0, origin.y   =   sin(a),  cos(a), 0, origin.y
0,       0,       1, origin.z       0,       0,      1, origin.z
0,       0,       0,        1       0,       0,      0,        1&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;With &lt;FONT face="courier new,courier"&gt;a&lt;/FONT&gt; being the Z rotation angle in radians. So you can simply calculate it like this:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;a = atan2(xAxis.y, xAxis.x);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;a * 180/pi&lt;/FONT&gt; gives the angle in degrees.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 13:32:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768274#M4067</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2020-09-25T13:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768302#M4068</link>
      <description>&lt;P&gt;As &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/481027"&gt;@Alexander.Rivilis&lt;/a&gt;&amp;nbsp; mentioned you will only get the current transformation matrix of your BREF.&lt;/P&gt;
&lt;P&gt;So you can only calculate the &lt;U&gt;absolute&lt;/U&gt; rotation angle.&lt;/P&gt;
&lt;P&gt;If a BREF is rotated first by 20° and than by 30° around Z, you won't be able to find out that angle of the 2nd rotation.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 13:42:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768302#M4068</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2020-09-25T13:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768835#M4069</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/845950"&gt;@tbrammer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm confused &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; . As you know I'm not very confident with AutoCAD and ObjectARX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to do a simple rotation(just 1 axis).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution proposed by Alexander at this &lt;A href="https://adndevblog.typepad.com/autocad/2013/01/get-the-rotation-angle-and-axis-from-acgematrix3d.html" target="_blank" rel="noopener"&gt;link&amp;nbsp;&lt;/A&gt;can be used in my reactors ? I hope you can help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 16:55:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768835#M4069</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-25T16:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768847#M4070</link>
      <description>&lt;P&gt;Yes, I only need the total(absoule) rotation from the beginnig. Assuming I'm starting from 0°, if I rotate 20 ° and the 35° I need the absolute 55° rotation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 16:58:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9768847#M4070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-25T16:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke a function after object rotation</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9769176#M4071</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, I only need the total(absoule) rotation from the beginnig. Assuming I'm starting from 0°, if I rotate 20 ° and the 35° I need the absolute 55° rotation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Marco&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you need to call method AcDbBlockReference::rotation() in order to get rotation angle in radians&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 19:41:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/invoke-a-function-after-object-rotation/m-p/9769176#M4071</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-09-25T19:41:32Z</dc:date>
    </item>
  </channel>
</rss>

