Code Red => AutoLISP (Vanilla / Visual) => Topic started by: S.Langhammer on May 14, 2013, 03:28:21 AM
Title: Speeding up a function
Post by: S.Langhammer on May 14, 2013, 03:28:21 AM
Hello again!
I'm working on an interface to read out filtered entity information from .dwg files via BricsCAD (using AutoLISP) and a Delphi component. When I was assigned to this project I had no idea about LISP but with lots of code examples, tutorials and the great help from you guys here, I improved a lot and now the LISP script does exactly what it'S supposed to do. Now I'm looking around to see if I can Speed my script up and simpliefy it. I'm doing my best, researching and refactoring, but I'm still rather un experienced so I'm asking here, if anyone of you sees possibilities to help me speed my script up. Every saved operation helps. The following functions cought my attention first, since they are together one of the largest chunks of code in the entire script.
Some info first: - The variable "step" Comes from the function, which calls getPolData and containes the -1 dxf information of the current entity. I reuse it within getPolData, so I don't have to make another variable. -I set variables Nil, because I've red somewhere, that that speeds LISP up somehow. I can't recall where I red that tho.
(progn;;; the first point is saved in a temporary string
(vertexValues)
(setq 1PtStr (strcat ptStr spcr verInd1 spcr verInd2 spcr verInd3 spcr verInd4 "\n"));;; temporary saved first point
);end progn
);;; end if - closed Polylinie
(while(and(/=(cdr(assoc0 enLst))"SEQEND")(/=16(cdr(assoc70 enLst))));;; while the current following entity is a vertex, but not a spline frame control point