Author Topic: ResultBuffer's capacity?  (Read 445 times)

0 Members and 1 Guest are viewing this topic.

gswang

  • Newt
  • Posts: 101
ResultBuffer's capacity?
« on: June 10, 2017, 06:02:36 am »
Xrecord can store ResultBuffer type data, but what is its maximum capacity?
thank you very much!

Keith Brown

  • Swamp Rat
  • Posts: 585
Re: ResultBuffer's capacity?
« Reply #1 on: June 10, 2017, 07:14:48 am »
The size of an xrecord is technically unlimited I believe.  The maximum size of a result buffer is I believe 127 bytes.
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16618
  • Superior Stupidity at its best
Re: ResultBuffer's capacity?
« Reply #2 on: June 10, 2017, 08:01:50 am »
The size of an xrecord is technically unlimited I believe.  The maximum size of a result buffer is I believe 127 bytes.

I am reading large files into a resultbuffer and storing them as xRecords
Something like this works without issue

Code - C#: [Select]
  1. string Notes = "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?";
  2. ResultBuffer rb = new ResultBuffer(new TypedValue((int)DxfCode.Text, Notes));

Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Keith Brown

  • Swamp Rat
  • Posts: 585
Re: ResultBuffer's capacity?
« Reply #3 on: June 10, 2017, 08:23:42 am »
Here is a link that has some more info.


https://www.theswamp.org/index.php?topic=52504.msg574801#msg574801


In that thread there is another link that discusses compressing the info before storing in the result buffer.
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

gswang

  • Newt
  • Posts: 101
Re: ResultBuffer's capacity?
« Reply #4 on: June 10, 2017, 06:47:32 pm »
Thank you, Keith and Keith Brown!

dgorsman

  • Water Moccasin
  • Posts: 2239
Re: ResultBuffer's capacity?
« Reply #5 on: June 12, 2017, 10:13:21 am »
Put another way, logical organization should prevent it from reaching any kind of size where this becomes a problem.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

WILL HATCH

  • Bull Frog
  • Posts: 403
Re: ResultBuffer's capacity?
« Reply #6 on: June 19, 2017, 03:08:39 pm »
Keith, I'm really surprised this is working properly for you... I can't remember exactly what circumstances (audit?) will expose the underlying error in this usage are however... TypedValue has a limited size, and longer strings must be properly parsed into chunks on their way into the result buffer in order to persist through the (audit?)

Sorry I'm not more specific here, it's been 6 months since I dug into this... I remember this awesome post had led me to some clarity: https://www.theswamp.org/index.php?topic=27010.msg325377#msg325377


The size of an xrecord is technically unlimited I believe.  The maximum size of a result buffer is I believe 127 bytes.

I am reading large files into a resultbuffer and storing them as xRecords
Something like this works without issue

Code - C#: [Select]
  1. string Notes = "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?";
  2. ResultBuffer rb = new ResultBuffer(new TypedValue((int)DxfCode.Text, Notes));

Keith Brown

  • Swamp Rat
  • Posts: 585
Re: ResultBuffer's capacity?
« Reply #7 on: June 19, 2017, 04:15:43 pm »
Hi Will,  good to see you back at the swamp.


I believe that I got this mixed up.  The typedvalue has a maximum chunk size of 127 (of a Byte).  The resultbuffer can contain alot of typedvalues.   As I mentioned in another thread, I can take a memory stream that represents a xml file of over a million lines and break and add it to a resultbuffer in a series of typedvalues of size 127.


This works pretty good for me and is currently out in the public domain in a program that takes CADWorx piping objects and sends them into a Stress Analysis program and then takes the analysis results and brings them back into CADWorx.


** Edited to clarify Byte typed values have a max size of 127 

« Last Edit: June 20, 2017, 08:09:06 am by Keith Brown »
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16618
  • Superior Stupidity at its best
Re: ResultBuffer's capacity?
« Reply #8 on: June 19, 2017, 10:10:00 pm »
I have a notepad clone in my latest project that stores documents in drawings.
It has a RichText container that users can type into, format, edit fonts, etc. They can save the document to the hard drive and/or save it in the drawing.

This works without issue and without breaking down the document into smaller chunks. The theoretical limit for a text blob is 65535 (I think).

There is some code here that you can look at

https://www.theswamp.org/index.php?topic=27010.0

and

https://www.theswamp.org/index.php?topic=26687.0

Daniel has tested it to just over 2MB.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

huiz

  • Swamp Rat
  • Posts: 782
  • Certified Prof C3D
Re: ResultBuffer's capacity?
« Reply #9 on: June 20, 2017, 03:32:17 am »
The max size depends on the type (DXF code) you put in. You should read the DXF Reference. If you use DXF code for strings, it might be 255 char, but elsewhere in the documentation it claims a rise to 2049 char. DXF code 300-309 can be used for arbitrary text strings, but DXF code 1000 can only contain 255 char. Unless the documentation is not corrected at this point and then 2049 chars are available.
So it is not always neccessary to break strings in chunks.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

Keith Brown

  • Swamp Rat
  • Posts: 585
Re: ResultBuffer's capacity?
« Reply #10 on: June 20, 2017, 08:07:49 am »
I believe for bytes it is 127.  All documentation that I have read states it at that size.  I create an xml text file and then create a memory stream and then store it in a result buffer.


I should have been much more clear on my answer.
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

huiz

  • Swamp Rat
  • Posts: 782
  • Certified Prof C3D
Re: ResultBuffer's capacity?
« Reply #11 on: June 20, 2017, 08:14:18 am »
Well, if it ain't broke, don't fix it :-)
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16618
  • Superior Stupidity at its best
Re: ResultBuffer's capacity?
« Reply #12 on: June 20, 2017, 04:11:00 pm »
In my particular case, I've tested the storage capacity to about 10k using DXF group code 1.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal