All Activity
- Past hour
-
pedro 47 joined the community
- Today
-
mhupp started following Excel link - Sanity check please
-
attout and attin?
-
Ok a few comments, Lets start, as mentioned when they added lisp to LT they decided to leave the smart stuff out, typical Autodesk, so you can not talk direct to Excel, Full Acad, or Bricscad, plus I believe a few others no problem. Just a side comment can also use Libre Calc. From Cad, yes can get range used," so get a list of all "A" column values no user input. Then find the one your looking for this will give you a row value. So put the attributes values into a cell. I have "Alan Excel.lsp" which is a lot of defuns that do different tasks I have saved the latest version in the download section. I have acknowledged those that have helped in putting it together the extra defuns, I keep adding to it depending on task. One thing you can do is check (setq xlApp (vlax-get-or-create-object "Excel.Application")) if it errors or returns NIL that would occur in LT. Please let me know. If its a simple nil then do the export to csv and use say (alert "Run the macro to import the csv file"), as a side note pretty sure in full version could call the macro, so one common code only. There is one little glitch when you need to go to Excel to do something user wise you must click on Excel window, but I did find a way around it using Powershell that is called from the CAD so it auto jumps to Excel. Should be able to do same in excel jump back to cad. Just google about your Excel macro questions there is huge amount of info out there use VBA answers and convert to Lisp sometimes.
- Yesterday
-
Precisely selecting with a window
Discus84 replied to Discus84's topic in AutoCAD 2D Drafting, Object Properties & Interface
HI, I'm running version 12, Regards, Lu -
Copy and paste error (blocks changes!)
GLAVCVS replied to X11start's topic in AutoLISP, Visual LISP & DCL
Hello The problem may be in ObjectDBX. Try replacing "objectdbx.axdbdocument" with "GStarX.axdbdocument" -
Vova_l joined the community
-
The request for verification can be turned off with the BATTMAN command.
-
Copy and paste error (blocks changes!)
X11start replied to X11start's topic in AutoLISP, Visual LISP & DCL
I checked: it works on Autocad... on GstarCAD it doesn't work. It doesn't matter, I use your previous file that reported the error but didn't allow renaming (CAPFD) thank you so much RLX for your effort! -
Thanks a lot, @mhupp I'll try your code.
-
bobm1475 joined the community
-
For completeness, the key here is the "Repeat" option of the -INSERT command - though, I'm unsure in which version this relatively new keyword was introduced.
-
Thank you very much eldon for your reply
-
As Lee says, it doesn't know, it is a bit of a blunt LISP that does the job and no more. Lees is much better but I had a mental block yesterday, couldn't remember cmdactive.
-
If you need more information, check the documentation on the CMDACTIVE system variable.
-
It won't - it will continue indefinitely until the user presses Esc to force it to exit.
-
Looped -Insert Command
CivilTechSource replied to CivilTechSource's topic in AutoLISP, Visual LISP & DCL
I am still new with Lisp, but it feels that this is more elegant by checking if a command is active? -
Looped -Insert Command
CivilTechSource replied to CivilTechSource's topic in AutoLISP, Visual LISP & DCL
So the first line keeps doing the loop while it is not nil? How will it know it is not nil? -
Excel link - Sanity check please
swanny89 replied to swanny89's topic in AutoLISP, Visual LISP & DCL
I think I've achieved a workaround. I'm going to set a macro within excel that exports the data to a CSV every time the excel document is saved (overwriting the existing versions). I'm then going to read this using the standard IO functions available to me in LT. It's not the cleanest solution, but I believe it should work. If anyone has any advice regarding pitfalls etc. that I might encounter please feel free to enlighten me -
Excel link - Sanity check please
swanny89 replied to swanny89's topic in AutoLISP, Visual LISP & DCL
That's unfortunate @Steven P haha if only it were this simple...Honestly I've never experienced resistance like this before! Could a LISP in LT export the Excel data to a CSV, pull the data from that, and the delete the CSV? I'm going to assume that the answer is no due to the lack of vlax-get-or-create-object. -
Excel link - Sanity check please
Danielm103 replied to swanny89's topic in AutoLISP, Visual LISP & DCL
Yeah, LT is a problem, you won’t have vlax-get-or-create-object, you could probably parse .CSV files though -
Excel link - Sanity check please
Steven P replied to swanny89's topic in AutoLISP, Visual LISP & DCL
Might be tricker in LT - not every function works Resistant to change... just show them it is quicker, subtle ways like doing everything and grabbing a coffee while they are still piling through it the 'old' way -
Excel link - Sanity check please
swanny89 replied to swanny89's topic in AutoLISP, Visual LISP & DCL
I have access to AutoCAD 2025 and AutoCAD LT 2025, however I'm trying to build it in a manner where it functions in LT as thats what most of the guys use -
Are you using AutoCAD LT 2025?
-
Excel link - Sanity check please
swanny89 replied to swanny89's topic in AutoLISP, Visual LISP & DCL
@Danielm103 Thank you for this, it looks really good. The problem is that I'm building this for people that are exceptionally resistant to change, and really I need a standalone lisp that can just be launched from within autocad and handles everything. If there is any more complexity to it than that, then it simply wont even be considered for adoption @Steven P Thanks for the info, I'll take a look this evening once I've got my actual work out of the way for the day -
Steven P started following Excel link - Sanity check please
-
Excel link - Sanity check please
Steven P replied to swanny89's topic in AutoLISP, Visual LISP & DCL
BigAl is pretty good with Excel - got to wait for him to wake up - he's got some stuff stashed away that might also do the trick, also look in 'downloads' at the top here, Alan Excel might do what you want with the excel part. -
Danielm103 started following Excel link - Sanity check please
-
Excel link - Sanity check please
Danielm103 replied to swanny89's topic in AutoLISP, Visual LISP & DCL
I have an app on the store, XLSX Field Evaluator https://apps.autodesk.com/ACD/en/Detail/Index?id=4867035866745163447&appLang=en&os=Win64 You can add fields to block attributes that are linked to excel There’s trial version https://apps.autodesk.com/ACD/en/Detail/Index?id=4446191126131749248&appLang=en&os=Win64 it never expires, capped at 20 fields though -
Excel link - Sanity check please
swanny89 replied to swanny89's topic in AutoLISP, Visual LISP & DCL
@Lee Mac Ok fantastic that's great news thank you. The problem is that this data will ALWAYS be held and monitored in an excel spreadsheet. The company uses this method as a standard and it will never change, I'm trying to gather the data without changing any procedures as this would invoke carnage. I've got the code to read from and write to the blocks working fine. As the next step, I'm trying to simply read a cell value from Excel, but it keeps throwing "error: bad argument type: VLA-OBJECT nil" and I don't have the experience to figure out why (I'm new to LISP). This is the code I have. Are you able to give me a nudge in the right direction? Or provide some sample code that will let me read a cell value? Many thanks; (defun c:FindExcelValue ( / fname xlApp xlBook xlSheet searchStr foundVal row col cellVal) ;; Prompt for Excel file path (setq fname (getfiled "Select Excel file" "" "xls;xlsx" 0)) (if fname (progn ;; Ask for search string (setq searchStr (getstring T "\nEnter string to search for: ")) ;; Start Excel (setq xlApp (vlax-get-or-create-object "Excel.Application")) (setq xlBook (vlax-invoke-method (vlax-get-property xlApp 'Workbooks) 'Open fname)) (setq xlSheet (vlax-get-property xlBook 'ActiveSheet)) ;; Assume search in column A (col = 1) (setq row 1 col 1 foundVal nil) ;; Loop until empty cell (while (and (not foundVal) (setq cellVal (vlax-get-property (vlax-get-property xlSheet 'Cells) 'Item row col)) (/= (vlax-get-property cellVal 'Value) nil)) (if (= (strcase (vlax-get-property cellVal 'Value)) (strcase searchStr)) (setq foundVal (vlax-get-property (vlax-get-property xlSheet 'Cells) 'Item row (1+ col)) 'Value)) (setq row (1+ row)) ) ;; Print result (if foundVal (princ (strcat "\nFound value: " (vl-princ-to-string foundVal))) (princ "\nString not found.") ) ;; Clean up (vlax-invoke-method xlBook 'Close :vlax-false) (vlax-release-object xlSheet) (vlax-release-object xlBook) (vlax-release-object xlApp) ) ) (princ) ) -
Lee Mac started following Excel link - Sanity check please
-
Yes, this is possible; though, you'll find it easier using a .csv/.txt file (which can be read using standard AutoLISP IO functions), in lieu of an .xls/.xlsx file (for which you'll need to use ActiveX(COM) to interface with the installed Excel application). Once the data has been acquired however, updating the block attributes is straightforward.