I understand the basics here, but i am having an issue with trying to speed up my program to do what i want. My program works, but with a repeat command set at some random integer it takes a long time to run. And i find myself constantly changing that random integer to speed up my lisp. So i think i want a while command but i need a little help with it. This is the structureof my lisp:
(I am using autocad electrical 2011:)
(defun c: ()
(communicate with excel and get how many values are not blank in a specified column for a repeat count)
----in this specific case it returns a count of 60 which is correct Lets call this repeat1
;;;once this happens, i also:
(using repeat1 i communicate with excel to get a count for another specific column that has an "X" in it)
----in this specific case it returns 31, which is correct. lets call this repeat2
;; main part of the program once i have repeat2
(I grab a bunch of blocks and cycle through each block to grab specific attributes)
(using repeat2 i cycle through the excel spread sheet i have until the block attribute and the excel "cell" value match what i am looking for.
(this is where i do a bunch of stuff to get what i want )
//the problem here is it continues to repeat even after what i want matches
//or in some cases, i may be looking for the value in the 60th cell, but my counter still has to increment until it gets to the 60th value, which could
//take 5-10 mins.
); end repeat2
);end defun
I believe i have attached/modified everything needed to run my lisp. When opened you will see there is a lot of information being passed back and forth. As i said when everything is said and done, it does everything i want it too do, but i am constantly tweeking my code to speed it up, it would be nice to have the lisp do it automatically. any help will be much appreciated. and i will respond back asap with any questions...
Thanks!
Solved! Go to Solution.
Solved by p_mcknight. Go to Solution.
Personally I would loop through the excel list as you do in the beginning but instead of making integers, grab the info and put it in a list of lists in a variable. If you have the attribute as the first item in your nested list, then you can simply run an assoc with the attribute on the list of lists that you created, get the info and be done. This way, there will be no looping at all except at the very beginning when you create the list of the excel data. Does this make sense?
So I don;t have to look through all of your code, tell me what you are doing once you match the attribute and the cell. Or are you matching block names and excel values and then attributes. A little more info here on whether you are writing values out to excel, or into autocad attributes, or using the match to determine what layer to change things to, etc. will help me give you a better direction to try.