AcGs question

AcGs question

Anonymous
Not applicable
799 Views
5 Replies
Message 1 of 6

AcGs question

Anonymous
Not applicable
Hello,

I have a modal dialog with a list. When I select a list item, I do the
following:

//------------------------------------------------------------------
m_pGSManager = acgsGetGsManager(acedGetAcadDwgView());
m_pGSDevice = m_pGSManager->getGUIDevice();
m_pGSView = m_pGSManager->getGSClassFactory()->createView();

resbuf wcs, ccs, dcs;

wcs.restype = RTSHORT;
wcs.resval.rint = 0;
ccs.restype = RTSHORT;
ccs.resval.rint = 1;
dcs.restype = RTSHORT;
dcs.resval.rint = 2;

resbuf rb,rbVMin,rbVMax;

AcGeVector3d viewDir;
AcGePoint3d cenPt,vsMin,vsMax;

acedGetVar("VSMIN", &rbVMin);
acedTrans(rbVMin.resval.rpoint, &ccs, &wcs, 0, asDblArray(vsMin));

acedGetVar("VSMAX", &rbVMax);
acedTrans(rbVMax.resval.rpoint, &ccs, &wcs, 0, asDblArray(vsMax));

cenPt = AcGeLineSeg3d(vsMin,vsMax).midPoint();

acedGetVar("VIEWDIR", &rb);
acedTrans(rb.resval.rpoint, &ccs, &wcs, 0, asDblArray(viewDir));

m_pGSView->setView(cenPt+viewDir,cenPt,viewDir,vsMax.x-vsMin.x,vsMax.y-vsMin
.y);

m_pConnectionMarker = new
AcDbBlockReference(AcGePoint3d::kOrigin,m_idOfConnectionMarkerBlock); //
m_idOfConnectionMarkerBlock is in the current dwg and valid
m_pConnectionMarker->setPosition(m_pListOfItems->connectionPoint(l_hItem));
// the point is on the screen. I'm sure.

m_pGSView->add(m_pConnectionMarker,m_pGSManager->getDBModel());
m_pGSDevice->add(m_pGSView);

m_pGSView->invalidateCachedViewportGeometry();
m_pGSView->invalidate();

m_pGSManager->getDBModel()->invalidate(AcGsModel::kInvalidateAll);
//------------------------------------------------------------------

The block not displayed.
How can I display a non-database resident entity (a drawable) using the GS
system?

The blockview sample doesn't help.
Any idea? Or a code snippet?

Thanx
0 Likes
800 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Just a thought...
I would think you should use a jig, may be that's a bit out of the way but
only the jig is able to display non db-resident ents.
Otherwise you could temporarily add an entity - display it and then erase it
again.
Jörg

