[postgis-users] Best way to get CircularStrings with attributes into AutoCAD ?

Basques, Bob (CI-StPaul) bob.basques at ci.stpaul.mn.us
Thu May 18 15:26:35 PDT 2017


All,

Answering my own post.

While it’s not the most elegant, it works . . .

I’m importing the Lines and Arcs separately into AutoCAD.

Here are my SQL statements (W/embedded AutoLISP code . . .) :

— circularStrings

select
'(setq p1 (list ' || substring(ST_AsText(ST_PointN(geom, 1)) from 7) || ') ' ||
'(setq p2 (list ' || substring(ST_AsText(ST_PointN(geom, 2)) from 7) || ') ' ||
'(setq p3 (list ' || substring(ST_AsText(ST_PointN(geom, 3)) from 7) || ') ' ||
'(command "arc" p1 p2 p3) ' ||
'(setq newf (cdr (assoc -1 (entget (entlast))))) ' ||
'(ade_odaddrecord newf "CSEGMENTS") ' ||
'(ade_odsetfield newf "CSEGMENTS" "row_number" 0 ' || row_number || ') ' ||
'(ade_odsetfield newf "CSEGMENTS" "parcelid" 0 "' || parcelid || '") ' ||
'(ade_odsetfield newf "CSEGMENTS" "length" 0 ' || length || ') ' as lispcode
from
rc_parcel_csegments

— output sample . . .

"(setq p1 (list 600685.235522255 219942.697182685)) (setq p2 (list 600693.342558373 219979.8599755)) (setq p3 (list 600698.003484443 220017.610119224)) (command "arc" p1 p2 p3) (setq newf (cdr (assoc -1 (entget (entlast))))) (ade_odaddrecord newf "CSEGMENTS") (ade_odsetfield newf "CSEGMENTS" "row_number" 0 1) (ade_odsetfield newf "CSEGMENTS" "parcelid" 0 "013022120083") (ade_odsetfield newf "CSEGMENTS" "length" 0 76.1003792415913) "
"(setq p1 (list 600948.746080443 219842.610487968)) (setq p2 (list 600948.358392681 219840.945456597)) (setq p3 (list 600947.965196267 219839.281702653)) (command "arc" p1 p2 p3) (setq newf (cdr (assoc -1 (entget (entlast))))) (ade_odaddrecord newf "CSEGMENTS") (ade_odsetfield newf "CSEGMENTS" "row_number" 0 2) (ade_odsetfield newf "CSEGMENTS" "parcelid" 0 "013022130020") (ade_odsetfield newf "CSEGMENTS" "length" 0 3.41915697291469) "
"(setq p1 (list 600657.889986396 219869.353512585)) (setq p2 (list 600673.300839893 219905.377319746)) (setq p3 (list 600685.235522255 219942.697182685)) (command "arc" p1 p2 p3) (setq newf (cdr (assoc -1 (entget (entlast))))) (ade_odaddrecord newf "CSEGMENTS") (ade_odsetfield newf "CSEGMENTS" "row_number" 0 3) (ade_odsetfield newf "CSEGMENTS" "parcelid" 0 "013022130031") (ade_odsetfield newf "CSEGMENTS" "length" 0 78.3927875233048) "


— lineStrings

select
'(setq p1 (list ' || substring(ST_AsText(ST_PointN(geom, 1)) from 7) || ') ' ||
'(setq p2 (list ' || substring(ST_AsText(ST_PointN(geom, 2)) from 7) || ') ' ||
'(command "line" p1 p2 "") ' ||
'(setq newf (cdr (assoc -1 (entget (entlast))))) ' ||
'(ade_odaddrecord newf "CSEGMENTS") ' ||
'(ade_odsetfield newf "CSEGMENTS" "row_number" 0 ' || row_number || ') ' ||
'(ade_odsetfield newf "CSEGMENTS" "parcelid" 0 "' || parcelid || '") ' ||
'(ade_odsetfield newf "CSEGMENTS" "length" 0 ' || length || ') ' as lispcode
from
rc_parcel_lsegments

— output sample . . .basically, I just run the (Auto)LISP code on the commandline in AutoCAD, and I end up with features and Objectdata attached . . .works like a charm.

"(setq p1 (list 595666.114621326 156963.072483376)) (setq p2 (list 595663.839722514 157136.207306489)) (command "line" p1 p2 "") (setq newf (cdr (assoc -1 (entget (entlast))))) (ade_odaddrecord newf "CSEGMENTS") (ade_odsetfield newf "CSEGMENTS" "row_number" 0 1) (ade_odsetfield newf "CSEGMENTS" "parcelid" 0 "C98") (ade_odsetfield newf "CSEGMENTS" "length" 0 173.14976794376) "
"(setq p1 (list 595663.839722514 157136.207306489)) (setq p2 (list 595661.224519357 157507.969695389)) (command "line" p1 p2 "") (setq newf (cdr (assoc -1 (entget (entlast))))) (ade_odaddrecord newf "CSEGMENTS") (ade_odsetfield newf "CSEGMENTS" "row_number" 0 2) (ade_odsetfield newf "CSEGMENTS" "parcelid" 0 "C98") (ade_odsetfield newf "CSEGMENTS" "length" 0 371.771587252435) "
"(setq p1 (list 595661.224519357 157507.969695389)) (setq p2 (list 595791.264319509 157507.750218511)) (command "line" p1 p2 "") (setq newf (cdr (assoc -1 (entget (entlast))))) (ade_odaddrecord newf "CSEGMENTS") (ade_odsetfield newf "CSEGMENTS" "row_number" 0 3) (ade_odsetfield newf "CSEGMENTS" "parcelid" 0 "C98") (ade_odsetfield newf "CSEGMENTS" "length" 0 130.039985364846) "


On May 17, 2017, at 2:22 PM, Basques, Bob (CI-StPaul) <bob.basques at ci.stpaul.mn.us<mailto:bob.basques at ci.stpaul.mn.us>> wrote:

All,

I tried DXF (although there were some settings I didn’t try) and that didn’t seem to work, the arcs came in, but no attribute (extended) data applied to any of the features.  Even GeoJSON doesn’t seem to support circles/arcs (right)?

Am I going to need to write my own importer for CSV, or?  Still phutzing with it . . .

thankks

bobb




“There is nothing quite so useless as doing with great efficiency something that should not be done at all.”
                        - Peter Drucker





_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org<mailto:postgis-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/postgis-users



"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170518/138ce7a8/attachment.html>


More information about the postgis-users mailing list