Author Topic: Table Style some options  (Read 2483 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Table Style some options
« on: September 26, 2012, 02:09:45 PM »
Hi all. I apologize for my bad English.

I have  some questions about Table Style. Please, run the "_tablestyle" command. Will be opened "Table style" window. Press the "Modify..." button. Will be open "Modify table style" window. My questions is about this window some settings.

1. How can I get/set some values for Cell Style, such as:
   1.1. General tab of "Modify table style" window:      
      1.1.1. Which formated string must I use for the set 'format' option for Cell Style? [IS SOLVED]
         Click "..." button. Will be opened "Table Cell Format window".
         Please, show me the examples of formated string for:
         1. Data type: Angle, Format: Decimal degrees, Precission: 0.000
         2. Data type: Decimal Number, Format: Decimal, Precission: 0.00
         3. Data type: Percentage, Precission: 0.000, Append symbol: checked
         4. Data type: Point, Format: Decimal, Precission: 0.00, List separator: ','(Comma), X: checked, Y: checked, Z: unchecked
         5. Data type: Text, Format: Uppercase
         6. Data type: Text, Format: First capital

         
Code - C#: [Select]
  1. //customTableStyle is IAcadTableStyle
  2. customTableStyle.SetFormat2("MyCellStyleName", "necessary formated string...");//???
   
      1.1.2. How can I set 'horizontal/vertical margins' options for each Cell Style individual? [IS SOLVED]         
Code - C#: [Select]
  1. //Next changes will be applied not for "MyCellStyleName" but for other. How can I do it for "MyCellStyleName"?
  2. //customTableStyle is IAcadTableStyle
  3. customTableStyle.HorzCellMargin = 1;
  4. customTableStyle.VertCellMargin = 1;
   1.2. Borders tab of "Modify table style" window:       
      1.2.1. How can I set 'Linetype' option for Cell Style? [IS SOLVED]      
      1.2.2. How can I set 'Double line' option for Cell Style? [IS SOLVED]
      1.2.3. How can I set 'Spacing' option for Cell Style?    [IS SOLVED]
2. How can I create Table Style like it does the button "select table to start from"? [NOT SOLVED]
3. What is the flag BitFlags? ObjectARX 2013 SDK documentation does not contain any info about "IAcadTableStyle": [NOT SOLVED]
Code - C#: [Select]
  1. //customTableStyle is IAcadTableStyle
  2. customTableStyle.BitFlags = 1;

Best Regards
« Last Edit: September 30, 2012, 07:58:18 AM by Andrey »

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Table Style some options
« Reply #1 on: September 27, 2012, 12:05:12 PM »
Anybody read my topic? :)
« Last Edit: September 27, 2012, 03:12:13 PM by Andrey »

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Table Style some options
« Reply #2 on: September 27, 2012, 01:44:51 PM »
Maybe it will be interesting not only for me...

