ObjectARX

Reply
Valued Contributor
fsztuczny
Posts: 51
Registered: ‎02-25-2010
Message 1 of 6 (698 Views)
Accepted Solution

acedSSGet fence mode problem

698 Views, 5 Replies
05-19-2011 12:07 PM

Welcome

I'm trying to use an open and not intersecting polyline to select objects using the mode of fence, but acedSSGet function returns an error code -5001 (Some other error.) I used the example code slightly modified by me (below). What is wrong there?

Regards.

 

 

resbuf*
ptArrayToResbuf(const AcGePoint3dArray& ptArray)
{
    resbuf* ptList = NULL;        // overall list
    resbuf* lastRb = NULL;        // place holder to end of list
    resbuf* rb;
    int len = ptArray.length();
    for (int i=0;i<len;i++) {
        if ((rb = acutNewRb(RT3DPOINT)) == NULL) {
            acutRelRb(ptList);
            return NULL;
        }
        ads_point_set( asDblArray(ptArray.at(i)), rb->resval.rpoint );
        if (ptList == NULL) {
            ptList = rb;
            lastRb = rb;
        }
        else {
            lastRb->rbnext = rb;
            lastRb = rb;
        }
    }
    return ptList;
}

bool fenceSelect( const AcGePoint3dArray& ptArray, ads_name& ss, const resbuf* filter )
{
	// NOTE: flags not allowed on this type of selection
    resbuf* ptList = ptArrayToResbuf(ptArray);
    if (ptList == NULL)
        return false;

    int result = acedSSGet(_T("_F"), ptList, NULL, filter, ss);
    acutRelRb(ptList);
    return result == RTNORM;
}

//CUT...
AcGePoint3dArray arPunkty; for( int i = 0; i < wPlinia->numVerts(); i++ ) { AcGePoint2d p2d; ErrorStatus eS = wPlinia->getPointAt( i, p2d ); if( eS != eOk ) { acdbFail( L"\nGet polylinie point failed!" ); acutPrintf( L" Error code: %d", eS ); eS = wPlinia->close(); return; } //if( eS != eOk ) arPunkty.append( AcGePoint3d( p2d.x, p2d.y, 0 ) ); } //for( int i = 0; i < wPlinia->numVerts(); i++ ) ads_name ss; if( !fenceSelect( arPunkty, ss, NULL ) ) { acedPrompt( L"\nNothing selected!" ); ErrorStatus eS = wPlinia->close(); return; } //if( !fenceSelect( arPunkty, NULL ) ) acedSSSetFirst( ss, NULL ); acedSSFree( ss ); ErrorStatus eS = wPlinia->close(); return;

 

 

 

Valued Contributor
Nick1983
Posts: 86
Registered: ‎03-10-2010
Message 2 of 6 (688 Views)

Re: acedSSGet fence mode problem

05-20-2011 12:02 AM in reply to: fsztuczny

resbuf* ptArrayToResbuf(const AcGePoint3dArray& ptArray)
{

...

  }

  lastRb->rbnext = NULL;

  return ptList;
}

 

try this one. U have to close your resbuf.

---
#define QUESTION(b) (2*b)||(!(2*b)) © William Shakespeare
Valued Contributor
fsztuczny
Posts: 51
Registered: ‎02-25-2010
Message 3 of 6 (685 Views)

Re: acedSSGet fence mode problem

05-20-2011 12:29 AM in reply to: Nick1983

Thank you, but I checked that acutNewRb (RT3DPOINT)) sets -> rbnext to NULL. I did like the one suggested, but it does not work. ptList to present content from one segment polyline.

ptList	0x0a8828e0 {rbnext=0x0a8831b0 restype=5009 resval={...} }	resbuf *
	rbnext	0x0a8831b0 {rbnext=0x00000000 restype=5009 resval={...} }	resbuf *
		rbnext	0x00000000 {rbnext=??? restype=??? resval={...} }	resbuf *
		restype	5009	short
		resval	{rreal=7559342609.7919188 rpoint=0x0a8831b8 rint=-21581 ...}	ads_u_val
			rreal	7559342609.7919188	double
			rpoint	0x0a8831b8	double [3]
				[0]	7559342609.7919188	double
				[1]	5614187999.5393038	double
				[2]	0.00000000000000000	double
			rint	-21581	short
			rstring	0xa11cabb3 <Bad Ptr>	wchar_t *
			rlname	0x0a8831b8	long [2]
			rlong	-1591956557	long
			rbinary	{clen=-21581 buf=0x41fc2926 <Bad Ptr> }	ads_binary
			ihandle	0x0a8831b8 "ł«ˇ&)üAý ř]ęôA"	unsigned char [8]
	restype	5009	short
	resval	{rreal=7559342118.2338028 rpoint=0x0a8828e8 rint=-16984 ...}	ads_u_val
	rreal	7559342118.2338028	double
	rpoint	0x0a8828e8	double [3]
		[0]	7559342118.2338028	double
		[1]	5614194983.2556734	double
		[2]	0.00000000000000000	double
	rint	-16984	short
	rstring	0x8263bda8 <Bad Ptr>	wchar_t *
	rlname	0x0a8828e8	long [2]
	rlong	-2107392600	long
	rbinary	{clen=-16984 buf=0x41fc2926 <Bad Ptr> }	ads_binary
	ihandle	0x0a8828e8 "¨˝c‚&)üA=tęôA"	unsigned char [8]

 

Valued Contributor
fsztuczny
Posts: 51
Registered: ‎02-25-2010
Message 4 of 6 (670 Views)

Re: acedSSGet fence mode problem

05-20-2011 03:39 AM in reply to: fsztuczny

I found a solution: Just need to convert from WCS to UCS

 

ptArrayToResbuf(const AcGePoint3dArray& ptArrayWCS)
{
    resbuf* ptList = NULL;        // overall list
    resbuf* lastRb = NULL;        // place holder to end of list
    resbuf* rb;
    int len = ptArrayWCS.length();
    for (int i=0;i<len;i++) {
        if ((rb = acutNewRb(RT3DPOINT)) == NULL) {
            acutRelRb(ptList);
            return NULL;
        }
        acdbWcs2Ucs( asDblArray(ptArrayWCS.at(i)), rb->resval.rpoint, false );
        if (ptList == NULL) {
            ptList = rb;
            lastRb = rb;
        }
        else {
            lastRb->rbnext = rb;
            lastRb = rb;
        }
    }
    return ptList;
}

 

Moderator
Alexander.Rivilis
Posts: 1,398
Registered: ‎04-09-2008
Message 5 of 6 (654 Views)

Re: acedSSGet fence mode problem

05-24-2011 12:25 AM in reply to: fsztuczny

fsztuczny wrote:

I found a solution: Just need to convert from WCS to UCS

Also all points must be visible in current view.


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Valued Contributor
fsztuczny
Posts: 51
Registered: ‎02-25-2010
Message 6 of 6 (625 Views)

Re: acedSSGet fence mode problem

06-06-2011 06:20 AM in reply to: Alexander.Rivilis

Exactly. For this purpose I use the zoom and getGeomExtents.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community