<?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: Associative Networks AcDbAssocAction in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/associative-networks-acdbassocaction/m-p/3729912#M14015</link>
    <description>&lt;P&gt;Hello Anastassios,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The difference between "GetDependentObjects" and "GetDependencies" can be understood considering these statements :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) "Get me all the objects who depend on me"&amp;nbsp; is equivalent of the "GetDependencies"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) "Get me all the objects on whom I am dependent" is equivalent of the "GetDependentObjects"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this clarifies.&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>Mon, 10 Dec 2012 14:49:48 GMT</pubDate>
    <dc:creator>Balaji_Ram</dc:creator>
    <dc:date>2012-12-10T14:49:48Z</dc:date>
    <item>
      <title>Associative Networks AcDbAssocAction</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/associative-networks-acdbassocaction/m-p/3726026#M14014</link>
      <description>&lt;P&gt;When you create some read/write dependencies on an object and then try to use&amp;nbsp;&lt;/P&gt;&lt;P&gt;getDependentObjects(readDependenciesWanted, writeDependenciesWanted, &amp;nbsp;objectIds) method to get the objectids of dependent objects none is returned, but if you use&amp;nbsp;getDependencies(readDependenciesWanted, writeDependenciesWanted, &amp;nbsp;dependencyIds) method that works Ok. Is this a bug?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Anastassios&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2012 17:09:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/associative-networks-acdbassocaction/m-p/3726026#M14014</guid>
      <dc:creator>renencon</dc:creator>
      <dc:date>2012-12-06T17:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Networks AcDbAssocAction</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/associative-networks-acdbassocaction/m-p/3729912#M14015</link>
      <description>&lt;P&gt;Hello Anastassios,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The difference between "GetDependentObjects" and "GetDependencies" can be understood considering these statements :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) "Get me all the objects who depend on me"&amp;nbsp; is equivalent of the "GetDependencies"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) "Get me all the objects on whom I am dependent" is equivalent of the "GetDependentObjects"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this clarifies.&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>Mon, 10 Dec 2012 14:49:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/associative-networks-acdbassocaction/m-p/3729912#M14015</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2012-12-10T14:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Networks AcDbAssocAction</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/associative-networks-acdbassocaction/m-p/3732632#M14016</link>
      <description>&lt;P&gt;Hello again Balaji,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your reply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the following is taken form ObjectARX reference guide&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Acad::ErrorStatus getDependentObjects(bool readDependenciesWanted, bool writeDependenciesWanted, AcDbObjectIdArray&amp;amp; objectIds) const;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Description&lt;/P&gt;&lt;P class="Element10"&gt;Gets the AcDbObjects that this action &lt;U&gt;&lt;STRONG&gt;depends on or modifies&lt;/STRONG&gt;&lt;/U&gt;. The default implementation collects all object on which the action has AcDbAssocDependencies.&amp;nbsp;&lt;/P&gt;&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="Element10"&gt;and&lt;/P&gt;&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Acad::ErrorStatus getDependencies(bool readDependenciesWanted, bool writeDependenciesWanted, AcDbObjectIdArray&amp;amp; dependencyIds) const;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Description&lt;/P&gt;&lt;P&gt;Gets AcDbAssocDependencies of this action. The default implementation obtains all dependencies owned by the base action class and selects the ones based on the &lt;U&gt;&lt;STRONG&gt;required read/write type&lt;/STRONG&gt;&lt;/U&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Consider&amp;nbsp;the following scenario&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;an AcDbAssocActionBody has&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dependency1 on object1 (read only)&lt;/P&gt;&lt;P&gt;dependency2 on object2 (write only)&lt;/P&gt;&lt;P&gt;dependency3 on object3 (write only)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. getDependentObjects(false, true, objectIds)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;2. getDependencies(&lt;SPAN&gt;false, true, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;dependencyIds&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;shouldn't call 1 return object2 &amp;amp; object3&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;and call 2 return dependency2 &amp;amp; dependency3&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;I tried the following&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;AcDbAssocAction::getActionsDependentOnObject(pObject1, true, false, actionIds);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;for each item in the actionIds array I opened the action object and&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;I used pAction-&amp;gt;getDependentObjects(false, true, objectIds) as well as&amp;nbsp;&lt;SPAN&gt;pAction-&amp;gt;&lt;/SPAN&gt;getDependencies(false, true,&amp;nbsp;dependencyIds)&lt;/P&gt;&lt;P&gt;for each dependency in the dependencyIds I got the pDependency-&amp;gt;dependentOnObject() objectId.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed that the objectIds that I ended up with 1.&amp;nbsp;&lt;SPAN&gt;getDependentObjects(false, true, objectIds) is empty,&amp;nbsp;&lt;/SPAN&gt;and with call 2.&amp;nbsp;getDependencies(false, true,&amp;nbsp;dependencyIds) is object2 &amp;amp; object3 as expected.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Shouldn't call 1 also return the same objects I think that is what the reference guide above suggest. Is it not?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where am I going wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"Get me all the objects on whom I am dependent" is equivalent of the "GetDependentObjects" statement in your reply suggest to me that the&amp;nbsp;&lt;SPAN&gt;"GetDependentObjects" call returns only the objects that have attached to them read/write or read only dependencies. Is that so? If yes is it not the&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;U&gt;&lt;STRONG&gt;depends&amp;nbsp;on&amp;nbsp;or&amp;nbsp;modifies"&lt;/STRONG&gt;&lt;/U&gt; &amp;nbsp;in the documentation misleading?&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank again.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anastassios&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2012 20:55:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/associative-networks-acdbassocaction/m-p/3732632#M14016</guid>
      <dc:creator>renencon</dc:creator>
      <dc:date>2012-12-11T20:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Networks AcDbAssocAction</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/associative-networks-acdbassocaction/m-p/3736430#M14017</link>
      <description>&lt;P&gt;Hi Anastassios,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, if&amp;nbsp;my explanation added to your confusion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The documentation and your understanding seems to be both correct. Here is a simple command to test both of those methods (getDependentObjects and getDependencies) for various combinations of inputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I tried it with a geometric constraint between two entities created in AutoCAD and the results from this command is what I would expect based on the documentation. Here is the sample code :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;static void AdskAssocTestTest2(void)
{
	AcDbDatabase* pDb = acdbHostApplicationServices()-&amp;gt;workingDatabase();
	AcDbObjectId spaceId = pDb-&amp;gt;currentSpaceId(); 

	// Get the assoc network id
	Acad::ErrorStatus es;
	AcDbObjectId networkId = AcDbAssocNetwork::getInstanceFromObject(spaceId, false, false);
	if (networkId.isNull()) 
		return;

	// Open the Assoc Network
	AcDbObjectPointer&amp;lt;AcDbAssocNetwork&amp;gt; pNetwork(networkId, kForWrite);
	if (pNetwork.openStatus() != Acad::eOk)
		return;

	bool readWanted = false;
	bool writeWanted = false;

	// Iterate through the actions
	const AcDbObjectIdArray&amp;amp; actionsInNetwork = pNetwork-&amp;gt;getActions();
	for (int nCount = 0; nCount &amp;lt; actionsInNetwork.length(); ++nCount)
	{
		const AcDbObjectId&amp;amp; idAction = actionsInNetwork[nCount];
		if (idAction == AcDbObjectId::kNull)
			continue;

		if ( actionsInNetwork[nCount].objectClass() == NULL)
			continue;
		  
		// Open the AssocAction
		AcDbObjectPointer&amp;lt;AcDbAssocAction&amp;gt; pAction(idAction, kForRead);
		if (pAction.openStatus() != Acad::eOk)
			continue;

		// Testing getDependencies
		AcDbObjectIdArray dependencyIds;

		readWanted = true;
		writeWanted = false;
		pAction-&amp;gt;getDependencies(readWanted, writeWanted, dependencyIds);
		acutPrintf(ACRX_T("\npAction-&amp;gt;getDependencies - read Wanted"));
		PrintHandles(dependencyIds);

		readWanted = false;
		writeWanted = true;
		pAction-&amp;gt;getDependencies(readWanted, writeWanted, dependencyIds);
		acutPrintf(ACRX_T("\npAction-&amp;gt;getDependencies - write Wanted"));
		PrintHandles(dependencyIds);

		readWanted = true;
		writeWanted = true;
		pAction-&amp;gt;getDependencies(readWanted, writeWanted, dependencyIds);
		acutPrintf(ACRX_T("\npAction-&amp;gt;getDependencies - read and write Wanted"));
		PrintHandles(dependencyIds);

		// Testing getDependentObjects
		AcDbObjectIdArray objectIds;

		readWanted = true;
		writeWanted = false;
		pAction-&amp;gt;getDependentObjects(readWanted, writeWanted, objectIds);
		acutPrintf(ACRX_T("\npAction-&amp;gt;getDependentObjects - read Wanted"));
		PrintHandles(objectIds);

		readWanted = false;
		writeWanted = true;
		pAction-&amp;gt;getDependentObjects(readWanted, writeWanted, objectIds);
		acutPrintf(ACRX_T("\npAction-&amp;gt;getDependentObjects - write Wanted"));
		PrintHandles(objectIds);

		readWanted = true;
		writeWanted = true;
		pAction-&amp;gt;getDependentObjects(readWanted, writeWanted, objectIds);
		acutPrintf(ACRX_T("\npAction-&amp;gt;getDependentObjects - read and write Wanted"));
		PrintHandles(objectIds);
	}
}

static void PrintHandle(AcDbObjectId oid)
{
	ACHAR tempStr[256];
	oid.handle().getIntoAsciiBuffer(tempStr);
	acutPrintf(ACRX_T("\n     handle : %s"), tempStr);
}

static void PrintHandles(AcDbObjectIdArray ids)
{
	for(int j = 0; j &amp;lt; ids.length(); ++j)
	{
		PrintHandle(ids[j]);
	}
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, regarding the issue with "getDependentObjects" returning empty object id collection in your case :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you trying these methods on a assoc network that was created by AutoCAD or was it generated by your code ?&lt;/P&gt;
&lt;P&gt;If it was generated by your code, then it could be due to an incorrect association of the dependent-on object and the AssocAction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have only used code to iterate the assoc network that AutoCAD creates, and havent tried creating it from scratch.&lt;/P&gt;
&lt;P&gt;But based on what I think AutoCAD does,&amp;nbsp;you may verify in your code if the following steps have been considered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Use "AcDbAssocDependency::attachToObject" to associate the objectId of the dependent-on object with the AssocDependency.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Use "AcDbAssocAction::addDependency" to associate the AssocDependency with the AssocAction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Add the AssocDependency Id as a persistent reactor to the dependent-on object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Verifying the results with a Assoc network created by AutoCAD can help you isolate the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2012 20:38:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/associative-networks-acdbassocaction/m-p/3736430#M14017</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2012-12-13T20:38:46Z</dc:date>
    </item>
  </channel>
</rss>

