Sunday, December 2, 2012

TIP: Draw polyline in AutoCAD from entry in ORACLE

Sometime you just need to draw complicated polyline with lot of vertices in AutoCAD (possibly MAP 3D), but you have all you coordinates saved in attribute with data type SDO_GEOM.
In different Country Kits in AutoCAD Map3D you have different line tables, for example WA_LINE, GA_LINE (prefix depends what kind of utility you are working with) and there is SDO_GEOM type attributed called GEOM. Lets say we have 100000 lines. But what line do you want to draw in AutoCAD?
Aaah, thank you. So, as you answered, let's draw line with unique indentificator FID = 48685.
  1. Then you can use this SQL script:

  2. select l.FID,trim(replace(WM_CONCAT( replace(to_char(X.X),',','.') || ',' || replace(to_char(X.Y),',','.') || ' ' ),' ,',' ') ) as COORDINATES from TC_LINE l, table(SDO_UTIL.GETVERTICES(l.geom)) X where FID=48685 group by l.FID; 
  3. Output will look like this:
  4. AutoCAD Map 3D, Sql sheet output shows line coordinates
  5. Now easy part starts. Copy coordinates.
  6. Start AutoCAD. Yeah, you are good :)
  7. Write _pline command.
  8. And paste your coordinates.
  9. Good job! I should hire you. Beautiful polyline:

No comments:

Post a Comment