Entities disapear while using AcEdJig

Entities disapear while using AcEdJig

fehrsZBFB9
Advocate Advocate
1,779 Views
6 Replies
Message 1 of 7

Entities disapear while using AcEdJig

fehrsZBFB9
Advocate
Advocate

Hallo Community,

 

I derived an AcEdJig class to get a point. I works so far. But if I zoom out a lot, entities except the dragged entity disappear. The class is used from a lisp function registered with acedDefun. Any Idea why this is happening? How can I stop it?

 

Edit: I realized, that is is not happening when used from a command registered with acedRegCmds->addCommand. The zoom is limited. How can I get the same behaviour for a lisp function?

 

Thanks,

Martin

0 Likes
1,780 Views
6 Replies
Replies (6)
Message 2 of 7

moogalm
Autodesk Support
Autodesk Support

Interesting!, can you please give a reproducible code ?

And, with what command flag arx command is registered is it transparent ?

Generally, nesting level of commands is put four, for example 1. being your command,  [calling commands via acedCommandS ] 2 Line 3. zoom 4 setvar.

 

Anyway, I need code to understand and troubleshoot the behavior.

0 Likes
Message 3 of 7

fehrsZBFB9
Advocate
Advocate

The flags for the command are ACRX_CMD_NOPAPERSPACE | ACRX_CMD_NOPERSPECTIVE.

I have to create a minimal working example. I cannot put my current code here.

0 Likes
Message 4 of 7

fehrsZBFB9
Advocate
Advocate

Sorry, still no minimal working example. I'm really busy. But I realized, that this is only happening in wireframe 2d. If i zoom out too much, the screen is regenerated and the entity disappears. It's working in wireframe.

0 Likes
Message 5 of 7

fehrsZBFB9
Advocate
Advocate

I edited the elipsjig example shipped with objectarx I added calls to acedDefun and acedRegFunc to define a lisp function called (VELLIPSE). It does the same as the command. If you're calling the lisp function, using wireframe 2d andzoom out too much during the drag sequenece other entities disapear.

 

 

#if defined(_DEBUG) && !defined(AC_FULL_DEBUG)
#error _DEBUG should not be defined
#endif

#include <Windows.h>
#include <adslib.h>
#include <dbjig.h>
#include <dbelipse.h>
#include <aced.h>
#include <geassign.h>
#include <dbapserv.h>
#include "tchar.h"
class AsdkEllipseJig : public AcEdJig { public: AsdkEllipseJig(const AcGePoint3d&, const AcGeVector3d&); void doIt(); virtual DragStatus sampler(); virtual Adesk::Boolean update(); virtual AcDbEntity* entity() const; private: AcDbEllipse *mpEllipse; AcGePoint3d mCenterPt, mAxisPt; AcGeVector3d mMajorAxis, mNormal; double mRadiusRatio; int mPromptCounter; }; AsdkEllipseJig::AsdkEllipseJig( const AcGePoint3d& pt, const AcGeVector3d& normal) : mCenterPt(pt), mNormal(normal), mRadiusRatio(0.00001), mPromptCounter(0) { resbuf rb; memset (&rb, 0, sizeof (resbuf)); acedGetVar (_T("VIEWSIZE"), &rb); double majorAxisInitialOffset = rb.resval.rreal/1000.0; mMajorAxis = AcGeVector3d(majorAxisInitialOffset,0,0); // Offset the major axis a bit from the center point. } void AsdkEllipseJig::doIt() { mpEllipse = new AcDbEllipse(); mpEllipse->set(mCenterPt, mNormal, mMajorAxis, mRadiusRatio); // Set default parameters for the ellipse. setDispPrompt(_T("\nEllipse major axis: ")); AcEdJig::DragStatus stat = drag(); mPromptCounter++; // now == 1 setDispPrompt(_T("\nEllipse minor axis: ")); stat = drag(); append(); }
AcEdJig::DragStatus AsdkEllipseJig::sampler() { DragStatus stat; setUserInputControls((UserInputControls)(AcEdJig::kAccept3dCoordinates | AcEdJig::kNoNegativeResponseAccepted | AcEdJig::kNoZeroResponseAccepted)); if (mPromptCounter == 0)
{ static AcGePoint3d axisPointTemp; stat = acquirePoint(mAxisPt, mCenterPt); if (axisPointTemp != mAxisPt) axisPointTemp = mAxisPt; else if (stat == AcEdJig::kNormal) return AcEdJig::kNoChange; } else if (mPromptCounter == 1)
{ static double radiusRatioTemp = -1; stat = acquireDist(mRadiusRatio, mCenterPt); if (radiusRatioTemp != mRadiusRatio) radiusRatioTemp = mRadiusRatio; else if (stat == AcEdJig::kNormal) return AcEdJig::kNoChange; } return stat; } Adesk::Boolean AsdkEllipseJig::update() { switch (mPromptCounter)
{ case 0: mMajorAxis = mAxisPt - mCenterPt; break; case 1: mRadiusRatio = mRadiusRatio / mMajorAxis.length(); break; } mpEllipse->set(mCenterPt, mNormal, mMajorAxis, mRadiusRatio); return Adesk::kTrue; } AcDbEntity* AsdkEllipseJig::entity() const { return mpEllipse; }
void createEllipse() { AcGePoint3d tempPt; struct resbuf rbFrom, rbTo; acedGetPoint(NULL, _T("\nEllipse center point: "), asDblArray(tempPt)); rbFrom.restype = RTSHORT; rbFrom.resval.rint = 1; // from UCS rbTo.restype = RTSHORT; rbTo.resval.rint = 0; // to WCS acedTrans(asDblArray(tempPt), &rbFrom, &rbTo, Adesk::kFalse, asDblArray(tempPt)); AcGeVector3d x = acdbHostApplicationServices()->workingDatabase()->ucsxdir(); AcGeVector3d y = acdbHostApplicationServices()->workingDatabase()->ucsydir(); AcGeVector3d normalVec = x.crossProduct(y); normalVec.normalize();
AsdkEllipseJig *pJig = new AsdkEllipseJig(tempPt, normalVec); pJig->doIt(); delete pJig; } int createElipseWithLisp() { createEllipse(); return RTNORM; } void initApp() { acedRegCmds->addCommand(_T("ASDK_VISUAL_ELLIPSE"), _T("ASDK_VELLIPSE"), _T("VELLIPSE"), ACRX_CMD_MODAL, createEllipse); acedDefun(_T("VELLIPSE"), 999); acedRegFunc(createElipseWithLisp, 999); } void unloadApp() { acedRegCmds->removeGroup(_T("ASDK_VISUAL_ELLIPSE")); } extern "C" AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void* appId) { switch (msg)
{ case AcRx::kInitAppMsg: acrxDynamicLinker->unlockApplication(appId); acrxDynamicLinker->registerAppMDIAware(appId); initApp(); break; case AcRx::kUnloadAppMsg: unloadApp(); } return AcRx::kRetOK; }

 

 

0 Likes
Message 6 of 7

fehrsZBFB9
Advocate
Advocate

Has Anyone an idea how to keep the objects visible? The drawing is regenerated while zooming. Either I have to block this regeneration or I need to refresh the display. But I don't know how.

0 Likes
Message 7 of 7

fehrsZBFB9
Advocate
Advocate


Another Solution that would be OK for me is to limit the zoom. This is already the case when I run my code inside a command.

0 Likes