Search the Community
Showing results for tags 'saveas'.
-
Script. Save, Open, Close, Switch back to original DWG
svorgodne posted a topic in AutoLISP, Visual LISP & DCL
I am creating a copy from a drawing with Autolisp and creating a script which will be dettaching all xrefs on the copy. After saving the copy, the last command of the script is "close", then I would like to go back to the original drawing from where the copy was made from. This is not happening if there are some other drawings opened, then it makes active the last opened drawing. I need an automatic process since I will not be the final user and they might get confused. Here it is the code: (defun run (/ mc_scr) (setq switch_dwg (strcat (getvar 'dwgprefix) (getvar 'dwgname) ) ) (setq mc_scr (open (strcat (getenv "temp") "\\mc.scr") "w")) (foreach mem0 (list "open" (strcat "\"" new_c "\"") "(setq opn_dwg_lst nil)" "(vlax-for" " x" " (vla-get-documents" " (vlax-get-acad-object)" " )" " (setq opn_dwg_lst (cons x opn_dwg_lst))" ")" "-xref" "d" "*" "-purge" "a" "*" "n" "_ucs" "_w" "_plan" "_w" "_zoom" "_e" "(foreach SYM_MEM opn_dwg_lst" " (if " " (=" " (strcat" " \"A\"" " (substr" " (getvar \"dwgname\")" " 2" " )" " )" " (vla-get-name SYM_MEM)" " )" " (setq SYM_A SYM_MEM)" " )" ")" "qsave" "close" "(vla-activate SYM_A)" ) (write-line mem0 mc_scr) ) (close mc_scr) ) (defun mc (/ new_c mc) (setvar 'CMDECHO 0) (if (= (substr (getvar 'dwgname) 1 2 ) "A_" ) (progn (command "qsave") (setq new_c (strcat (getvar 'dwgprefix) (vl-string-subst "B_" "A_" (getvar 'dwgname)) ) ) (cond ( (/= (findfile new_c) nil) (command "save" new_c "y") (run) ) (T (command "save" new_c) (run) ) ) (command "script" (strcat (getenv "temp") "\\mc.scr")) ) ) (setvar 'CMDECHO 1) (princ) ) (mc) Any clue? thanks in advance Svorgodne -
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. -
Hi, is there a way to save my drawing with its name in a directory by using a Attribute value. Example: Drawingname: test.dwg blockname: TitleBlock Attribute: SF:WE Attribute-Value: test2 And it should save the drawing in: C:drawing/test drawing/(attribute-value)/... but it should be in a dialogbox, so i can choose the specific subfolder the direcotry up to the attribute-value is fix.
-
Hi I am creating many new drawing which are exactly the same except they have a differing Xref. i want to create a drawing saved as 501.dwg to 703.dwg And I have xrefs that are called page x_page 1.dwg to x_page 202.dwg i have already created 501.dwg it has 1 block and 1 xref already in it. I want all dwgs to have this block and xref but have a another differing xref I’ve done stuff like this manually many times and I always thought there must be a way to automate it I have often made Scrips to help me out. But the saveas function is a part that need to vary I think lisp can do this but i an unsure where to even start.