"Török Zoltán" schrieb im Newsbeitrag
news:50B77C1FF875B5A8D77DC9F2C580A6E5@in.WebX.maYIadrTaRb...
> Hello,
>
> I have a modal dialog with a list. When I select a list item, I do the
> following:
>
> //------------------------------------------------------------------
> m_pGSManager = acgsGetGsManager(acedGetAcadDwgView());
> m_pGSDevice = m_pGSManager->getGUIDevice();
> m_pGSView = m_pGSManager->getGSClassFactory()->createView();
>
> resbuf wcs, ccs, dcs;
>
> wcs.restype = RTSHORT;
> wcs.resval.rint = 0;
> ccs.restype = RTSHORT;
> ccs.resval.rint = 1;
> dcs.restype = RTSHORT;
> dcs.resval.rint = 2;
>
> resbuf rb,rbVMin,rbVMax;
>
> AcGeVector3d viewDir;
> AcGePoint3d cenPt,vsMin,vsMax;
>
> acedGetVar("VSMIN", &rbVMin);
> acedTrans(rbVMin.resval.rpoint, &ccs, &wcs, 0, asDblArray(vsMin));
>
> acedGetVar("VSMAX", &rbVMax);
> acedTrans(rbVMax.resval.rpoint, &ccs, &wcs, 0, asDblArray(vsMax));
>
> cenPt = AcGeLineSeg3d(vsMin,vsMax).midPoint();
>
> acedGetVar("VIEWDIR", &rb);
> acedTrans(rb.resval.rpoint, &ccs, &wcs, 0, asDblArray(viewDir));
>
>
m_pGSView->setView(cenPt+viewDir,cenPt,viewDir,vsMax.x-vsMin.x,vsMax.y-vsMin
> .y);
>
> m_pConnectionMarker = new
> AcDbBlockReference(AcGePoint3d::kOrigin,m_idOfConnectionMarkerBlock); //
> m_idOfConnectionMarkerBlock is in the current dwg and valid
>
m_pConnectionMarker->setPosition(m_pListOfItems->connectionPoint(l_hItem));
> // the point is on the screen. I'm sure.
>
> m_pGSView->add(m_pConnectionMarker,m_pGSManager->getDBModel());
> m_pGSDevice->add(m_pGSView);
>
> m_pGSView->invalidateCachedViewportGeometry();
> m_pGSView->invalidate();
>
> m_pGSManager->getDBModel()->invalidate(AcGsModel::kInvalidateAll);
> //------------------------------------------------------------------
>
> The block not displayed.
> How can I display a non-database resident entity (a drawable) using the GS
> system?
>
> The blockview sample doesn't help.
> Any idea? Or a code snippet?
>
> Thanx
> Zé
>
>
0 Likes
Message 3 of 6

Anonymous
Not applicable
"J. Schlingheider" wrote
> Just a thought...
> I would think you should use a jig, may be that's a bit out of the way but
> only the jig is able to display non db-resident ents.
> Otherwise you could temporarily add an entity - display it and then erase
it
> again.
> Jörg

No, it's not a jig.
I have a !! modal dialog !!. When the user selects an element, it zooms
(works fine) to that and
put a mark around that item on acad drawing area.
Now I have to insert a block and update its position.
Its working, but not an elegant solution (it unnecessarily modifies the dwg)

Unfortunately the GS system not well documented enough.
With the GS you can use a AcGsView (like the UCS icon or the orbit does)
to display a "drawable".

So I'm waiting for Autodesk, to give us just a litle bit deeper
documentation.
Or trying, trying, trying and getting balder and balder.

0 Likes
Message 4 of 6

Anonymous
Not applicable
I have successfully added non-DBR entities to an AcGsView using the
following initialization:

m_Device = m_GsManager->createAutoCADDevice(m_hWnd);
// a simple view
m_View = m_GsFactory->createView();
// a model with open/close protocol
m_Model = m_GsManager->createAutoCADModel();
m_Device->add(m_View);


|
----+----------------------------------------------
| Byron Blattel
| CADwerx---Applications for AutoCAD
| Autodesk Registered Developer
| email: byron@cadwerx.net
| web site: http://www.cadwerx.net
|

