How to select multiple regions / filter in BricSYS ObjectARX ?

How to select multiple regions / filter in BricSYS ObjectARX ?

Anonymous
Not applicable
1,303 Views
9 Replies
Message 1 of 10

How to select multiple regions / filter in BricSYS ObjectARX ?

Anonymous
Not applicable

Hello,

 

 

I have multiple regions to select, with region command i can select the entities, But its very annoying to select each entinties one by one.

I want select whole drawing with window drag option but internally i want to filter the regions by groups so that i can read the region by region and entity by entity.

 

Is there any API's to read the entities to read region selected by "BOUNDARY" command.

ads_point pt;
ads_name ss;
Acad::ErrorStatus es;
if( acedGetPoint(NULL, _T("Pick a point inside a closed area:"), pt) != RTNORM ) return;
acedCommand(RTSTR, _T("-BOUNDARY"), RTSTR, _T("AD"), RTSTR,_T("IS"), RTSTR,_T("Y"),RTSTR,_T("OB"),RTSTR,_T("PO"),RTSTR,_T(""), RTPOINT, pt, RTSTR, _T(""), RTNONE);
acdbEntLast(ss); // here is your boundary.

 

 

I tried the above code but it gives one region as one AcDbPloyLine object. i m unable to read the entites.

So is there any solution 

 

 

Thanks 

Anithraj T

email id  : anith.raj@thedesignsense.com

0 Likes
1,304 Views
9 Replies
Replies (9)
Message 2 of 10

mikako_harada
Community Manager
Community Manager

Hi Anithraj, 

 

Looks like you chose a wrong forum. For ObjectARX question, the correct one is this: 

 

http://forums.autodesk.com/t5/objectarx/bd-p/34

 

I'm going to move this. 


Mikako Harada
Developer Technical Services
0 Likes
Message 3 of 10

nick83
Advocate
Advocate

acdbEntLast cant help you in this case, because you may get more than one contour (polyline) or get nothing at all, if command fails

so, try this code

AcDbObjectIdArray ids; ids.removeAll();
ads_name last_ent;
acdbEntLast(last_ent);

ads_point pt;
if( acedGetPoint(NULL, _T("Pick a point inside a closed area:"), pt) != RTNORM ) return;
acedCommand(RTSTR, _T("-BOUNDARY"), RTSTR, _T("AD"), RTSTR,_T("IS"), RTSTR,_T("Y"),RTSTR,_T("OB"),RTSTR,_T("PO"),RTSTR,_T(""), RTPOINT, pt, RTSTR, _T(""), RTNONE);

while(true)
{
	if(acdbEntNext(last_ent,last_ent) != RTNORM) break;
	AcDbObjectId eId;
	if(acdbGetObjectId(eId, last_ent) == Acad::eOk)
	{
		ids.append(eId);
	}
}

// here you have all of the bounds (ids)
0 Likes
Message 4 of 10

Anonymous
Not applicable

But above the code gives you Objectid (eId) as polyline, but i wanted to get the object id of each individual entities means line by line , arc by arc.

For ex: i have closed area of consists of 4 lines, 

According to us i should get the 4 objectId but if use your code i get only one objectId as polyLine.

 

Thanks 
Anithraj T

0 Likes
Message 5 of 10

nick83
Advocate
Advocate

sorry, but it's unpossible at all. if you have 2 polylines, 4 lines, 2 ellipses and, for example, 3 arcs - you 'll get just a set (or just one) of polylines that form closed contour(s). that's how BOUNDARY command works.
sure, you can break all of them to lines and arcs later, but if you want an exact parts of base entities (line, polyline, arc, ellipse arc) you have to do it by your own code.

so, 2 easy variants:

1. 1-N closed polylines (or one region)

2. a set of lines, arcs,... that can be created by exploding var1

 

picture shows what im talking about.

boundary.jpg

0 Likes
Message 6 of 10

Anonymous
Not applicable
Hello,


I want use hatch, through acedcommand line argument,So please let me know how to use parameters in acedcommand so that m able to use the set options that comes under the HATCH dialog box.
and what paramter where to pass.how it works.


