Author Topic: Adjust the area of a polygon  (Read 12931 times)

0 Members and 1 Guest are viewing this topic.

vladgothe

  • Mosquito
  • Posts: 9
Re: Adjust the area of a polygon
« Reply #45 on: March 14, 2014, 02:53:32 AM »
In AutoCAD Map 3d 2014, the "UNDO" problem doesn't appear anymore. It seems that in ACAD 2007, some commands cannot be repeated for too many times. Undo and align are two of them. But compared to undo command, align can be used as a function. Some time ago, I had a lisp where I used (command "align" etc...) multiple times and AutoCAD 2007 gave the same error. I resolved the problem using (align etc....) instead of using (command "align" ....). But it's not the case for undo command. It's a software problem, not hardware, because I work on a last generation PC.
Marko, i tested your code. When the desired area is bigger than polyline area, the program works perfectly. The problem appears when the desired area is smaller than polyline area. I set the sysvar CMDECHO to 1 before running the program and I found out that, in this case, after some time, the stretch command finds 0 objects and repeats itself in an endless loop.
Can you confirm this? Maybe I am wrong.

vladgothe

  • Mosquito
  • Posts: 9
Re: Adjust the area of a polygon
« Reply #46 on: March 14, 2014, 05:03:55 AM »
I figured it out. On big polylines with many vertices or if the difference between areas is very big, the direction vector must be bigger. If you make a short distance vector, it will take forever to accomplish the task and this is why AutoCAD seems to hang. Topographer, set sysvar COORDS to 1 and when you think that AutoCAD hangs look at coordinates and you will see that they are changing. I made a few modifications on routine, but anyway, excellent work Marko! Thank you!
« Last Edit: March 14, 2014, 07:32:15 AM by vladgothe »

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Adjust the area of a polygon
« Reply #47 on: March 14, 2014, 10:03:11 AM »
@ribarm
Excellent job!

That code is fantastic!  :-D

Quote
- you have to be patient to be sure routine finish... No crashes on my computers and no endless loops - it finishes correctly...
My computer crashes when I use the code for the area above 4.000mē. But to small area work perfect.


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Adjust the area of a polygon
« Reply #48 on: March 14, 2014, 10:07:00 AM »
< .. >  when I use the code for the area above 4.000mē. But to small area work perfect.

Is that four or four thousand ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Adjust the area of a polygon
« Reply #49 on: March 14, 2014, 11:31:00 AM »
Area = 4.000
 :-D

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Adjust the area of a polygon
« Reply #50 on: March 14, 2014, 11:39:05 AM »
very amusing.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Adjust the area of a polygon
« Reply #51 on: March 14, 2014, 12:44:52 PM »
Did you try that, Kerry?

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Adjust the area of a polygon
« Reply #52 on: March 14, 2014, 04:53:11 PM »
FABRICIO28, sorry for inconvenience, try this new version... It works and for small area values and for large, just remember to input small starting vector...

M.R.
« Last Edit: March 14, 2014, 05:57:53 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

pedroantonio

  • Guest
Re: Adjust the area of a polygon
« Reply #53 on: March 14, 2014, 06:28:53 PM »
riban i know that you are trying hard , but this lisp still crashes .Sorry  :embarrassed:
Is not possible to make a lisp

1) giving perimetre and area
2) select only one or two sides to stretch ??

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Adjust the area of a polygon
« Reply #54 on: March 15, 2014, 01:20:42 AM »
I've tested ms-new.lsp under A2014 x64 with Windows 7... And this lisp passed all cases - small area and large... Maybe when you update your software - hardware you'll find it very useful as now precision is even greater than it was... If you have problems and want to use it with your current computer software - hardware, try removing last pieces of code making lisp smaller and less precise... To make it more easy to see what you should do, I'll post smaller version, but I am not sure weather it'll not crash again with your current computer state...

M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

pedroantonio

  • Guest
Re: Adjust the area of a polygon
« Reply #55 on: March 15, 2014, 03:38:06 AM »
Thank you riban i know that you are trying hard , but this lisp still crashes .Sorry  :embarrassed:

I have Autocad 2012 64bit  ,win7 ultimate SP1 with all last updates 64 bit

AMD Athlon (tm) II x4  640 Prossesor 3.00 GHz
RAM 8GB
VGA   PCI  Sapphire 5570 1 GB DDR3 HDMI

I am not laying ...

First I pick two vertex of the side i want to strech.
Second I pick to vertex on the smaller side for  the Direction
Then start working ....working....working and then crash

I try another way

First I pick two vertex of the side i want to strech.
Second I pick to points inside the polygon with very small lendth for the Direction
And then start working ....working....working and then crash again

I dont know what to do ....

The scf.lsp was working fine but it was only a scale . I am searching for a lisp to adjust the area but keeping the perimetric distances.

Imagine that you want to design a specific polygon with specific dimensions and specific  area

Thanks


pedroantonio

  • Guest
Re: Adjust the area of a polygon
« Reply #56 on: March 15, 2014, 05:14:09 AM »
I Think that all the problem is in this two commands

Pick first-start point of stretch vector direction
Pick second-end point of stretch vector direction

I don't how possisble is to change this ,but if you can change it something like this

for direction

1) Pick a point (in the polygon) for smaller areas
2) Pick a point (out the polygon) for bigger areas

Thanks

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Adjust the area of a polygon
« Reply #57 on: March 15, 2014, 07:57:10 AM »
I think that problem doesn't lie in vector - it always have to be small and it's not important if it's inside or outside of polygon - it can even be on the polygon (I used this to stretch square to rectangle and picked vector on one side of square - just used nearest snap with 2 near points)... The problem is in functionality of your ACADs - on my netbook Windows XP 32bit A2008 and A2009, I had problem with endless looping when used ms-new.lsp with 40K, but when used ms-new.lsp I last posted it's all OK, just little more waiting to finish routine and result isn't so precise... But on my working PC Windows 7 64bit A2012 A2014 8GB RAM the best routine - ms-new.lsp 40K worked fine and really quick and result is almost exact error is on >10 decimal depends on picked vector and type of polygon routine is applied to... I don't know what to say, I am also not laying - you have to believe me, new gif is unneccessary, it'll already show already posted result only when (vl-load-com); (rtos (vla-get-area (vlax-ename->vla-object (car (entsel)))) 2 50) applied on resulting polygon it'll show how precise operation of stretching through routine actually was...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Adjust the area of a polygon
« Reply #58 on: March 15, 2014, 08:57:28 AM »
As a matter a fact, here is the proof... Test was made under A2012 on system shown on SYSTEM.jpg...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

pedroantonio

  • Guest
Re: Adjust the area of a polygon
« Reply #59 on: March 15, 2014, 11:56:10 AM »
Working only for small polygons. I try to use 90 sqm  and works fine then i try to use 9000 sqm  or  60000 sqm and crash.