"Török Zoltán" wrote in message
news:50B77C1FF875B5A8D77DC9F2C580A6E5@in.WebX.maYIadrTaRb...
> Hello,
>
> I have a modal dialog with a list. When I select a list item, I do the
> following:
>
> //------------------------------------------------------------------
> m_pGSManager = acgsGetGsManager(acedGetAcadDwgView());
> m_pGSDevice = m_pGSManager->getGUIDevice();
> m_pGSView = m_pGSManager->getGSClassFactory()->createView();
>
> resbuf wcs, ccs, dcs;
>
> wcs.restype = RTSHORT;
> wcs.resval.rint = 0;
> ccs.restype = RTSHORT;
> ccs.resval.rint = 1;
> dcs.restype = RTSHORT;
> dcs.resval.rint = 2;
>
> resbuf rb,rbVMin,rbVMax;
>
> AcGeVector3d viewDir;
> AcGePoint3d cenPt,vsMin,vsMax;
>
> acedGetVar("VSMIN", &rbVMin);
> acedTrans(rbVMin.resval.rpoint, &ccs, &wcs, 0, asDblArray(vsMin));
>
> acedGetVar("VSMAX", &rbVMax);
> acedTrans(rbVMax.resval.rpoint, &ccs, &wcs, 0, asDblArray(vsMax));
>
> cenPt = AcGeLineSeg3d(vsMin,vsMax).midPoint();
>
> acedGetVar("VIEWDIR", &rb);
> acedTrans(rb.resval.rpoint, &ccs, &wcs, 0, asDblArray(viewDir));
>
>
m_pGSView->setView(cenPt+viewDir,cenPt,viewDir,vsMax.x-vsMin.x,vsMax.y-vsMin
> .y);
>
> m_pConnectionMarker = new
> AcDbBlockReference(AcGePoint3d::kOrigin,m_idOfConnectionMarkerBlock); //
> m_idOfConnectionMarkerBlock is in the current dwg and valid
>
m_pConnectionMarker->setPosition(m_pListOfItems->connectionPoint(l_hItem));
> // the point is on the screen. I'm sure.
>
> m_pGSView->add(m_pConnectionMarker,m_pGSManager->getDBModel());
> m_pGSDevice->add(m_pGSView);
>
> m_pGSView->invalidateCachedViewportGeometry();
> m_pGSView->invalidate();
>
> m_pGSManager->getDBModel()->invalidate(AcGsModel::kInvalidateAll);
> //------------------------------------------------------------------
>
> The block not displayed.
> How can I display a non-database resident entity (a drawable) using the GS
> system?
>
> The blockview sample doesn't help.
> Any idea? Or a code snippet?
>
> Thanx
> Zé
>
>
0 Likes
Message 5 of 6

Anonymous
Not applicable
Easy on your scalp 🙂

I have successfully added non-DBR entities to an AcGsView using the
following initialization:

m_Device = m_GsManager->createAutoCADDevice(m_hWnd);
// a simple view
m_View = m_GsFactory->createView();
// a model with open/close protocol
m_Model = m_GsManager->createAutoCADModel();
m_Device->add(m_View);

|
----+----------------------------------------------
| Byron Blattel
| CADwerx---Applications for AutoCAD
| Autodesk Registered Developer
| email: byron@cadwerx.net
| web site: http://www.cadwerx.net
|

"Török Zoltán" wrote in message
news:64E8F8493AA361231DE30DB49D88F84C@in.WebX.maYIadrTaRb...
>
> "J. Schlingheider" wrote
> > Just a thought...
> > I would think you should use a jig, may be that's a bit out of the way
but
> > only the jig is able to display non db-resident ents.
> > Otherwise you could temporarily add an entity - display it and then
erase
> it
> > again.
> > Jörg
>
> No, it's not a jig.
> I have a !! modal dialog !!. When the user selects an element, it zooms
> (works fine) to that and
> put a mark around that item on acad drawing area.
> Now I have to insert a block and update its position.
> Its working, but not an elegant solution (it unnecessarily modifies the
dwg)
>
> Unfortunately the GS system not well documented enough.
> With the GS you can use a AcGsView (like the UCS icon or the orbit does)
> to display a "drawable".
>
> So I'm waiting for Autodesk, to give us just a litle bit deeper
> documentation.
> Or trying, trying, trying and getting balder and balder.
>
> Zé
>
>
0 Likes
Message 6 of 6

Anonymous
Not applicable
The original of this message with attached file has been moved to
the Customer Files area
(news://discussion.autodesk.com/autodesk.autocad.customer-files
or http://discussion.autodesk.com/WebX?14@@.ee940b5). Please do
not post files or graphics in product support groups.

See the newsgroup guidelines at
http://discussion.autodesk.com/webx?groundrules.
--
Anne Brown
Manager, Moderator
Autodesk Product Support discussion groups
Discussion Q&A: http://www.autodesk.com/discussion

========
Subject:
Re: AcGs question
Date:
Thu, 20 Jun 2002 07:57:38 -0700
From:
"Fenton Webb \(Autodesk\)"

Organization:
autodesk
Newsgroups:
autodesk.autocad.objectarx

Try my version of BlockView...

Enjoy! 😉
CHeers
Fenton Webb
Developer Technical Services
Autodesk

Attachments: _BlockViewV6.zip
0 Likes