The problem is i have construction planning i want to select each boundary along with the external boundary.

When we are selecting boundaries we use option in Islands "Nest, Outer, Ignore" .
in wanted make use options in parameters , command line arguments.
how do is use it.

Here is the HATCH code.
if( acedGetPoint(NULL, _T("Pick a point inside a closed area:"), pt) != RTNORM ) return;
//acedCommand(RTSTR, _T("HATCH"), RTSTR, _T("AD"), RTSTR,_T("IS"), RTSTR,_T("Y"),RTSTR,_T("OB"),RTSTR,_T("PO"),RTSTR,_T("SO"), RTPOINT, pt, RTSTR, _T(""), RTNONE);
acedCommand(RTSTR, _T("HATCH"), RTSTR, _T("AD"), RTSTR,_T("IS"), RTSTR,_T("Y"),RTSTR,_T(""), RTPOINT, pt, RTSTR, _T(""), RTNONE);
// acedCommand(RTSTR, _T("HATCH"), RTNONE);
acdbEntLast(ss) // here is your boundary.


Please suggest me
Thanks
Anithraj T
0 Likes
Message 7 of 10

nick83
Advocate
Advocate

i still can't understand what is your aim ))), but if you want to use HATCH command, write _-HATCH or _.-HATCH in command line and press Enter. and you'll see all of the available options
PS: using acedCommand is not the best idea ))). better to use ObjectARX. through ObjectARX you can't create a boundary, but can easily create a hatch object.

0 Likes
Message 8 of 10

Anonymous
Not applicable
Hello Nick,
Aim: calculation of form work

Please find the attached file below.

I have construction planning, it contains the hall, kitchen, etc .
The rooms contain door and windows right. Those doors and windows are custom entity.
With door or window covers one closed loop .
Now I want read line by line including my custom entity. So that when m reading each entity by entity I can get the length of line * wall height gives me the area of that wall like that I cover the closed loop.
and I know the room has how many doors so that I can subtract the area covers by door.
So get the closed loop I tried region , boundary and hatch.
Region is not good , in the perspective of user , I have to select by "window". Or line by line. Not good idea to use.
Boundary will give polyline object. even I explode it (Explode() ). I can't differentiate between line and my custom entity. (No identity).

Hatch : Hatch I can get closed loop.

Then I say that my own command compute area
Internally I filter out the HATCH by acedSSget() function
So that I will get filtered hatches, I can go one by one hatch and calculate the area.
And outer area too.

What happened is
When you do hatch, we use "nested" or "outer" radio buttons in the HATACH dialog box.

I want to now the what are the parameters we pass in acedcommand. I need clear clarification of each parameter.

Thanks
Anithraj T
0 Likes
Message 9 of 10

Anonymous
Not applicable

Hello Nick,
Aim: calculation of form work

I have construction planning, it contains the hall, kitchen, etc .
The rooms contain door and windows right. Those doors and windows are custom entity.
With door or window covers one closed loop .
Now I want read line by line including my custom entity. So that when m reading each entity by entity I can get the length of line * wall height gives me the area of that wall like that I cover the closed loop.
and I know the room has how many doors so that I can subtract the area covers by door.

So get the closed loop I tried region , boundary and hatch.
Region is not good , in the perspective of user , I have to select by “window”. Or line by line. Not good idea to use.
Boundary will give polyline object. even I explode it (Explode() ). I can’t differentiate between line and my custom entity. (No identity).

Hatch : Hatch I can get closed loop.

Then I say that my own command compute area
Internally I filter out the HATCH by acedSSget() function
So that I will get filtered hatches, I can go one by one hatch and calculate the area.
And outer area too.

What happened is
When you do hatch, we use “nested” or “outer” radio buttons in the HATACH dialog box.

I want to now the what are the parameters we pass in acedcommand. I need clear clarification of each parameter.

Thanks
Anithraj T

0 Likes
Message 10 of 10

nick83
Advocate
Advocate

so, first of all, you need to manually create a hatch with needed parameters through _-HATCH or _.-HATCH command in autocad, and keep in mind the sequence you used to create it. then use this sequence in acedcommand. that's all )

0 Likes