I wrote test code for solwing question number 1.1.1:
Code - C#: [Select]
  1. using System;
  2. //Autodesk namespaces ***************
  3. using acad = Autodesk.AutoCAD.ApplicationServices.Application;
  4. using AcApp = Autodesk.AutoCAD.ApplicationServices;
  5. using AcDb = Autodesk.AutoCAD.DatabaseServices;
  6. using AcEd = Autodesk.AutoCAD.EditorInput;
  7. using AcRtm = Autodesk.AutoCAD.Runtime;
  8. using AcPlt = Autodesk.AutoCAD.PlottingServices;
  9. using AcInt = Autodesk.AutoCAD.Internal;
  10. //************************************
  11.  
  12. [assembly:AcRtm.CommandClass(typeof(TableStyleLaboratory.Class1))]
  13.  
  14. namespace TableStyleLaboratory
  15. {
  16.     public class Class1
  17.     {
  18.         [AcRtm.CommandMethod("test")]
  19.         public void Test()
  20.         {          
  21.             AcApp.Document doc = acad.DocumentManager.MdiActiveDocument;
  22.             AcDb.Database db = doc.Database;
  23.             AcEd.Editor ed = doc.Editor;
  24.            
  25.             //Beforehand I changed "Data" cell style of "Standard" Table Style manually
  26.             //and assigned them the formats, which are interesting for me.
  27.             String tableStyleName = "Standard";            
  28.  
  29.             using (AcDb.Transaction tr = db.TransactionManager.StartTransaction())
  30.             {
  31.                 AcDb.DBDictionary tableStylesDictionary = tr.GetObject(db.TableStyleDictionaryId,
  32.                     AcDb.OpenMode.ForRead) as AcDb.DBDictionary;
  33.                 if (!tableStylesDictionary.Contains(tableStyleName))
  34.                 {
  35.                     ed.WriteMessage("Table Style '{0}' not exists in this drawing", tableStyleName);
  36.                     return;
  37.                 }
  38.                 AcDb.ObjectId tableStyleId = (AcDb.ObjectId) tableStylesDictionary[tableStyleName];
  39.  
  40.                 if (tableStyleId.IsNull || !tableStyleId.IsValid)
  41.                 {
  42.                     String result = tableStyleId.IsNull ? "tableStyleId is null." : "tableStyleId is invalid.";
  43.                     ed.WriteMessage(result);
  44.                     return;
  45.                 }
  46.  
  47.                 AcDb.TableStyle tableStyle = tr.GetObject(tableStyleId, AcDb.OpenMode.ForRead) as AcDb.TableStyle;
  48.                 String format = tableStyle.Format(AcDb.RowType.DataRow);
  49.                 ed.WriteMessage(format);
  50.                 tr.Commit();
  51.             }
  52.         }
  53.     }
  54. }
  55.  

I get such results:
Quote
1. Data type: Angle, Format: Decimal degrees, Precission: 0.000:   %au0%pr3
2. Data type: Decimal Number, Format: Decimal, Precission: 0.00:   %lu2%pr2
3. Data type: Percentage, Precission: 0.000, Append symbol: checked:   %lu2%pr3%ps[,%]
4. Data type: Point, Format: Decimal, Precission: 0.00, List separator: ','(Comma), X: checked, Y: checked, Z: unchecked:   %lu2%pt3%pr2
5. Data type: Text, Format: Uppercase:   ঱
6. Data type: Text, Format: First capital:   ঱

I can't understand this the formats, but I can use it now.

Now about my question number 1.1.2.:
Code - C#: [Select]
  1. //it is working fine (I see it in the "Modify Table Style" window, at "Ganeral" tab).
  2. tableStyle.SetMargin(AcDb.CellMargins.Left, 3, "_Data");                
  3. tableStyle.SetMargin(AcDb.CellMargins.Top, 4, "_Data");
  4.  
  5. //I do not see how it is working. Can be superfluous settings are this?
  6. tableStyle.SetMargin(AcDb.CellMargins.Right, 15, "_Data");              
  7. tableStyle.SetMargin(AcDb.CellMargins.Bottom, 20, "_Data");
  8.  

Now about my question number 1.2.:
Code - C#: [Select]
  1. String lineTypeName = "ACAD_ISO03W100";
  2. AcDb.LinetypeTable linetypeTable = tr.GetObject(db.LinetypeTableId, AcDb.OpenMode.ForRead) as AcDb.LinetypeTable;
  3. if (!linetypeTable.Has(lineTypeName))
  4. {
  5.     ed.WriteMessage("Line type '{0}' not found.", lineTypeName);
  6.     return;
  7. }
  8.  
  9. //it is working fine (I see it in the "Modify Table Style" window, at "Borders" tab).
  10. AcDb.ObjectId linetypeId = linetypeTable[lineTypeName];
  11. tableStyle.SetGridLinetype(linetypeId, AcDb.GridLineType.AllGridLines, "_Data");
  12.  
  13. //The next code rows set the "Double Line" option as checked.
  14. //I see it in the "Modify Table Style" window, at "Borders" tab.
  15. tableStyle.SetGridLineStyle(AcDb.GridLineStyle.Double, AcDb.GridLineType.AllGridLines, "_Data");
  16.  

I couldn't find the response to the question number 2.
The question number 3 too isn't solved.
« Last Edit: September 30, 2012, 07:59:55 AM by Andrey »