Announcements

Community notifications may experience intermittent interruptions between 10–12 November during scheduled maintenance. We appreciate your patience.

How remove spaces?

How remove spaces?

mehdi-guida
Advocate Advocate
832 Views
9 Replies
Message 1 of 10

How remove spaces?

mehdi-guida
Advocate
Advocate

Hi, I created line table(below image). Bearings are created by below codes and are dynamic.

How can I remove spaces in Bearing values? ('N 18d15'28" E'    to   'N18d15'28"E' )

and how can I change 'd' to '°' ?

 

 

lines_table.SetTextString(i + 2, 1, "%<\\AcObjProp Object(%<\\_ObjId " + lineid.Angle \\f \"%au4\">%");

 

mehdiguida_0-1685639893021.png

 

0 Likes
833 Views
9 Replies
Replies (9)
Message 2 of 10

hippe013
Advisor
Advisor

Select your table and right click and select "Edit Table Style"

Select the appropriate column and double click to bring up the Text Component Editor

hippe013_0-1685647375793.png

 

Select DDMMSS.SS and then click the arrow to send it over ->

 

hippe013_1-1685647432659.png

 

I hope this helps. 

 

 

EDIT: Sorry, I misspoke. You will want to select the short name under the direction row. 

 

hippe013_0-1685647651391.png

 

 

 

0 Likes
Message 3 of 10

mehdi-guida
Advocate
Advocate
Thank you for reply. But I need to know what changes in my code can remove spaces automatically. I know the manual method.
0 Likes
Message 4 of 10

hippe013
Advisor
Advisor

Here is a quick example of setting the Direction ColumnStyle of a TableStyle to Short Name without spaces. 

Where "res" is my PromptEntityResult and civDb is the Import Abbreviation to avoid conflicts with Autodesk.AutoCAD.DatabaseServices

 

...
Imports civDb = Autodesk.Civil.DatabaseServices 
...

Using tr As Transaction = db.TransactionManager.StartTransaction
   'Get the Parcel Segment Table
   Dim tbl As civDb.ParcelSegmentTable = tr.GetObject(res.ObjectId, OpenMode.ForRead)

   'Get the TableStyle
   Dim style As civDb.Styles.TableStyle = tr.GetObject(tbl.StyleId, OpenMode.ForWrite)

   'In my Style the Direction Column is the Third Column. 
   Dim dirStyle As ColumnStyle = style.ColumnStyles(2)

   'DSn is the Direction Short Name witout Spaces
   Dim format As String = "<[Segment Direction(Udeg|FDMSd|MB|P6|RN|DSn|CU|AP|EN|DZN|OF)]>"
   dirStyle.ContentStringFormatted = format

   'Commit Transaction
   tr.Commit()
End Using

 

 

 

0 Likes
Message 5 of 10

Jeff_M
Consultant
Consultant

@hippe013 Evidently @mehdi-guida is using plain Acad tables and filling them in with Fields, with the direction formatted to Surveyor units. I don't believe those units are editable. 

 

@mehdi-guida Why not use an actual C3D table?

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 6 of 10

mehdi-guida
Advocate
Advocate

Thank you for reply.

Do you know how can create Civil3d line table by .Net(c#)?

0 Likes
Message 7 of 10

Jeff_M
Consultant
Consultant

@mehdi-guida wrote:

Thank you for reply.

Do you know how can create Civil3d line table by .Net(c#)?


As of C3D 2024, the only way would be to use SendStringToExecute and pass the native C3D command. I've not tried this so don't have any sample code.

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 8 of 10

mehdi-guida
Advocate
Advocate

Thank you for reply.

Unfortunately I am beginner in .NET.

Would you please help me to use SendStringToExecute for me below code?

 

TypedValue[] filterlist3 = new TypedValue[2];
filterlist3[0] = new TypedValue(0, "AECC_GENERAL_SEGMENT_LABEL");
filterlist3[1] = new TypedValue(8, "CR" + crnum2);
SelectionFilter filter3 = new SelectionFilter(filterlist3);
PromptSelectionResult Promptentity3 = ed.SelectAll(filter3);
SelectionSet label_selection = Promptentity3.Value;
Point3d viewctr = (Point3d)Application.TryGetSystemVariable("viewctr");

 

All the labels are in a selectionSet named ' label_selection'

and 'viewctr' is my insertion point of civil3d line table.

how can I use SendStringToExecute to insert c3d line table? 

Thank You

 

 

0 Likes
Message 9 of 10

Jeff_M
Consultant
Consultant

@mehdi-guida as I said, this is not something I had tried. I just looked into it further and it appears the SendString ToExecute isn't the answer since the command to create the table brings up the dialog box and does not use a current selection to populate the labels to use.

 

I suggest checking the C3D Ideas board to see if there is an idea already submitted for creating table, add one if there isn't.

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 10 of 10

hosneyalaa
Advisor
Advisor

Hi @mehdi-guida 

I believe You can't get the text value from AECC_GENERAL_SEGMENT_LABEL

So you have to explod the items

 

Search in the forum you will Find the subject of  get the text value 

 

 

 

 

0 Likes