Author Topic: Slowing Down During Drawings  (Read 4676 times)

0 Members and 1 Guest are viewing this topic.

masoud_123

  • Guest
Slowing Down During Drawings
« on: May 25, 2013, 12:33:50 PM »
Hi,

I have a problem with slowing down autocad.

I wrote a huge vlisp code that draws a huge set of drawing, but the problem is that the speed of drawing become slower and  slower while drawing session continues,because the capacity of drawings become larger during the drawing.

Is there any way to improve speed?I was wonder something like moving the drawings during drawing session to another sheet or something like that?

thanks.

Gasty

  • Newt
  • Posts: 90
Re: Slowing Down During Drawings
« Reply #1 on: May 25, 2013, 02:25:10 PM »
Hi,

There is no way to know what the problem is without a description of the task you are trying to automate by code, how many drawings are you dealing with, what and how many (aprox) entities are involved, platform, etc, etc. Access to the code and a test working set could help us trying to help you.

Gaston Nunez

masoud_123

  • Guest
Re: Slowing Down During Drawings
« Reply #2 on: May 25, 2013, 02:56:43 PM »
Hi,

There is no way to know what the problem is without a description of the task you are trying to automate by code, how many drawings are you dealing with, what and how many (aprox) entities are involved, platform, etc, etc. Access to the code and a test working set could help us trying to help you.

Gaston Nunez

the task is consist of reading some text files, process them ,some mathematical operation on input data, listing them in different lists and then drawing list data(s)  by one click in the sheet. in every drawing session by one click more than 20,000 objects are drawing continuously from up to down of sheet. then user can change drawings positions and array them in different ways.

but after drawing 1000-1500 objects, autocad slows down and freezes till end of drawing session (end of drawing all lists) and  then suddenly appear all of 20,000 objects.

Gasty

  • Newt
  • Posts: 90
Re: Slowing Down During Drawings
« Reply #3 on: May 25, 2013, 04:28:39 PM »
Hi,

Can you expose the piece of code that create the entities on the drawing?

Gaston Nunez

masoud_123

  • Guest
Re: Slowing Down During Drawings
« Reply #4 on: May 26, 2013, 03:31:39 AM »
Hi,

Can you expose the piece of code that create the entities on the drawing?

Gaston Nunez

Here is a part of code that, is in a loop, the loop starts from (nth 0) to (last) member in the list.

And the entities are differents types, likes: Line,Circles,Text,Leaders and....

Code: [Select]
(entmake
                 
                  (list
                         (cons 0  "LWPOLYLINE")
                         (cons 100  "AcDbEntity")
                         (cons 100  "AcDbPolyline")
                         (cons 8 "0")
                         (cons 43  (eval b));Width
                         (cons 38 (caddr pt1Down))
                         (cons 39 (eval d))
                         (cons 42 0)
                         (cons 62 5);;;;;;;;;!!!!!!!!!!!!!!!!!!!!
                         (list 210 0 0 1.0)
                         (cons 90  2);number of vertices
                         (list 10 (car pt1Down) (cadr pt1Down) (caddr pt1Down))
                         (list 10 (car pt2Down) (cadr pt2Down) (caddr pt2Down))
                         (cons 70  0)
                   );List
                 
        );Entmake

Gasty

  • Newt
  • Posts: 90
Re: Slowing Down During Drawings
« Reply #5 on: May 26, 2013, 12:03:09 PM »
Hi,

I see no problem with that code, may be the issue reported it's the normal AutoCAD beheavior in this situation, if you really need to see all the process in the screen editor, you can try adding a zoom (based on the extents of the new entity)  before each entmake, but doing so will add some processing cost to the solution.

Gaston Nunez

masoud_123

  • Guest
Re: Slowing Down During Drawings
« Reply #6 on: May 26, 2013, 02:47:11 PM »
Thank you, but another way for increasing speed of drawing entities? or increase speed of whole operation?

Gasty

  • Newt
  • Posts: 90
Re: Slowing Down During Drawings
« Reply #7 on: May 26, 2013, 03:34:07 PM »
Hi,

I think that using with vlisp activx you can obtain a significative speed difference, check this link:http://www.afralisp.net/visual-lisp/tutorials/polylines-part-2.php, let me know if I can help you coding.

Gaston Nunez

masoud_123

  • Guest
Re: Slowing Down During Drawings
« Reply #8 on: May 27, 2013, 05:54:42 AM »
Hi,

I think that using with vlisp activx you can obtain a significative speed difference, check this link:http://www.afralisp.net/visual-lisp/tutorials/polylines-part-2.php, let me know if I can help you coding.

Gaston Nunez

Thank you,but because of (about 50000 lines) its not practical to change entmake to vla and activex.
Is it possible to keep drawings in another sheet (or somewhere else!) without showing them,and after finishing drawing operations, show all of them ? or something like this!

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Slowing Down During Drawings
« Reply #9 on: May 27, 2013, 06:17:42 AM »
Since AutoLISP runs in the user-interface processor thread rather than a background thread, Windows will automatically render the AutoCAD application as being non-responsive if the AutoLISP process takes longer than 5 seconds to complete (since Windows is not receiving any feedback from the UI processor thread in those 5 seconds). This also means that the AutoLISP process takes precedence over all other actions until this process has completed.

Unfortunately, this is inherent behaviour resulting from how AutoLISP is implemented in AutoCAD; if the performance of optimised AutoLISP code is unsufficient for your requirements, I would strongly suggest that you look into using a more powerful API, such as a .NET language (C#/F#/VB).


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Slowing Down During Drawings
« Reply #11 on: May 27, 2013, 08:02:38 AM »
Here is a part of code that, is in a loop, the loop starts from (nth 0) to (last) member in the list.

And the entities are differents types, likes: Line,Circles,Text,Leaders and....

nth is a slow pointer and the type of loop is important too.
Have you compiled the lisp?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Slowing Down During Drawings
« Reply #12 on: May 27, 2013, 08:11:08 AM »
It might help if we can see more of the code. The portion you show is simply entmaking an entity. And no, in such case ActiveX isn't going to improve speed by much (if at all), vla usually only speeds up (compared to DXF) if you're going to extract info from the entities.

CAB is correct though, your speed issue might be due to something else. But as we don't know the rest of your code - all we can do is guess. E.g. you say you read and process a file - do you then store that processed data in a list from which you generate the entity data? If so, stay away from nth as much as possible - rather step through the list using foreach / mapcar or even just cdr (and its ilk), they work exponentially faster than nth on very long lists.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

masoud_123

  • Guest
Re: Slowing Down During Drawings
« Reply #13 on: May 27, 2013, 04:02:42 PM »
Thank you all and thank you Lee Mac, you learned me something interesting about AutoLisp.

May be I should revise the code by omitting nth function...


pBe

  • Bull Frog
  • Posts: 402
Re: Slowing Down During Drawings
« Reply #14 on: May 28, 2013, 08:13:44 AM »
I'm with Irné  and CAB on this. [process issue]

I would strongly suggest that you look into using a more powerful API, such as a .NET language (C#/F#/VB).
1+

*off-topic*
Need to push myself to learn .NET . I feel so left out  :lmao: