Trimble Business Center

 View Only

 Exporting features with attributes from TBC to civil 3D

Tom Mohdi's profile image
Tom Mohdi posted 11-15-2024 05:06

Hi,
I am new to this community, and after researching this subject extensively, I joined to seek help solving the problem. Our daily survey picks various features, such as trees, lamp posts, signboards, etc. We certainly add details of each feature as attributes to each shot—attributes like tree canopy size, tree type, or lamp post number. My problem is when I export the job as dwg and open it in civil 3D, all the attributes are not imported as blocks or points attributes. Instead, the attributes mentioned will appear as extended data, so we can not populate them on the drawing. Is there any way to export the job from TBC to civil 3D to have all attributes in civil 3D as attributes?

I hope you get my point. I appreciate your help in this matter.

ian bissonnette's profile image
ian bissonnette

there might be other ways to do this, but our approach is to process in tbc with an fxl file. auto draw the linework. then bring the linework into civil copied from a dwg. the points are exported from tbc as a csv with attribute fields then imported into civil. then in civil we have a description key setup to mirror the fxl symbols so they are autodrawn. some work to setup but once done then it is mostly smooth. 

there are issues i can quickly mention a few that we still have. we have to drop the linework to 0 elevation to get linetypes to show correctly. civil does not like alpha point numbers so if you have those they need to be dealt with. 

you can autodraw the linework in civil but a few parameters don t work well. if you use line control codes a few have issues and maybe it is just the fact that we have not found a way to change things in civil. like connecting to a point. tbc wants a space CPN 23 and civil does not CPN23. if i remember right. 

and if you code with two codes on one point that might cause issues in civil. 

i also don t know about photos, but they link well usually in tbc but not sure how someone would do that in civil. 

personally i wish civil and tbc would join up and have tbc be an autocad add on. tbc has some much potential but so many clunky areas. the autocad interface is brilliant, it has sort of been tried in tbc, but there are two different command lines and some why????? why not have all commands always active with a command prompt always active. further, basic cad commands are cumbersome and slow. we have clients that require civil drawings so having them fully compatible would be incredible and we would likely pay more to trimble for one platform. 

i was actually thinking today. another powerful tool in autocad is xref drawings. i know tbc has a merge project approach but not sure about an xref option. anyways, sorry to move off topic a bit here. 

Alan Sharp's profile image
Alan Sharp

This from Chat GPT - I am sure that you can ask Chat GPT to create you an AutoLisp routine to label points with specific XData items also. You may also be able to create a Lisp routine that reads XData and writes it into the point record as an attribute also - I have never tried to write LISP myself but I know many people do this.

You can also change settings in TBC to write Point Blocks - I don't know how much of the attribute data gets transferred that way but it is in the base of the DWG exporter. I have Civil 3D and AutoCAD and can look into this Thanksgiving week to see if there is anything we can do here.

Yes, you can annotate points in AutoCAD or Civil 3D using information stored in Extended Data (XData) on the object, though it requires a combination of tools and potentially some custom scripting. Here's how you can approach it:
 
### 1. **Accessing XData**
   Extended Data is typically stored in the object as part of its extended properties. For example, points created in Civil 3D may have additional information like surface elevations, codes, or other metadata stored in XData.
 
   You can access and extract this XData using AutoCAD’s scripting or programming environment (e.g., LISP, .NET, or VBA).
 
### 2. **LISP or .NET to Extract XData**
   A common way to automate the process of annotating points with XData is by using AutoLISP or .NET. These scripts can:
   
   - Retrieve the XData associated with a point object.
   - Extract the relevant pieces of information (like an elevation or point description).
   - Create a text annotation or label based on that data.
 
   Here’s a simple example in AutoLISP that would get the XData from a point:
 
   ```lisp
   (defun c:AnnotatePoint ( / pt ent xdata)
     (setq ent (car (entsel "\nSelect a point: ")))  ; Select point object
     (setq xdata (entget ent))                       ; Get the extended data
     
     (if xdata
       (progn
         (setq value (cdr (assoc 1000 xdata)))        ; Get a specific XData value
         (command "TEXT" (list 0 0) "0.25" "Sample Text")  ; Example annotation
         )
     )
   )
   ```
 
   This would be a basic framework; you can modify it to pull specific XData items and use them in your annotations.
 
### 3. **Civil 3D Label Styles**
   Civil 3D has powerful **Label Styles** that can include custom properties. You can use **Point Group Labels** to display information stored in the point data, such as elevations, descriptions, or other point data.
 
   - **Point Group**: Create a Point Group that includes the points you want to annotate.
   - **Label Style**: Create or modify a label style to pull the specific extended data you want, using a **Custom Property**.
 
   However, Civil 3D doesn’t directly support pulling XData into the Label Style, so you may need to rely on custom scripts to extract the data and create the annotations.
 
### 4. **Using Data Extraction**
   If you’re looking to create mass annotations for multiple points based on XData, you could use AutoCAD’s **Data Extraction** tool to create a table of point data that includes the extended data fields, and then use that table to create annotations in your drawing.
 
### 5. **Automating with .NET (C# or VB)**
   For more advanced automation, you can write a C# or VB.NET application that interfaces with AutoCAD or Civil 3D via the .NET API. This would allow you to pull XData from multiple points and create annotations or labels in a more streamlined way.
 
   Example of extracting XData with .NET:
   ```csharp
   using Autodesk.AutoCAD.DatabaseServices;
   using Autodesk.AutoCAD.ApplicationServices;
   using Autodesk.AutoCAD.Runtime;
 
   public void AnnotatePointUsingXData(ObjectId pointId)
   {
       // Get the point object
       using (Transaction tr = Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction())
       {
           Point3d point = (Point3d)tr.GetObject(pointId, OpenMode.ForRead);
           ResultBuffer xData = point.XData;
 
           if (xData != null)
           {
               // Extract specific data from the XData
               foreach (TypedValue tv in xData)
               {
                   // Process your XData here
               }
 
               // Create annotation based on XData
               DBText annotation = new DBText();
               annotation.Position = new Point3d(point.X + 1, point.Y + 1, point.Z);
               annotation.TextString = "Elevation: " + extractedElevation.ToString();
               BlockTableRecord modelSpace = (BlockTableRecord)tr.GetObject(Application.DocumentManager.MdiActiveDocument.Database.CurrentSpaceId, OpenMode.ForWrite);
               modelSpace.AppendEntity(annotation);
               tr.AddNewlyCreatedDBObject(annotation, true);
           }
 
           tr.Commit();
       }
   }
   ```
 
### Conclusion
There isn't an out-of-the-box feature in AutoCAD or Civil 3D that automatically annotates points with XData, but with scripting (e.g., AutoLISP or .NET) or using Civil 3D's label styles, you can achieve this. The choice of method depends on how complex your annotation needs are and whether you require automation for a large number of points.
Tom Mohdi's profile image
Tom Mohdi

ian bissonnette, Thank you for your reply. Looks like you feel me exactly.

Tom Mohdi's profile image
Tom Mohdi

Alan Sharp ,

Thank you so much for your reply and help. I didn't think to ask Chat GPT about this, but I will as long as Autodesk and Rider Trimble want to solve this issue.