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

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

5 REPLIES 5
Reply
Message 1 of 6
tanerpro
791 Views, 5 Replies

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

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,

 

5 REPLIES 5
Message 2 of 6

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
Twitter @augustomaia
Autodesk Developer Network
Message 3 of 6
HomeBoyLV
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

 

Message 4 of 6
tanerpro
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

 

 

 

 

 

 

Message 5 of 6
hgasty1001
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

Message 6 of 6
tanerpro
in reply to: hgasty1001

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,

 

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost