Author Topic: XData  (Read 1267 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 860
XData
« on: November 12, 2012, 09:49:16 AM »
I edit a Dimension style. Some settings for it an AutoCAD stored in XData. For example, I need to change some properties (look on the screen below):

I can do it via next code:
Code - C#: [Select]
  1. AcDb.ResultBuffer rb = new AcDb.ResultBuffer(
  2.         new AcDb.TypedValue(1001, xName),
  3.         new AcDb.TypedValue(1070, 391),
  4.         new AcDb.TypedValue(1040, 19.7 /* our value for "Dimension Break" property */),
  5.         new AcDb.TypedValue(1001, "ACAD_DSTYLE_DIMJAG"),
  6.         new AcDb.TypedValue(1070, 388),
  7.         new AcDb.TypedValue(1040, 5.56 /* our value for "Linear Jog Size" property */),
  8.         /* I don't know, what is need for next values, But AutoCAD created their, when I
  9.          * modify the "Linear Jog Size" property manually... */
  10.         new AcDb.TypedValue(1001, "ACAD_DSTYLE_DIMTALN"),
  11.         new AcDb.TypedValue(1070, 392),
  12.         new AcDb.TypedValue(1070, 0)
  13.         );
  14. dimStyle.XData = rb;
  15.  
It is works fine: properties was changed.

But... Now I need some other code:
Code - C#: [Select]
  1. String xName = "ACAD_DSTYLE_DIMBREAK";
  2. AcDb.ResultBuffer rb = new AcDb.ResultBuffer(
  3.         new AcDb.TypedValue(1001, xName),
  4.         new AcDb.TypedValue(1070, 391),
  5.         new AcDb.TypedValue(1040, 19.7 /* our value for "Dimension Break" property */));
  6. dimStyle.XData = rb;
  7.  
  8. // my some code...
  9.  
  10. xName = "ACAD_DSTYLE_DIMJAG";
  11. dimStyle.XData.Add(new AcDb.TypedValue(1001, xName));
  12. dimStyle.XData.Add(new AcDb.TypedValue(1070, 388));
  13. dimStyle.XData.Add(new AcDb.TypedValue(1040, 5.56 /* our value for "Linear Jog Size" property */));
  14.  
  15. // my some code...
  16.  
  17. xName = "ACAD_DSTYLE_DIMTALN";
  18. dimStyle.XData.Add(new AcDb.TypedValue(1001, xName));
  19. dimStyle.XData.Add(new AcDb.TypedValue(1070, 392));
  20. dimStyle.XData.Add(new AcDb.TypedValue(1070, 0));
  21.  

Both code are equals in sense, but second does works not correct: I got not full data in XData: only the three first records was added (rows number 3, 4 and 5). And I not get any errors... Why it's happens?
« Last Edit: November 12, 2012, 09:54:44 AM by Andrey »

Andrey Bushman

  • Swamp Rat
  • Posts: 860
Re: XData
« Reply #1 on: November 13, 2012, 12:21:06 AM »
Is nobody knows an answer for this question? :(

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: XData
« Reply #2 on: November 13, 2012, 03:18:25 AM »
Is nobody knows an answer for this question? :(
Instead of:
Code - C#: [Select]
  1. xName = "ACAD_DSTYLE_DIMJAG";
  2. dimStyle.XData.Add(new AcDb.TypedValue(1001, xName));
  3. dimStyle.XData.Add(new AcDb.TypedValue(1070, 388));
  4. dimStyle.XData.Add(new AcDb.TypedValue(1040, 5.56 /* our value for "Linear Jog Size" property */));
use :
Code - C#: [Select]
  1. rb = new AcDb.ResultBuffer(
  2.   new AcDb.TypedValue(1001, xName),
  3.   new AcDb.TypedValue(1070, 388),
  4.   new AcDb.TypedValue(1040, 5.56)
  5. );
  6. dimStyle.XData = rb;
« Last Edit: November 13, 2012, 03:27:22 AM by Alexander Rivilis »

Andrey Bushman

  • Swamp Rat
  • Posts: 860
Re: XData
« Reply #3 on: November 13, 2012, 06:01:36 AM »
Yes, now works. Thank you.