Recent Posts

Pages: [1] 2 3 ... 10
AutoLISP (Vanilla / Visual) / Re: Minimum rectangle
« Last post by ribarm on Today at 10:14:00 am »
well20152016, don't get me wrong, but I hope that you realized that results with multiple polygons nesting aren't 100% reliable...
To explain what I am saying :
Lets say we took selection set of polygons sorted by areas like it is in my posted lisps... Even without transformations like mirror, one resulting outcome of calculation by this array may be more adequate than with included mirroring. What I mean 1-2-3-4-5 polygons are currently calculated so that at each sub step 1-2 minimum enclosing rectangle is searched, then that 12 is meeting 3, so 12-3 is calculated so that 123 minimum enclosing rectangle is searched, but at this point it may sometimes occur that not minimum 123 will produce final 12345 as minimal, but some other branch where 123 is maybe larger than searched 123 by calculations by posted routines... Further more this not logical simptom may occur in every step of rearranging and what's even more frustrating when mirroring is included 12 may be normal, 3 mirrored, and then 123 already complex can be altogether mirrored again... So given all this facts, I think that you see that algorithm should be much more complex and to gain desired result, calculation should be much more time consuming... But that's not all!!! This is how should it be doing with 1-2-3-4-5, but in fact there are combinations of 5 elements multiplied with combinations of 5 mirrored elements and who knows how much combinations of already processed 123 for ex. elements combined of 2 mirrored and 1 not mirrored or 1 mirrored and 2 not mirrored or all 3 mirrored or all 3 not mirrored or middle (2) element mirrored and (13) elements not mirrored and ...
What can we say for sure is that posted routines are correct for 2 polygons - first without mirroring should get you desired result just little larger than second which is taking into consideration and mirroring...
So this versions are just fine for quick packing of multiple polygons into some kind of minimal enclosing rectangle that is composed in straight away lisp simple calculation giving in return result that's quick and satisfactory in optimal time limit...

Conclusion : do not take everything that's close to satisfactory as 100% true... Nesting is complex process and even with preset inputs that are simple like polygons without arcs and desired resulting minimal enclosing rectangle you see the complexity of calculations that are to be processed... So if you plan to utilize and use those posted lisps, I advice you to use it on only 2 polygons as by my testings only then result is reliable...

Of course if you're in hurry and plan to just find what's possible in short time limits with just a few input polygons, then it's your call wheather you'll find it good enough to be claimed as desired resulting outcome...

Regards, M.R.
.NET / Re: UserControl with DataGridViews in SplitContainer layout issue
« Last post by Atook on January 21, 2017, 08:14:37 pm »
Found a workable solution: I created a panel for the controls above the DGV and a panel for the controls below it. Set the dock for the top panel to top, and the dock for the bottom panel to bottom, with the DGV.dock set to fill. The order the controls are added makes a difference in how it all works and it took me a while to figure that out. Using Views->Other Windows-> Document Outline  allowed me to change the order of the top/bottom panels and the DGV to achieve the correct result.
.NET / Re: How to get dwg preview in winform picturebox...c#
« Last post by Jeff_M on January 21, 2017, 06:58:50 pm »
I created a form, added a picturebox having the size 176,120 and a modifier of Internal. Then this code for a command:

Code - C#: [Select]
  1.        [CommandMethod("PictureTest")]
  2.        public static void testme()
  3.        {
  4.            var doc = Application.DocumentManager.MdiActiveDocument;
  5.            var img = doc.CapturePreviewImage(176, 120);
  6.            var form = new PictureBoxTest();
  7.            form.pictureBox1.Image = img;
  8.            Application.ShowModalDialog(form);
  9.        }
.NET / How to get dwg preview in winform picturebox...c#
« Last post by Area51Visitor on January 21, 2017, 05:10:05 pm »
Anyone have an example they are willing to share that will show a thimbnail or preview of a drawing in a picturebox?
AutoLISP (Vanilla / Visual) / Re: I'd like to change the default value of this lisp.
« Last post by Grrr1337 on January 21, 2017, 03:47:10 pm »
Check Lee Mac's tutorial about prompting with default option.
This is always a huge help when using getkword.
.NET / UserControl with DataGridViews in SplitContainer layout issue
« Last post by Atook on January 21, 2017, 01:26:55 pm »
I've got two DataGridViews embedded in different panels on a SplitContainer. They look good at design time and behave as I expect when I resize the control in visual studio.

But at runtime the palette doesn't look right, the DGV drops below the Total Demand labels

Both DGVs have anchors set to left,right, top, bottom. It almost looks as if the DGVs are getting anchored to the bottom of the palette instead of the bottom of their respective panels in the SplitContainer.

Any ideas for what I'm doing wrong, or solutions to the problem? I'm contemplating removing the Total Demand fields out of the SplitContainer, but I think that's where they belong.
.NET / Re: Autoloader does not load my dll
« Last post by Atook on January 21, 2017, 12:39:34 pm »
..What I do is first autoload a dll that checks for a newer version and if true copies the new one to the appropriate spot then the next autoload loads the dll...

This seems like a workable approach as well, what function  do you use to load the working/updated dll?
.NET / Re: Serializing xml files to memory.
« Last post by Keith Brown on January 21, 2017, 08:49:13 am »
I thought about it but in this case I do not believe that it would be any different.  My issues were not with the speed of serialization but with the speed of the AutoCAD .NET API saving that information into the drawing database via ResultBuffers.  Once I zipped the resulting xml file the speed increased dramatically.

** Edit ** Now that I think about it, the information serialized to json would be a smaller file size as json does not require as much extra information in its file.  I just might look into this.
AutoLISP (Vanilla / Visual) / Re: HELP WITH A LISP
« Last post by mailmaverick on January 21, 2017, 07:19:11 am »
Excellent Lee Mac !!!!
AutoLISP (Vanilla / Visual) / Re: HELP WITH A LISP
« Last post by Lee Mac on January 21, 2017, 07:04:44 am »
If you see the above two outputs, b12, S12, S22 is correct whereas S12,S22,b12 is incorrect.

My function will sort uppercase characters before lowercase characters, as designed.

If this is not desirable, simply use:
Code - Auto/Visual Lisp: [Select]
  1. (mapcar '(lambda ( n ) (nth n rawstringlist)) (LM:alphanumsort-i (mapcar 'strcase rawstringlist)))

Or better yet, write your own function.
Pages: [1] 2 3 ... 10