.NET

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

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

274 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)
AutoCAD 2012 (x64)
ADN Support Specialist
augusto.goncalves
Posts: 387
Registered: ‎04-30-2009
Message 2 of 6 (252 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
HomeBoyLV
Posts: 47
Registered: ‎06-04-2004
Message 3 of 6 (244 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
tanerpro
Posts: 83
Registered: ‎10-07-2005
Message 4 of 6 (220 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.

 

Clip_29.png

 

 

 

 

 

 

Windows 7 (x64)
AutoCAD 2012 (x64)
Distinguished Mentor
gasty1001
Posts: 576
Registered: ‎04-11-2010
Message 5 of 6 (198 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
tanerpro
Posts: 83
Registered: ‎10-07-2005
Message 6 of 6 (189 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)
AutoCAD 2012 (x64)
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!