ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

acedSSGet fence mode problem

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
fsztuczny
1458 Views, 5 Replies

acedSSGet fence mode problem

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;

 

 

 

5 REPLIES 5
Message 2 of 6
Nick1983
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
Message 3 of 6
fsztuczny
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]

 

Message 4 of 6
fsztuczny
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;
}

 

Message 5 of 6


@fsztuczny wrote:

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

Also all points must be visible in current view.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 6 of 6

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost