Search the Community
Showing results for tags 'working'.
Found 2 results
Working Point Lisp, skips a line and I can't figure out why
jesset posted a topic in AutoLISP, Visual LISP & DCLHello, I have more or less completed this little lisp and I can't figure out why it is skipping the first line after my 'if' statement. Basically, when you're in paperspace, it'll put your cursor into modelspace and you pick the point you want to annotate with a working point. For some reason my lisp won't go into modelspace. ;; This lisp creates a working point leader in paperspace ;; known bugs: the current selected multileader type will be the style of the working point ;; Rev 1 2017-03-02 ;; Created by J. Therrien (defun c:WorkingPoint (/ WorkingPoint Easting Northing Point PSPACEPOINT PSPACE TEXT TEXTPROPS COORD NorthingWP EastingWp) (if (and (= (getvar "TILEMODE") 0) (= (getvar "CVPORT") 1)) (;;then (command "_.mspace" );;end command (setq WorkingPoint (getpoint "\nWhere is Working Point?: ")) (setq Northing (rtos (cadr WorkingPoint) 2 1));;set "y" value of WorkingPoint to Northing (setq Easting (rtos (car WorkingPoint) 2 1));;set "x" value of WorkingPoint to Easting (setq NorthingWP (strcat "N: " Northing));; creates the proper formatting for the leader (setq EastingWP (strcat "E: " Easting));; creates the proper formatting for the leader (command "_.point" WorkingPoint);;end command (setq point (entlast));;set the workingpoint to point (command "_.chspace" point "" "");;this brings the workingpoint set in the modelspace to paperspace (setq pspacepoint (entget point));;get the properties for point (setq pspace (cdr (assoc 10 pspacepoint)));;find the x&y coords and set to pspace (setq anotbp (getpoint "\nSpecify leader basepoint: ")) (COMMAND "mTEXT" PSPACE "@30,-30" "WORKING POINT" NORTHINGWP EASTINGWP "" );;end command (setq text (entlast));;set mtext to variable text (setq textprops (entget text));;get the properties from text (setq coord (cdr (assoc 1 textprops)));;find the string properties and set to coord (command "_.mleader" pspace anotbp coord "_.erase" point text "" );;END COMMAND );;end then (alert "Make sure you are in paperspace to use this command");;else );;end if );;end defun
Error: bad argument value: string position out of range 17
TimG posted a topic in AutoLISP, Visual LISP & DCLI have been having problems loading a lisp that has previously worked, without a problem for years, but now throws a message "Error: bad argument value: string position out of range 17". The lisp is loaded on opening of each drawing in the acaddoc.lsp, which has not changed. It is supposed to open a csv and update blocks. From what I can tell, it seems as though AutoCAD cant find the csv file in the Working Directory. (When opening a drawing with the lisp loaded in acaddoc.lsp specifying the name via findfile "name.csv") When I load the lisp through APPLOAD and manually select the file, via getfiled, it works. (findfile Nil) The Name of the csv has not changed in the acaddoc.lsp and the file is definitely in the same folder as the opened drawing. So my questions are, Is there any Variable in AutoCAD (Map 3d 2016) that could have changed to cause this? Is it a bug? Are there methods of finding the specified file in the same directory, (as the opened drawing), other than findfile? vla-get-FoundPath perhaps? How can I debug using VLISP? I tried (VL-BT) and get this; Backtrace: [0.19] (VL-BT) [1.15] (#) [2.12] (# "(vl-bt)" T #) :CALLBACK-ENTRY.6 (:CALLBACK-ENTRY) :ARQ-SUBR-CALLBACK.3 (nil 0) nil I'm not sure what it means? It's the first time I've used VLISP and only have a basic knowledge of VBA through a TAFE course, which was really more about VBS. At this stage I'm not sure if its a setting or AutoCAD is not looking in the right place? I have tried resetting autocad to default which didn't work, then I reinstalled autocad, which also didn't work. Then I updated to windows 10 just to see if some setting was changed or broken. None of those steps worked. I had been playing around with excel,( and had improved the spreadsheet which output the csv to also put out a xlsx, for a Data Link), in the previous weeks, which gave me the possibility that I had unwittingly changed a setting somewhere. The excel spreadsheet had worked with the lisp for at least 2 weeks before the error started to occur. One other thing to mention is that when excel is trying to save the csv and autocad is reading it,( has it open maybe? through the manual loading of it through the lisp), it comes up with an error 1004 or something. This happened to a co-worker who tried to debug it, and we tried alternate ways of saving the csv. After that moment the problems started. We tried the original untouched excel spreadsheet, acaddoc.lsp and method like we always had done, but now the error always occurs. Please, are there any suggestions?