.NET

## .NET

Valued Contributor
Posts: 83
Registered: ‎10-07-2005
Message 1 of 6 (256 Views)

# Any idea about finding the cardinal points of a closed polyline?

256 Views, 5 Replies
06-20-2013 03:05 AM

Hello,

I want to find the cardinal points ( N, S, E, W) of each face of a closed polyline, can you give me ideas about how?

Thanks,

Windows 7 (x64)
Posts: 358
Registered: ‎04-30-2009
Message 2 of 6 (234 Views)

# Re: Any idea about finding the cardinal points of a closed polyline?

06-20-2013 07:35 AM in reply to: tanerpro

Not sure what you mean...can you elaborate more? Maybe an image?

There is a Face.GetVertexAt method, which gives XYZ coordinate of each vertice.

Using BREP you may extract more data, such as normal or derivate.

Regards,

Augusto Goncalves
Autodesk Developer Network
Active Contributor
Posts: 47
Registered: ‎06-04-2004
Message 3 of 6 (226 Views)

# Re: Any idea about finding the cardinal points of a closed polyline?

06-20-2013 01:36 PM in reply to: tanerpro

Not too hard.

1. Detirmin the direction that the polyline was drawn (clockwise or anti-clockwise) Search for the "IsLeft" function online, this will give you the ability to find this.
2. Look at the angle of the line that is created by two ajacent points.
For polylines drawn clockwise, the north line will have an angle 0deg +- 45deg relitive to the x-axis and so on around the polyline.

For anti-clockwise the angle will be 180deg +- 45deg
3.  The challange comes for polylines that are on the 45deg. This is undefined by its nature. You just need to define it for you purpose, and stick with it through your application.

I actually do this type of calculation quite a bit, so I should have somecode laying around that I will post later if you need it.

HomeBoy Out

Valued Contributor
Posts: 83
Registered: ‎10-07-2005
Message 4 of 6 (202 Views)

# Re: Any idea about finding the cardinal points of a closed polyline?

06-22-2013 04:11 AM in reply to: HomeBoyLV

Thank you very much,

I have got rooms like in the image below, sure there are windows and doors in it, the problem is to find the direction of each wall around it (which one is forward to North, South, East,West).  What my proposal was, to explode the walls, check for the intersection between the wall segments and the room, if there are any, find a polar point 90 ° from the mid point of wall segment and check if it is in the room, if not then it is the direction of the wall. But I'm sure there are some .net methods to make it simpler. Any code will be very appreciated.

Thanks indeed.

Windows 7 (x64)
Valued Mentor
Posts: 479
Registered: ‎04-11-2010
Message 5 of 6 (180 Views)

# Re: Any idea about finding the cardinal points of a closed polyline?

06-22-2013 06:54 PM in reply to: tanerpro

Hi,

I'm not sure if i understand, but if you are trying to find the the inward side of a wall, you can make a little fence or crossing selection at the mid point, with a filter on the layer of the room segments, if something is selected, then it's a inward wall side.

Gaston Nunez

Valued Contributor
Posts: 83
Registered: ‎10-07-2005
Message 6 of 6 (171 Views)

# Re: Any idea about finding the cardinal points of a closed polyline?

06-22-2013 11:30 PM in reply to: gasty1001

There are lots of walls and rooms in the drawing, the problem is which wall is arouns which room and then what is the direction of each wall. This link is an example of revit and tells exacly what I'm trying to do.

http://wikihelp.autodesk.com/Revit/enu/2013/Help/00006-API_Developer%27s_Guide/0074-Revit_Ge74/0108-...

Is it possible to do the same thing in Autocad?

Regards,

Windows 7 (x64)