Search the Community
Showing results for tags 'autolisp'.
-
Select Specific Blocks by knowing their names
Ahmed_Hisham posted a topic in AutoLISP, Visual LISP & DCL
Hi all, I want to select specific block by knowing its name lets say block name "cadtutor block 1" by using (vl-catch-all-apply) method Thanks -
Send Wipeout to Back of Draworder within Block Definition
b_gum posted a topic in AutoLISP, Visual LISP & DCL
So I have been trying to figure this out with several approaches now and I need some help. I would like to send all Wipeouts, or really any specified entity type, within a block to the back of the draw order. Is there a way to do this using Lee Mac's Apply To Block Objects routine? I tried this in conjunction with his draw order routines but the MovetoBottom command kept failing. I'm pretty rough with VisualLisp which is part of the issue when trying to troubleshoot his great routines. Or what about this approach? (I dont really understand it, again Visual Lisp) Below is what I tried. I do understand Vanilla Lisp. Visual Lisp I barely know the basics, but eager to learn. Please help me improve my capabilities. I love autolisp. Thank you. The issue is clearly with the lambda function and my improper use of it Im sure. The ssget I am trying to do is incorrect approach for use with his function. ;=========================================================== ; 11/Sep/2020 10:09 AM[Friday] AUTHOR: Brandon Gum ;-- ;DESCRIPTION: ;Select block with wipeout. ;Will send wipeout objects the back of the draw orer ;=========================================================== (defun c:test ( / s ) (princ "\nSelect Block: ") (if (setq s (ssget "_+.:E:S" '((0 . "INSERT")))) (LM:ApplytoBlockObjects (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (vla-get-effectivename (vlax-ename->vla-object (ssname s 0))) '(lambda ( obj ) (BG:WipeoutToBottom)) ) ) (princ) ) (vl-load-com) (princ) (defun BG:WipeoutToBottom( / ) (LM:movetobottom (ssget "X" '((0 . "WIPEOUT")))) ;(princ) );end of defun ;===============Below here are Lee's draw order functions============== My LeeMac Based Approach.LSP -
Hi, this is my first post. I am trying to draw five circles, one in the centre (x=0, y=0) and the other four, located in each quadrant of circle located in (0,0). I have written the script below but, I does not work. The circles with negative coordinates are drawn on top of the other with positive coordinates. I do not understand, why is this behavior, if you know please let me know. (defun C:he () (setq r 10.0) (command "circle" (list 0 0) r "") (command "circle" (list 5 0) r "") (command "circle" (list -5 0) r "") (command "circle" (list 0 5) r "") (command "circle" (list 0 -5) r "") ) Thanks
-
Hi guys, I'm new to this forum and new to programming with lisp - please be kind.... The code I am writing will draw a 3dPolyline from a specific point to another point (usually with a lower z coordinate), the polyline will then be converted to a spline, a circle will be drawn at the start of the 3dPolyline and extruded along the spline to form a "curved tube". The intention is to use this as a flexible duct from a "spigot" on an A/C duct to a ceiling diffuser. The 3dPoly has to be perpendicular to the start point and end point for obvious reasons - see intentional misalignment picture. Below a portion of the unfinished code to select the start point, select the endpoint, then it must start drawing the 3dpoly from the start point, get a variable number of user input points (in order to define the initial direction and plane) and general path of the flexible duct. The end point of the 3dpoly is already defined with the initial selection of the "Endpoint on Diffuser" although the 2nd last point has to be mathematically determined considering the plane must be perpendicular to the end point. So - after selecting say 3 or 4 user defined points along the path, I want to be able to press enter, and the code must then calculate the 2nd last point and continue drawing the 3dpoly from the last picked point, to the calculated 2nd last point and then to the endpoint. Generally one has to be mindful that the curve of the tube cannot have a "sharp bend" - smooth curves are ideal for the airflow. The diameter of the tube will also change depending on the specific size requirements. Attached a small drawing and picture to show the intent. The crux of my problem: I cannot figure out how to start the 3dpoly command, make it pick the start of the line, then hand over to the user to continue picking 4 or 5 points, press enter, and then continue drawing the 3dpoly with calculated numbers? Would really appreciate some guidance. Maybe use of cmdactive? I really do not know enough to figure this one out. (defun C:Flex250 () (command "_.layer" "_thaw" "HVAC Flex" "_make" "HVAC Flex" "") (setq Prev_OM (getvar "OSMODE")) (setvar "OSMODE" 8) (setq StartPoint (getpoint "\nEnter Start Point on Duct Spigot : ")) (setq EndPoint (getpoint "\nEnter End Point on Diffuser : ")) (setq Z0 (caddr EndPoint)) (setq Z1 (+ (caddr EndPoint) 50)) (setq Z2 (+ (caddr EndPoint) 150)) (setq pt0 EndPoint) (setq pt1 (list (car EndPoint) (cadr EndPoint) Z1)) (setq pt2 (list (car EndPoint) (cadr EndPoint) Z2)) (SetVar "Elevation" (princ (caddr StartPoint))) (command ".3DPoly" (princ Startpoint) (getpoint "\nNext point : ") pt2 pt1 pt0) ) Then a last question - is there a way to ensure the spline's start and finish points are 100% perpendicular to the planes they connect to? Thank you in advance for your input. Test.dwg
- 1 reply
-
- user input
- 3dpoly
-
(and 3 more)
Tagged with:
-
Automatic Dimensioning for Blocks in Autocad
Ahmed_Hisham posted a topic in AutoLISP, Visual LISP & DCL
Good Day, I want the attached code to run as QDIM in Autocad , My issue in my code that I choose the location of the dimension line after that the dimension appears. I want to see all the dimensions afterwards choose the location like in QDIM command. Thanks (vl-load-com) (defun C:FH ( / *error* doc oVAR ss i pts ptsx ptsy d d0 filter ) (defun *error* (errmsg) (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break")) (princ (strcat "\nError: " errmsg))) (foreach e oVAR (setvar (car e) (cdr e))) (vla-endundomark doc) (princ)) ;------------------------------------------------------------------------------------------------------ (vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object)))) (foreach e '(CMDECHO ORTHOMODE) (setq oVAR (cons (cons e (getvar e)) oVAR))) (setvar 'CMDECHO 0) (setvar 'ORTHOMODE 0) (if (and (princ "\nNeed blocks, ") (setq ss (ssget (list '(0 . "INSERT")))) (< 1 (setq i (sslength ss))) (while (not (minusp (setq i (1- i)))) (setq pts (cons (cdr (assoc 10 (entget (ssname ss i)))) pts))) (setq ptsx (vl-sort pts '(lambda (p q) (< (car p) (car q))))) (setq ptsy (vl-sort pts '(lambda (p q) (< (cadr p) (cadr q))))) (setq d (abs (/ (- (car (last ptsx)) (caar ptsx)) ;xmax-xmin (if (zerop (setq d0 (- (cadr (last ptsy)) (cadar ptsy)))) ;ymax-ymin 0.001 d0)))) (setq pt (getpoint "\nSpecify dimension line location: ")) (or *DimTypeBDA (setq *DimTypeBDA "Aligned")) (not (initget "Horizontal Vertical Aligned")) (setq *DimTypeBDA (cond ((getkword (strcat "\nType of dimension [" (cond ((> d 1000.) (if (= *DimTypeBDA "Vertical") (setq *DimTypeBDA "Horizontal")) "Horizontal") ((< d 0.001) (if (= *DimTypeBDA "Horizontal") (setq *DimTypeBDA "Vertical")) "Vertical") ("Horizontal/Vertical")) "/Aligned] <" *DimTypeBDA ">: "))) (*DimTypeBDA))) (setq pts (if (or (= *DimTypeBDA "Horizontal") (and (= *DimTypeBDA "Aligned") (> (- (car (last ptsx)) (caar ptsx)) (- (cadr (last ptsy)) (cadar ptsy))))) ptsx ptsy)) (setq i 0) ) (repeat (1- (length pts)) (cond ((= *DimTypeBDA "Horizontal") (command "_.DIMLINEAR" "_none" (nth i pts) "_none" (nth (1+ i) pts) "_H" "_none" pt)) ((= *DimTypeBDA "Vertical") (command "_.DIMLINEAR" "_none" (nth i pts) "_none" (nth (1+ i) pts) "_V" "_none" pt)) (T ;Aligned (command "_.DIMALIGNED" "_none" (nth i pts) "_none" (nth (1+ i) pts) "_none" pt))) (setq i (1+ i))) (princ (strcat "\nError: Wrong selection of at least 2 BLOCKS."))) (foreach e oVAR (setvar (car e) (cdr e))) (vla-endundomark doc) (princ) ) FH Final.LSP -
I work for a glazing company where we do all our glass sizing manually and am looking for a way to do it automatically. I am not very knowledgeable in Lisp. So we have a block we use to put the sizes into. I was wondering if it is possible for a lisp to read the size of a rectangle that has the block inside of it and put dimensions into the specified area. The block also has multiple Visibility's to fit in different places. There is also multiple visibility's for the reason that I made it for multiple people with different preferences. (See dwg. file below for block). Is this at all possible? Callout_GL.dwg
-
autolisp Need lisp for export cad text / table in excel.
Mohanm posted a topic in AutoLISP, Visual LISP & DCL
Dear Team member, I have more number of BOQ table in Auto Cad. Need to export that table and text to excel in editable format. Can anyone help and share the lisp for export cad text / table in excel. Thanks. Mohan -
I can convert my raw AutoLISP (.lsp) codes into Visual Lisp (.VLX) and .FAS application using AutoCAD VLISP IDE. I was looking into Autodesk App Store and downloaded some of the free applications. It was .msi. That means it will install directly on Windows and link-up with installed AutoCAD. I am very new in the App Store. Could you please help me to understand to convert my .lsp or .vlx or .fas into .msi? Thanks.
- 4 replies
-
- autolisp
- visual lisp
-
(and 3 more)
Tagged with:
-
I did a program in Autolisp, so I want to encript that in order to avoid hacks. What would you recommend me? Because I want rent it. Im a beginner, so I dont know to much about the topic. Thanks to much for your advices
-
Hi, I need help. My AutoLISP works well in DWG To PDF but it comes out 1 file per 1 DWG. I want it to be the only PDF file. Can somebody help me with something? (I can't use third party programs) Thank you for your help. The examples are in my attachments. My_Plot.LSP Test.dwg
-
help for small change in big lisp routine required
shortkrish posted a topic in AutoLISP, Visual LISP & DCL
Dear all, I have lisp dcl and data files working together to draw steel sections. I have done all the sections modified to indian standards originally it was written for british standards and it is free of copy rights. Since the author has changed to catia 3 dacades before. Please find attached images of error, dialog box and lisp files,data files and dcl files. This may looks like a big job. If any lisp expert available he can do it seconds. As I have done whole lot of things with minimum lisp knowledge. Thanks Krish stl_ipn.dat stl_rsj.dat stl_deflt.dat STL.LSP stl_rtee.dat stl_ub.dat stl_rhs.dat stl_shs.dat stl_uc.dat stl_ursa.dat stl_ersa.dat stl_chs.dat stl_rsc.dat stl_pfc.dat stl_ipe.dat rec.dwg stl_passwd.dat stl_pipe.dat stl_steeub.dat stl_steeuc.dat stl_u.dat stl_ubp.dat stl_upn.dat stl_wash.dat README.TXT stl.dcl stl.slb stl_cap.dat stl_csk.dat stl_cub.dat stl_cuc.dat stl_hd.dat stl_he.dat stl_hex.dat stl_hl.dat stl_hp.dat stl_hx.dat -
Copy Multiple Block Attributes from one block to another one click
lamonmar posted a topic in AutoLISP, Visual LISP & DCL
I have a drawing that has two different blocks (see attached), what I needed to do was transfer over the attributes of one block over to the other (both have different tags). For example copying over attributes in "rev0_date" from the first block tag over to "revslot1date" in the second block tag , I ran across some code in the forums that did just that created by Lee Mac.The problem with it is it only transfers one attribute over, I modified it a little but its still not exactly what I need. The way it currently works is - It asks me to choose the first block with the attributes to copy, once selected it then asks me to choose the second block that will have the attributes pasted to it, once I've selected them, it then pastes the first specified tag attribute in the first block to the second, after that I have to repeat the process again, clicking the block with the attribute to copy and then choosing the second block to paste, I have to keep repeating these steps, clicking the first block then the second over and over until all the tag attributes have been copied over. My question is how can I stop having click the first and then second block over and over again for each tag and instead only have to go through the process once (click first block, then second and then transfer all the attributes over at once). Here is my current code (sorry if its a mess I'm very new to this): (defun c:blockswap ( / _SelectBlockWithTag a b des src tag ) (vl-load-com) (setq DAT1A "Rev0_Date" ; Source Attribute Tag 1 DES1A "Rev0_Desc" ; Source Attribute Tag 2 REV1A "Rev0" ; Source Attribute Tag 3 RDB1A "Rev0_Drawn_By" ; Source Attribute Tag 4 REV1B "RevSlot1Number" ; Destination Attribute Tag 3 DES1B "RevSlot1Description" ; Destination Attribute Tag 2 DAT1B "RevSlot1Date" ; Destination Attribute Tag 1 RDB1B "RevSlot1DrawnBy" ; Destination Attribute Tag 4 ) (defun _SelectBlockWithTag ( tag / e a ) (setq tag (strcase tag)) (while (progn (setvar 'ERRNO 0) (setq f (car (entsel (strcat "\nSelect Block with attribute " tag ": ")))) (cond ( (= 7 (getvar 'ERRNO)) (princ "\nMissed, Try Again.") ) ( (not f) nil ) ( (and (eq "INSERT" (cdr (assoc 0 (entget f)))) (= 1 (cdr (assoc 66 (entget f)))) ) (if (not (setq z (vl-some (function (lambda ( x ) (if (eq tag (strcase (vla-get-tagstring x))) x) ) ) (vlax-invoke (vlax-ename->vla-object f) 'getattributes) ) ) ) (princ (strcat "\nBlock does not contain tag " tag ".")) ) ) ( (princ "\nInvalid Object Selected.") ) ) ) ) z ) (and (setq aa (_SelectBlockWithTag DAT1A)) (setq ab (_SelectBlockWithTag DAT1B)) ) (vla-put-textstring ab (vla-get-textstring aa)) (and (setq ba (_SelectBlockWithTag DES1A)) (setq bb (_SelectBlockWithTag DES1B)) ) (vla-put-textstring bb (vla-get-textstring ba)) (and (setq ca (_SelectBlockWithTag REV1A)) (setq cb (_SelectBlockWithTag REV1B)) ) (vla-put-textstring cb (vla-get-textstring ca)) (and (setq da (_SelectBlockWithTag RDB1A)) (setq db (_SelectBlockWithTag RDB1B)) ) (vla-put-textstring db (vla-get-textstring da)) (princ) ) drawing.dwg -
Im beginner, I have this: (setq p1 (getpoint "\nPunto Inicial:")) (setq p2 (polar p1 (* 1.5 pi) 0.5)) (entmakex (list '(0 . "line") (cons 10 p1) (cons 11 p2) '(62 . 2))) So, the line I drawn is the yellow one below in the image. And, the text I want put is the magenta one. how can I do this? Thanks for your help
-
how to change a color of a line previusly drawn with Autolispp
danyra posted a topic in AutoLISP, Visual LISP & DCL
Im a begginer, I drawn a line in autolisp with this "code": (setq p1 (getpoint "\nPunto Inicial:")) (setq p2 (polar p1 (* 1.5 pi) 0.18)) (command "line" p1 p2 "") but, how can I change the color of this line?? For example I want yellow Thanks for your help. -
Assigning and Custom Drawing Property to a variable
juicyorange posted a topic in AutoLISP, Visual LISP & DCL
Hey guys, I'm looking to assign a custom property to a variable and I have no idea how to do it. In the 0 custom prop I put a testvalue Here is the code I have so far: (vl-load-com) (defun c:test (/) (setq acadObject (vlax-get-Acad-Object) acadDocument (vla-get-Activedocument acadObject) ;; set existing custom properties to dProps dProps (vlax-get-property acadDocument 'Summaryinfo) ) ;; get the value at the specifed index in the dProps and assign it to location (vla-GetCustomByIndex dProps 0 "IMPCSVLOC" location) ) I can't find any documentation on the "vla-GetCustomByIndex" so I don't really know how to use tbh. I've attached a file that has the custom property setup. All insight and help is appreciated. Thanks, JT testfile.dwg- 6 replies
-
- autolisp
- custom proerties
-
(and 2 more)
Tagged with:
-
takes out the coordinates of several polylines with a .txt file
asra posted a topic in AutoLISP, Visual LISP & DCL
Hello is it possible to make lisp to extract coordinates from several polyline lines and their titles in the form of a .txt file? I have an example of the attachment below, I hope someone can help me, thank you. OUTPUT.txt MASTER CROSS SECTION.dwg -
Export Enhanced Attributes Editor Values to Excel
MajorTom posted a topic in AutoLISP, Visual LISP & DCL
Hi, I'm new around here so, I couldn't find the solutions please don't mad me if this request already written by someone else. And also sorry about my grammer either The thing what I want to do : I have a folder and this folder is include many dwg files. And these dwg files contetnts one or more layouts. I'm using Enhanced Attribute Editor for keep data like; <drawing number>, <drawing name>, <date>, <revision no> etc. So I need a lisp for export these data to an excel file . thanks in advance for any help Truly Regards -
Autolisp: Comment between square brackets?
eengebruiker posted a topic in AutoLISP, Visual LISP & DCL
I just discovered that I can put a line in my lispfile like this: [Some notes]. When I load the lispfile the line is ignored. In other words it acts like comment. Comes in handy because I can use another type of comment, But . . . . . . Do I rely on a rule here or will I get into trouble later when using the code? Thanks in advance, André -
Hello everyone, I have been developing some routines for the pas 6 months, so my knowledge is not very high. Normally I manage to find answers online, thanks to all of you who share their knowledge, it's so helpful. I am writing a routine which would: Compare the XREF name on the drawing and the XREF 'real' file name and match them (on the drawing) if different. After the code checks if the XREF name matches a specific formatting and if it does creates a layer based on it (if the layer does not already exist). The final step is to change the XREF layer to that one, and here is where I am getting an error. I tried with different ways to do this and always got an error. I guess I could try to get this done without using vl code but this is really puzzling me and I would like to know why is actually not working, I dont see where the code could have gone wrong. The example names of my XREFs: which are used to compare with the wcmatch "*_*_*_*" XREF_TGLMTE_PRO_INTER_BASSINS_01 XREF_TGLMTE_PRO_INTER_RESEAUX_HS_2025_01 XREF_TGLMTE_PRO_TRC_V5_IND_D I used different lines of code to try to achieve this, as you can see on my commented lines on the code. I am currently using a (vlax-put-property it2 'layer strcalq) inside a vlax-for getting the following error: (defun c:xrcalque (/ AcadObj AcadAct LyAct it2 xrobjectname strcalq) (vl-load-com) (setq *error* ABD:Error) (setq AcadObj (vlax-get-Acad-Object)) (setq AcadAct (vla-get-ActiveDocument AcadObj)) (setq LyAct (vla-get-layers AcadAct)) ;get layers from Active document (xrn AcadObj AcadAct); runs the subroutine to change XREF name on drawing to match XREF file name (vlax-for it2 (vla-get-blocks AcadAct) (setq ind1 3) (setq ind2 0) (setq ind3 0) (if (= (vla-get-isxref it2) :vlax-true) (progn (setq xrobjectname (vl-filename-base (vla-get-name it2))) (if (wcmatch xrobjectname "*_*_*_*"); (progn (repeat ind1 (setq ind3 (+ ind2 1)) (setq ind2 (vl-string-position (ascii "_") xrobjectname ind3));gets firs position of "_" character ) (print xrobjectname) (setq ind2 (+ ind2 2)) (print ind2) ; ind2 is the position of the ind1 "_" element (3rd) to count from there to have the layer name (setq ind4 (vl-string-position (ascii "_") xrobjectname nil T)); last "_" position (setq ind5 (vl-string-position (ascii "-") xrobjectname nil T)); last "-" position (if (> ind4 ind5)(setq indlst ind4)(setq indlst ind5)) ;check which one is bigger (setq indlst (+ 1 indlst)) (setq strcalq (strcat "SF-XREF_"(substr xrobjectname ind2 (- indlst ind2)))) ;Create layer with string from ind2 position to ind4 or ind5 position (strcalq) (print strcalq) (if (not (tblsearch "LAYER" strcalq));checks non existance of layer (progn (vla-add LyAct strcalq) (print "Layer has been created") ) (progn ;(vla-put-layer it2 "0") ; (print "this is a test4") (print "layer exists") ;if layer exists put object on layer ) );if (print strcalq) ;(vla-put-layer it2 "0") ;(vla-put-layer xrobjectname strcalq) ;(vla-put-layer (vla-get-name it2) strcalq) ;(vlax-put it2 'Layer "0") ;(vlax-put (vlax-ename->vla-object (vla-get-name it2)) 'Layer "0") (vlax-put-property it2 'layer strcalq);############ ERROR############### );progn (print "wcmatch xref name not matching") );if );progn );if ;(vlax-put (vlax-ename->vla-object xrtemp) 'Layer strcalq) );vlax for (print "highly recommended to purge layers") ;add code to purge automatically the layers? (princ) );defun ;;;======================================= Error function ++++++++++++++++++++++++++++++++++++++++;;; (defun ABD:Error (st) (if (not (member st (list "Fonction annulée" "quitter / sortir abandon"))) (vl-bt) );if ;(princ "Merci d'envoyer vos commentaires ou report d'erreurs à ") (princ);clean exit ? );defun error ;;;======================================= function xrn +++++++++++++++++++++++++++++++++++++++++++;;; (defun xrn (AcadObj AcadAct / item xrobjectnamexrn xrfilenamexrn) (vlax-for item (vla-get-blocks AcadAct) (if (= (vla-get-isxref item) :vlax-true) (progn (setq xrobjectnamexrn (vl-filename-base (vla-get-name item))) (setq xrfilenamexrn (vl-filename-base (vla-get-path item))) (if (/= xrobjectnamexrn xrfilenamexrn) (progn (vla-put-name item xrfilenamexrn) (vla-reload item) ) ) ) ) ) );defun xrn If someone could explain why this is not working, and please share a way to achieve my goal would be awesome! Thank you in advance, Alan
-
-
how to do the automatically offset in between two lines offset centerline for all
amarendra posted a topic in AutoLISP, Visual LISP & DCL
Hello Dear Friends, how to do the automatically offset in between two lines offset centerline for all. kindly find the attached for sample image with drawing. if anyone knows lisp please help me. I am using AutoCAD 2017 Thanks Amarendra HVAC sample Offset.dwg -
Hello. I am a student and I need your help. My task is to write a program in AutoLISP that draws parts but I have no idea how to do it. The program in the simplest version which is only possible - I know that for some of you it's a bit of a job, so if it was possible, I would ask for help. I will try to repay somehow . Greetings. Sorry for my English.
-
FYI: Steve Johnson has an article about this new lisp function called (inspector), in BLADE, for inspecting objects.
-
I am creating an excel worksheet from autolisp to populate with all of my fuse information from autocad electrical 2011. Everything works fine except that I cannot figure out how to change the width of the columns in the excel spreadsheet from autolisp. Any assistance would be greatly appreciated. This is what I have on the spreadsheet: (setq xl (vlax-create-object "excel.application")) (setq wb-collection (vlax-get xl "workbooks")) (setq workbook (vlax-invoke-method wb-collection "add")) (setq sheets (vlax-get workbook "sheets")) (setq sheet1 (vlax-get-property sheets "item" 1)) (setq mywb(vlax-get-property xl "ActiveWorkbook")) (setq *excel-cells* (vlax-get sheet1 "cells")) (vlax-put xl "visible" 1) ;;****************insert header info into spreadsheet********************** (setq fuse_cell (strcat "A" (itoa in))) (setq cat_cell (strcat "B" (itoa in))) (setq mfg_cell (strcat "C" (itoa in))) (setq rating1_cell (strcat "D" (itoa in))) (setq class_cell (strcat "E" (itoa in))) (setq a (vlax-get-property xl 'Range fuse_cell)) (setq b (vlax-get-property xl 'Range cat_cell)) (setq c (vlax-get-property xl 'Range mfg_Cell)) (setq d (vlax-get-property xl 'Range rating1_cell)) (setq e (vlax-get-property xl 'Range class_cell)) (vlax-put-property a 'Value2 "FUSE") (vlax-put-property b 'Value2 "PART NUMBER") (vlax-put-property c 'Value2 "MANUFACTURER") (vlax-put-property d 'Value2 "RATING") (vlax-put-property E 'Value2 "CLASS") (setq in 2); sets row in spreadsheet ;*****************************populate excel sheet**************************************** (repeat (length fuse_name) (setq fuse_cell (strcat "A" (itoa in))) (setq cat_cell (strcat "B" (itoa in))) (setq mfg_cell (strcat "C" (itoa in))) (setq rating1_cell (strcat "D" (itoa in))) (setq class_cell (strcat "E" (itoa in))) (setq a (vlax-get-property xl 'Range fuse_cell)) (setq b (vlax-get-property xl 'Range cat_cell)) (setq c (vlax-get-property xl 'Range mfg_Cell)) (setq d (vlax-get-property xl 'Range rating1_cell)) (setq e (vlax-get-property xl 'Range class_cell)) (vlax-put-property a 'Value2 (nth in_lst fuse_name)) (vlax-put-property b 'Value2 (nth in_lst fuse_Cat)) (vlax-put-property c 'Value2 (nth in_lst fuse_mfg)) (vlax-put-property d 'Value2 (nth in_lst fuse_rating1)) (vlax-put-property e 'Value2 (nth in_lst fuse_class)) (setq in_lst (1+ in_lst))(princ) (setq in (1+ in))(princ) )
-
save excel workbook to new location from autolisp
Mickey the Gr8 posted a topic in AutoLISP, Visual LISP & DCL
I need to know how to save a new excel workbook to a location of my choosing. I want to be able to open a new workbook, add data, and then save it in a folder in my project folder. I can do everything but save it to the new location. This is what I have so far. (vl-load-com) (setq FilePath "T:\\reference material\\fuse_list_template.xls") (setq ExcelApp (vlax-get-or-create-object "Excel.Application")) (vla-put-visible ExcelApp :vlax-true) (vlax-put-property ExcelApp "DisplayAlerts" :vlax-false) (setq Wbk (vl-catch-all-apply 'vla-open (list (vlax-get-property ExcelApp "WorkBooks") FilePath))) From here I am adding data from autocad electrical 2011 which works fine. My problem is I want to save this to a location that is not the same as the original filepath. I cannot find the code to do a "save as" to the excel workbook. Any help would be appreciated. It should not be this complicated. Thanks.