Jump to content

Search the Community

Showing results for tags 'autolisp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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.
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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.
  11. 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
  12. Hello, I am looking for a lisp that will allow me to increment an attribute in a block from one block to the next by doing a window selection. The lisp that I have now that I got from Chaitanya Chikkala (see below) works great, but I have to select each block individually. With 2000+ blocks it is easy to make a mistake. When I window select with it, it numbers them as they were added to the drawing. This does not work for me because multiple people work on drawings and then are combined into a master drawing so the order is wrong. Is there a way for a direction to be added, even if it is just along the x or y axis? Or is there a lisp that already does this? Any help is very much appreciated. (defun c:incr (/ ent obj x i ST_STR) (command "._undo" "_be") (SETQ ST_STR1 (GETSTRING "\nENTER STARTING NUMBER OF THE SEQUENCE(ANY ALPHABET/WORD)")) (SETQ ST_STR (GETSTRING "\nENTER STARTING NUMBER OF THE SEQUENCE(ANY INTEGER)")) (vl-load-com) (setq i 0) (prompt "\nSelect blocks one at a time and in order") (SETQ BLOCK_LIST (SSGET)) (SETQ BLOCK_LIST (FORM_SSSET BLOCK_LIST)) (while (< I (LENGTH BLOCK_LIST)) (SETQ ST_STR (STRCAT "" ST_STR)) (SETQ TEMP_ELE (NTH 0 (ATTRIBUTE_EXTRACT (NTH I BLOCK_LIST)))) (SETQ TEMP_ATTRIBUTE (STRCAT ST_STR1 ST_STR)) (SETQ TEMP_TAG (NTH 0 TEMP_ELE)) (MODIFY_ATTRIBUTES (NTH I BLOCK_LIST) (LIST TEMP_TAG) (LIST TEMP_ATTRIBUTE)) (SETQ ST_STR (ITOA (+ (ATOI ST_STR) 1))) (setq i (+ i 1)) ) (command "._undo" "_e") (princ)) (DEFUN FORM_SSSET (SSSET / I TEMP_ELE LIST1) (SETQ I 0) (SETQ TEMP_ELE NIL) (SETQ LIST1 NIL_) (WHILE (< I (SSLENGTH SSSET)) (SETQ TEMP_ELE (SSNAME SSSET I)) (SETQ LIST1 (CONS TEMP_ELE LIST1)) (SETQ I (+ I 1)) ) (REVERSE LIST1) ) (DEFUN ATTRIBUTE_EXTRACT (ENTNAME / ENT_OBJECT SAFEARRAY_SET I LIST1) (SETQ SAFEARRAY_SET NIL) (SETQ ENT_OBJECT ENTNAME) (SETQ ENT_OBJECT (VLAX-ENAME->VLA-OBJECT ENT_OBJECT)) (IF (= (VLAX-GET-PROPERTY ENT_OBJECT "HASATTRIBUTES") :VLAX-TRUE) (PROGN (SETQ SAFEARRAY_SET (VLAX-SAFEARRAY->LIST (VLAX-VARIANT-VALUE (VLAX-INVOKE-METHOD ENT_OBJECT "GETATTRIBUTES") ) ) ) (SETQ I 0) (SETQ LIST1 NIL) (WHILE (< I (LENGTH SAFEARRAY_SET)) (SETQ LIST1 (CONS (LIST (VLAX-GET-PROPERTY (NTH I SAFEARRAY_SET) "TAGSTRING") (VLAX-GET-PROPERTY (NTH I SAFEARRAY_SET) "TEXTSTRING") ) LIST1 ) ) (SETQ I (+ I 1)) ) (SETQ LIST1 (REVERSE LIST1)) (SETQ LIST1 (SORT_FUN LIST1 0 0))) (SETQ LIST1 NIL) )LIST1 ) (DEFUN MODIFY_ATTRIBUTES (ENTNAME IDENTIFIER VALUE / TEMP_ELE ENT_OBJECT SAFEARRAY_SET I J) (SETQ SAFEARRAY_SET NIL) (SETQ ENT_OBJECT ENTNAME) (SETQ ENT_OBJECT (VLAX-ENAME->VLA-OBJECT ENT_OBJECT)) (IF (= (VLAX-GET-PROPERTY ENT_OBJECT "HASATTRIBUTES") :VLAX-TRUE) (PROGN (SETQ SAFEARRAY_SET (VLAX-SAFEARRAY->LIST (VLAX-VARIANT-VALUE (VLAX-INVOKE-METHOD ENT_OBJECT "GETATTRIBUTES") ) ) ) (SETQ I 0) (SETQ J 0) (SETQ LIST1 NIL) (WHILE (< I (LENGTH SAFEARRAY_SET)) (SETQ TEMP_ELE (VLAX-GET-PROPERTY (NTH I SAFEARRAY_SET) "TAGSTRING")) (IF (/= (VL-POSITION TEMP_ELE IDENTIFIER) NIL) (PROGN (VLAX-PUT-PROPERTY (NTH I SAFEARRAY_SET) "TEXTSTRING" (NTH (VL-POSITION TEMP_ELE IDENTIFIER) VALUE)) )) (SETQ I (+ I 1)) ) ))) (DEFUN SORT_FUN (LIST1 FLAG1 FLAG2 /) (IF (= NIL (VL-CONSP (CAR LIST1))) (PROGN (SETQ LIST1 (INDEX_ADD LIST1)) (SETQ LIST1 (VL-SORT LIST1 '(LAMBDA (X Y) (< (CADR X) (CADR Y))) ) ) (SETQ LIST1 (MAPCAR '(LAMBDA (X) (CADR X)) LIST1)) ) (PROGN (IF (NOT (ATOM (NTH FLAG1 (NTH 0 LIST1)))) (SETQ LIST1 (VL-SORT LIST1 '(LAMBDA (X Y) (< (NTH FLAG2 (NTH FLAG1 X)) (NTH FLAG2 (NTH FLAG1 Y))) ) ) ) (PROGN (SETQ LIST1 (VL-SORT LIST1 '(LAMBDA (X Y) (< (NTH FLAG2 X) (NTH FLAG2 Y))) ) ) ) ) ) ) LIST1 )
  13. 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
  14. 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
  15. 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é
  16. Alan_KD

    XREF layer

    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
  17. Many a times it requires to show the same block with different angle and scale. Rotating each block to a required angle, and scaling it as required will take a lot of time so can we Insert Block in-between two Points in the angle and scale of points selection using Autolisp . I am using AutoCAD 2004. Thank You !
  18. Version 1.0.0

    962 downloads

    This AutoLISP file can be used to flatten a 3D drawing. It does this by setting all Z values in the drawing to zero. Instructions on how to load and run this file in AutoCAD are given in this thread.
  19. Hei, Can enyone make autolisp to annotate 3d point z value! Best, MRe
  20. Arek Adamczuk

    AutoCAD - autolisp-HELP

    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.
  21. FYI: Steve Johnson has an article about this new lisp function called (inspector), in BLADE, for inspecting objects.
  22. 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) )
  23. 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.
  24. Hi all: I like using Lisps, but don't know how to write code for them. I like this particular lisp created by Mosad Elewa and posted on Cadalyst.com. When trying the lisp on a polyline, it did not work. Seems to only work on a "line". Here's the code: ---------------------------------------------------------------------------------------------------- ;;;CADALYST 02/07 Tip 2180: DIV.LSP Modify Divide © 2007 Mosad Elewa ;DIV.LSP BY MOSAD H. ELEWA (1996) (defun C:DIV () (setq ent (entget (car (entsel "\nSelect object to divide")))) (setq etype (cdr (assoc 0 ent))) (if (eq etype "LINE") (progn (cond ( (setq m (getint "\nNumber of segments")) (setq pt1 (cdr (assoc 10 ent))) (setq pt2 (cdr (assoc 11 ent))) (setq ang (angle pt1 pt2)) (setq dist (distance pt1 pt2)) (setq dd (/ dist m)) (setq pt3 (polar pt1 ang dd)) (setq ang2 (+ ang 1.5708)) (setq pt4 (polar pt3 ang2 (/ dd 4))) (setq ds (distance pt1 pt3)) (command "line" pt3 pt4 "") (setq pt5 (polar pt3 ang2 (/ dd )) (command "move" "l" "" pt4 pt5) (setq d 0) ; (setvar "cmdecho" 0) (command "copy" "l" "" "m" pt1) (repeat (- m 2) (command (polar pt1 ang (setq d (+ d ds))))) (command ""))) )) (if (eq etype "ARC") (progn (setq n (getint "\Number of segments")) (setq ang (cdr (assoc 50 ent))) (setq ang2 (cdr (assoc 51 ent))) (setq ang3 (- ang2 ang)) (setq ang4 (/ (* ang3 180.0) pi)) (setq cp (cdr (assoc 10 ent))) (setq r (cdr (assoc 40 ent))) (setq pt1 (polar cp ang r)) (setq pt2 (polar cp ang (/ r 4))) (setq pt3 (polar cp ang (/ r )) (command "line" cp pt2 "") (command "move" "l" "" pt3 pt1) (command "array" "l" "" "p" cp (+ n 1) ang4 "y") )) (if (eq etype "CIRCLE") (progn (setq n (getint "\Number of segments")) (setq cp (cdr (assoc 10 ent))) (setq r (cdr (assoc 40 ent))) (setq pt1 (polar cp 0 r)) (setq pt2 (polar cp 0 (/ r 4))) (setq pt3 (polar cp 0 (/ r )) (command "line" cp pt2 "") (command "move" "l" "" pt3 pt1) (command "array" "l" "" "p" cp n "360" "y") )) (princ) )[/CODE] -----------------------------------------------------------------------------------------------------
  25. Hello, I have 5000 drawings that contains three specific tables. All these tables are linked to external Excel using data links. The main issue i have is, after the data link is removed the cell content of all three tables remain locked. Is there any way to unlock the cells using lisp??. I know i can do it manually but i don't want to go that route unless it is the only the way to do so. Please take a look at the drawing & lsp file. Trial.dwg Thank you very much. Regards, A AUTOCAD AUTOMATION.LSP
×
×
  • Create New...