Convert Object Data Field

Convert Object Data Field

Pointdump
Consultant Consultant
3,855 Views
13 Replies
Message 1 of 14

Convert Object Data Field

Pointdump
Consultant
Consultant

Is there a way to convert the OD field from "420 ft" to just "420" so that I can use the elevations to create a surface in Civil 3D? When I Attach and Query I get a dialogue box that says "Check for possible mismatched data type in the expression." So I guess I need to remove the "ft" part and change the field from string to integer.

The original contours were in GDB files. I converted the GDB to SHP in QGIS.

OD_1.png

 

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Accepted solutions (3)
3,856 Views
13 Replies
Replies (13)
Message 2 of 14

АлексЮстасу
Advisor
Advisor

ODEDIT_REPLACE

In the ELEVATION field, replace " ft"(space and "ft") with "", i.e. empty, nothing.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 3 of 14

ChicagoLooper
Mentor
Mentor
Accepted solution

Yes, of course it can be done.

 

  1. Open a clean, brand new drawing and assign an appropriate Coordinate Sytem. Execute MAPIMPORT on the 20ftContours_26918 shapefile and create OBJECT DATA during this import procedure. The contours will appear in model space as AutoCAD polylines.
  2. Go to Map Setup Tab=>Attribute Data Panel. Make sure '20ftContours_26918' is displayed in the Table dropdown menu.
  3. Highlight ELEVATION=>Click MODIFY
  4. Under Field Definition section, go to TYPE=>Integer=>OK (Be patient and wait for M3D to process the data change from Character to Integer.) Select a contour and verify in Properties Palette whether 'ft' has been removed.
  5. Save this drawing in your project folder giving it a name such as '20ftContour_Setup.'
  6. In another drawing, either new or existing, attach the setup dwg to Task Pane and perform a query. You can now use Alter Properties function to raise the contours to their proper elevation.

 

 

Chicagolooper

EESignature

Message 4 of 14

O_Eckmann
Mentor
Mentor

Hi,

 

1. Open DBF file in LibreOffice Calc 7.0.1

2. Select column ELEVATION and Ctrl+H (find and replace) " ft" by ""

3. Save your DBF (if you have a error message with LENGTH column, reduce number of digit)

4. MapImport your SHP

 

Olivier

Olivier Eckmann

EESignature

0 Likes
Message 5 of 14

Pointdump
Consultant
Consultant

Hi Alexander,
Thank you. That will take out the " ft", but it remains a string. I need an integer or real to create a surface in Civil 3D. I used MAPEXPORT on your drawing and opened up the shapefile in QGIS:

 

OD_2.png

 


Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 6 of 14

Pointdump
Consultant
Consultant

@ChicagoLooper,
"2. Go to Map Setup Tab=>Attribute Data Panel. Make sure '20ftContours_26918' is displayed in the Table dropdown menu."
You lost me here. What am I looking for?

 

OD_3.png

 


Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 7 of 14

Pointdump
Consultant
Consultant

Hi Olivier,
I think you can open a DBF in Excel as well. And I also have DBF Commander. But the big problem is that I need to also convert the string to an integer or real to create a surface in Civil 3D.

 

OD_4.png

 


Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 8 of 14

Pointdump
Consultant
Consultant

@ChicagoLooper,
OK, so what I needed to find was "Define Object Data". And that did work indeed, even stripping out the alpha characters. Now I'll see if I can create a surface in Civil 3D with the modified OD.

 

OD_5.png

 

OD_6.png

 

OD_7.png

 


Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 9 of 14

ChicagoLooper
Mentor
Mentor

Works for me.

 

surface & object viewer.JPG

 

BTW,

when you change the Object Data from 'Character' to 'Integer' you are changing the OD from string to numeric. You are not changing the dbf file. So if you open that same shapefile in QGIS then you are still reading the same ol' dbf so it'll still be a string. After you've changed the data type from character to integer, save and attach this saved dwg to another drawing. You can query and simultaneously perform alter properties to create raised contours. The properly raised contours will be your surface definition. 

 

You don't need to take the original shapefile back to QGIS, that's an unnecessary step. Simply raise your contours using Alter Propeties so you'll have your surface definition. 

 

Chicagolooper

EESignature

Message 10 of 14

O_Eckmann
Mentor
Mentor
Accepted solution

Hi Dave,

 

With DBF Commander, in File Menu, you have "Structure" command (or Ctrl+S)

image.png

And you can change the type from character to integer or double.

 

With Excel you can open DBF file, but you can't save to DBF (it's stupid !), that's why I prefer to use LibreOffice.

 

And in LibreOffice, 1st line contains type of data. Cell D1 (for ELEVATION field) contains "ELEVATION,C,7" with means Character with 7 letters. You can replace it by "ELEVATION,N,5,0" to convert to integer or "ELEVATION,N,10,2" to convert to double with 2 digits for example.

 

Olivier

Olivier Eckmann

EESignature

Message 11 of 14

O_Eckmann
Mentor
Mentor
Accepted solution

Hi Dave,

 

In QGIS you could add a new integer field and filled it with ELEVATION field via some action

image.png

 

And your SHP/DBF is OK to create a Surface from GIS Data in Civil 3D without using CAD Polyline with elevation.

image.png

image.png

image.png

image.png

 

Olivier

Olivier Eckmann

EESignature

Message 12 of 14

Pointdump
Consultant
Consultant

@ChicagoLooper,
I greatly appreciate your help on this one. This rabbit hole was actually a side trip. I needed a County-wide Surface to test a Custom Low-Distortion Projection.
"You don't need to take the original shapefile back to QGIS..."
I did a MAPEXPORT and dropped it into QGIS just to quickly see if it "took". I haven't created a Surface yet in Civil 3D because I need to verify the elevations. Original data was, I think, in UTM83-18, which is a Metric CS. Which makes me question the " ft" part.
<Rant on>
When data, any kind of data, is posted with incomplete, faulty, or non-existent metadata, my temples throb with anger. And don't get me started about data in proprietary formats.
<Rant off>
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 13 of 14

Pointdump
Consultant
Consultant

Olivier,
Thank you for that. I knew there had to be a way in DBF Commander. (Not a program I use much.) And I will keep LibreOffice in mind. I used it once to open and save a spreadsheet that Excel wouldn't open.
There's also a way in QGIS to convert a string to integer or double, but with Map it's easier, and I like to exhaust all possibilities in Autodesk software first before turning to other software.
Thank you again.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 14 of 14

Pointdump
Consultant
Consultant

Olivier,
Thanks for the QGIS way, and I keep forgetting "Create Surface from GIS Data" in Civil 3D.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes