<?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 Draw on viewport. in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551238#M14473</link>
    <description>&lt;P&gt;I want to draw some graphics on viewport.&lt;/P&gt;&lt;P&gt;On rotating the co-ordinate system this graphics must not transform.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jul 2012 07:00:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-07-25T07:00:06Z</dc:date>
    <item>
      <title>Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551238#M14473</link>
      <description>&lt;P&gt;I want to draw some graphics on viewport.&lt;/P&gt;&lt;P&gt;On rotating the co-ordinate system this graphics must not transform.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2012 07:00:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551238#M14473</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T07:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551354#M14474</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure I understood your wish, but I've a solution to draw a custom entity always in front of camera's eye regardless of the view or the coordinate system. Maybe it will give you some ideas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First:&lt;/P&gt;&lt;PRE&gt;Adesk::Boolean CustomEntity::subWorldDraw(AcGiWorldDraw * wd) 
{
	assertReadEnabled();
	return Adesk::kFalse; // -&amp;gt; call viewport draw
}&lt;/PRE&gt;&lt;P&gt;Then:&lt;/P&gt;&lt;PRE&gt;void CustomEntity::subViewportDraw(AcGiViewportDraw * mode)
{
	assertReadEnabled();

	//independant of the viewport's camera and target locations
	AcGiViewport * pViewport = &amp;amp;mode-&amp;gt;viewport();

	AcGeVector3d normal = pViewport-&amp;gt;viewDir();
	AcGeVector3d vY;
	pViewport-&amp;gt;getCameraUpVector(vY);
	vY.normalize();
	AcGeVector3d vX = vY.crossProduct(normal);
	vX.normalize();

	mode-&amp;gt;geometry().circle(m_ptWcs, 50., normal);
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example above will draw a circle always in front of user. You can try to rotate view cube.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2012 09:14:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551354#M14474</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2012-07-25T09:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551446#M14475</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;It was really useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But still have some issues.&lt;/P&gt;&lt;P&gt;When I pan or zoom, the circle gets translated/pan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why this is so?&lt;/P&gt;&lt;P&gt;Any solution for this.?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Waiting for reply.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2012 11:29:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551446#M14475</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T11:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551458#M14476</link>
      <description>&lt;P&gt;I guess you need to calculate the position where you draw the circle in the worlddraw method.&lt;/P&gt;&lt;P&gt;With &lt;STRONG&gt;AcGsView &lt;/STRONG&gt;you can retrieve the screen's center point, like this:&lt;/P&gt;&lt;PRE&gt;AcGsView * pView = NULL;
int vportNum = 0;
if(!getGsViewObj(pView, vportNum))
    return false;

ptCenterWcs = pView-&amp;gt;target();&lt;/PRE&gt;&lt;P&gt;My suggestion is to draw your circle at a position relative to the view's target (= center of screen).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2012 11:39:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551458#M14476</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2012-07-25T11:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551570#M14477</link>
      <description>&lt;P&gt;==Got Error==&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;identifier "getGsViewObj" is undefined.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2012 12:35:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551570#M14477</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T12:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551576#M14478</link>
      <description>&lt;P&gt;And &lt;STRONG&gt;AcGiViewport::getCameraTarget &lt;/STRONG&gt;(according to my first sample)?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2012 12:37:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551576#M14478</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2012-07-25T12:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551582#M14479</link>
      <description>&lt;P&gt;Sorry.. but it doesn't work.&lt;/P&gt;&lt;P&gt;Same output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works exactly correct for rotation. But on pan it moves. Same for zoom in and zoom out.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2012 12:42:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3551582#M14479</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T12:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3558576#M14480</link>
      <description>&lt;P&gt;First of all, try not to use AcGsView inside of your viewportDraw - besides the fact that it depends on acad.exe which will stop your object enabler working inside of other RealDWG hosts it can be&amp;nbsp;very expensive on performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to draw scale dependent graphics inside of your viewportDraw, you can use AcGiViewport::getNumPixelsInUnitSquare to determine your geometry size&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2012 22:57:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3558576#M14480</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2012-07-30T22:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3571424#M14481</link>
      <description>&lt;P&gt;Thanks for the reply&amp;nbsp;Fenton.&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me with the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Waiting for reply.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2012 09:17:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3571424#M14481</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-09T09:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3571426#M14482</link>
      <description>&lt;P&gt;Still I cant find the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help ASAP.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2012 09:19:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3571426#M14482</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-09T09:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3571958#M14483</link>
      <description>&lt;P&gt;You'll be more likely to get assistance if you post your code and explain where it fails.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2012 14:23:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3571958#M14483</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2012-08-09T14:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3573236#M14484</link>
      <description>&lt;P&gt;The code posted above works for rotation.... but fail for pan and zoom..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i rotate, it repaint..... but when i pan/zoom it dont do repaint...&lt;/P&gt;</description>
      <pubDate>Fri, 10 Aug 2012 06:29:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3573236#M14484</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-10T06:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3576534#M14485</link>
      <description>&lt;P&gt;We have a function called AcGiDrawable::SetAttributes() - you should override that in your Custom entity and then check out the SetAttributesFlags enumeration...I bet if you return kDrawableViewDependentViewportDraw it will start working...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;enum SetAttributesFlags {&lt;BR /&gt;&amp;nbsp; kDrawableNone = 0,&lt;BR /&gt;&amp;nbsp; kDrawableIsAnEntity = 1,&lt;BR /&gt;&amp;nbsp; kDrawableUsesNesting = 2,&lt;BR /&gt;&amp;nbsp; kDrawableIsCompoundObject = 4,&lt;BR /&gt;&amp;nbsp; kDrawableViewIndependentViewportDraw = 8,&lt;BR /&gt;&amp;nbsp; kDrawableIsInvisible = 16,&lt;BR /&gt;&amp;nbsp; kDrawableHasAttributes = 32,&lt;BR /&gt;&amp;nbsp; kDrawableRegenTypeDependantGeometry = 64,&lt;BR /&gt;&amp;nbsp; kDrawableIsDimension = (kDrawableIsAnEntity + kDrawableIsCompoundObject + 128),&lt;BR /&gt;&amp;nbsp; kDrawableRegenDraw = 256,&lt;BR /&gt;&amp;nbsp; kDrawableStandardDisplaySingleLOD = 512,&lt;BR /&gt;&amp;nbsp; kDrawableShadedDisplaySingleLOD = 1024,&lt;BR /&gt;&amp;nbsp; kDrawableViewDependentViewportDraw = 2048,&lt;BR /&gt;&amp;nbsp; kDrawableBlockDependentViewportDraw = 4096,&lt;BR /&gt;&amp;nbsp; kDrawableIsExternalReference = 8192,&lt;BR /&gt;&amp;nbsp; kDrawableNotPlottable = 16384&lt;BR /&gt;};&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2012 18:55:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3576534#M14485</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2012-08-13T18:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3576866#M14486</link>
      <description>&lt;P&gt;Did you read this? &lt;A href="http://adndevblog.typepad.com/autocad/2012/06/how-to-control-an-entity-viewportdraw-so-that-it-always-displays-a-plan-view-using-objectarx.html" target="_blank"&gt;http://adndevblog.typepad.com/autocad/2012/06/how-to-control-an-entity-viewportdraw-so-that-it-always-displays-a-plan-view-using-objectarx.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2012 22:17:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3576866#M14486</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2012-08-13T22:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Draw on viewport.</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3798623#M14487</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was facing the same issue, returning&amp;nbsp;kDrawableViewDependentViewportDraw fixed it in 3d mode only but in 2dwireframe, subSetAttributes/subWorldDraw/subViewportDraw are not called on my drawable during (or event after) zoom/pan.&lt;/P&gt;&lt;P&gt;Is there any way to work around this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Loic Jourdan&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2013 14:25:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/draw-on-viewport/m-p/3798623#M14487</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-07T14:25:45Z</dc:date>
    </item>
  </channel>
</rss>

