乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 67|回复: 8

[编程交流] DCL default, if not and two va

[复制链接]

15

主题

243

帖子

228

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-5 23:23:02 | 显示全部楼层 |阅读模式
Hey all, I'm trying to debug my application of an error that occurs when initially running the application, it errors if the default radio buttons are not toggled.....but if the radio buttons are toggled, the error does not occur.
 
What I have the toggles are for New file, or Append File.
The DCL defaults to Newfile, but if just the "OK" button is pressed, the program gives an error.
If the user switches to "Append" and then puts right back onto "New" then there is no error!!
 
Here's the code
  1. (defun putexcells ( vallist dupeslist / c data adata bdata fdata ldata cell)(setq cell (strcat "B" @excel_row))(setq c 0)(setq len (length vallist))(repeat len(setq data (nth c vallist))(setq adata (cadr data))(setq bdata (car data))(if (not fdata)(setq fdata (strcat adata "-" bdata)))(setq cell (string_ cell))(putcell cell fdata)(setq ldata (list bdata adata))(if(member ldata @dupeslist)(putcolor cell 15));if(setq fdata nil)(setq c (1+ c)));repeat(if (= c len)(doname vallist));if);defun(defun doname ( vallist / c cell namedata)(setq c 0)(setq len (length vallist))(setq cell (strcat "E" @excel_row))(setq cell (string_ cell))(repeat len(setq namedata (getname))(putcell cell namedata)(setq cell (string_ cell))(setq c (1+ c)));repeat(if (= c len)(doitem vallist));;goto item subfunction);defun doname(defun doitem ( vallist / itemcell itemdata c)(setq c 0)(setq len (length vallist))(setq itemcell (strcat "A" @excel_row))(setq itemcell (string_ itemcell))(if lastitem (setq itemdata lastitem))(if (= @excel_row "8")(setq itemdata "0")(setq itemdata (string_ @excel_row)));else(repeat len(setq itemdata (string_ itemdata))(putcell itemcell itemdata)(setq itemcell (string_ itemcell))(setq c (1+ c)));repeat(setq lastitem itemdata)(if (= c len)(dotype vallist));;goto type subfunction);defun doitem(defun dotype ( vallist / cell c data adata)(setq c 0)(setq len (length vallist))(setq cell (strcat "C" @excel_row))(setq cell (string_ cell))(repeat len(setq data (nth c vallist))(setq adata (cadr data))(putcell cell adata)(setq cell (string_ cell))(setq c (1+ c)));repeat(if (= c len)(dotag vallist));;goto tag subfunction);defun dotype(defun dotag ( vallist / c cell data adata)(setq c 0)(setq len (length vallist))(setq cell (strcat "D" @excel_row))(setq cell (string_ cell))(repeat len(setq data (nth c vallist))(setq adata (car data))(putcell cell adata)(setq cell (string_ cell))(setq c (1+ c)));repeat(princ (strcat "\n...." (itoa (length @dupeslist)) " unique items duplicated in excel file"))(princ "\n....Those items have had their cells colored Grey.")(princ "\n....Finished!")(setq vallist nil)(setq @dupeslist nil)(setq @excel_col "A")(setq @excel_row "8")(princ);;end of excel input, routine will alert to user that it is complete(princ));defun dotype(defun getname (/ dwgname tempname1)(setq dwgname (getvar "dwgname"))(setq tempname1 (substr dwgname (+ -7 (vl-string-search ".dwg" dwgname))))(setq dwgname1 (substr tempname1 1 (- (strlen tempname1) 7))));defun(defun C:putex (/ TAGROW VALROW EDATA E I SS TAGLIST TEMPLIST REVLIST vallist *error*)(defun closeout ( / ) (vlax-invoke-method (vlax-get-property *ExcelApp% "ActiveWorkbook") 'Close :vlax-False) (vlax-invoke-method *ExcelApp% 'Quit) (vlax-release-object *ExcelApp%)(gc) (setq *ExcelApp% nil *ExcelFile$ nil) );defun closeout(defun MyExit (msg)(cond  ((not msg)) ; no error, normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ;  or (quit) ((princ (strcat "\nError: " msg)))) ; error, display it (closeout)(princ));defun(setq *error* MyExit);(openexcel @excel_file "INDEX" T)(openexcel "Y:\\Bhull\\213035-INST-IND-00000001-00.xls" "INDEX" T)(if @dupeslist (setq @dupeslist nil))(setq TagList '("TAG00" "TAG10"))(setq ss (ssget "_X" (list (cons 0 "INSERT")(cons 2 "CE001,CE007,CE013,CE023,CE021"))))(setq i -1)(repeat (sslength ss)(setq TagRow nil      ValRow nil)  (setq Edata (entget (setq e (ssname ss (setq i (1+ i))))))  (while (/= (Dxf 0 Edata) "SEQEND")     (if       (and         (= (Dxf 0 Edata) "ATTRIB")         (member (dxf 2 Edata) TagList)         ;;if tag is on list          ) ;and        (progn          (setq TagRow (cons (Dxf 2 Edata) TagRow))          (setq valRow (cons (Dxf 1 Edata) ValRow))          ) ;progn)     (setq Edata (entget (setq e (entnext e))))     ) ;while(setq vallist (cons valrow vallist))) ;repeat (foreach sublist vallist (setq templist (list (vl-string-trim " " (car sublist)) (vl-string-trim " " (cadr sublist))))   (if (not (equal templist '("" ""))); had other than space(s)-only content     (setq revlist (cons templist revlist))   ); if); foreach (setq vallist (reverse revlist)) (setq revlist nil) (setq @dupeslist (reverse (lm:listdupes vallist)))(princ)(if vallist(putexcells vallist @dupeslist));if(princ));defun(defun createvallist ( ss / tagrow valrow edata e)(repeat (sslength ss)(setq TagRow nil      ValRow nil)  (setq Edata (entget (setq e (ssname ss (setq i (1+ i))))))  (while (/= (Dxf 0 Edata) "SEQEND")     (if       (and         (= (Dxf 0 Edata) "ATTRIB")         (member (dxf 2 Edata) TagList)         ;;if tag is on list          ) ;and        (progn          (setq TagRow (cons (Dxf 2 Edata) TagRow))          (setq valRow (cons (Dxf 1 Edata) ValRow))          ) ;progn)     (setq Edata (entget (setq e (entnext e))))     ) ;while(setq vallist (cons valrow vallist))) ;repeat );defun (defun runputexcel (/ TAGROW VALROW EDATA E I SS TAGLIST TEMPLIST REVLIST vallist)(if @dupeslist(setq @dupeslist nil))(setq TagList '("TAG00" "TAG10"))(setq ss (ssget "_X" (list (cons 0 "INSERT")(cons 2 "CE001,CE007,CE013,CE023,CE021"))))(setq i -1)(if(setq *ExcelApp% (vlax-get-or-create-object "Excel.Application"))(createvallist ss)(princ "\nMust have Instrument Index Excel file open to continue."));if(foreach sublist vallist (setq templist (list (vl-string-trim " " (car sublist)) (vl-string-trim " " (cadr sublist)))) (if (not (equal templist '("" ""))); had other than space(s)-only content   (setq revlist (cons templist revlist)) ); if); foreach(setq vallist (reverse revlist))(setq revlist nil)(setq @dupeslist (reverse (lm:listdupes vallist)))items(princ)(if vallist(putexcells vallist @dupeslist));if;(setq @dupeslist nil)(princ));defun;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DCL coding(defun c:MyToggles (/ Dcl_Id% Radio1$ Radio2$ Radio3$ Radio4$ Return# ptx pty *error*)  (princ "\nGetExcel...")(princ)(defun closeout ( / ) (vlax-invoke-method (vlax-get-property *ExcelApp% "ActiveWorkbook") 'Close :vlax-False) (vlax-invoke-method *ExcelApp% 'Quit) (vlax-release-object *ExcelApp%)(gc) (setq *ExcelApp% nil *ExcelFile$ nil) );defun closeout(defun MyExit (msg)(cond  ((not msg)) ; no error, normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ;  or (quit) ((princ (strcat "\nError: " msg)))) ; error, display it (closeout)(princ));defun(setq *error* MyExit);;;;;;;;;;;; Set Default Variables(if (not *MyRadios@)        (setq *MyRadios@ (list nil "1" "0" "1" )))   ;if    (if (not @excel_row)      ;start excel row   (setq @excel_row "8"))     ;if (if (not @excel_col)      ;start excel col   (setq @excel_col "A"))     ;if (if (not @excel_file)      ;start excel file name   (setq @excel_file       "Y:\\bhull\\_LispBox\\_In_Works\\213035-INST-IND-00000001-00.xls"             ));if(setq Radio1$ (nth 1 *MyRadios@)     Radio2$ (nth 2 *MyRadios@)     Radio3$ (nth 3 *MyRadios@)  newfile T ptx "8"       pty "A") (setq *ExcelApp% (vlax-get-or-create-object "Excel.Application"))    (if (not (setq Dcl_Id% (load_dialog "GetExcel.dcl")))      (progn   (princ "\nDCL file not loaded. Notify Brandon Hull.")   (exit)   );progn     (progn(if (not (new_dialog "GetExcel" Dcl_Id%))     (progn     (princ "\nThe DCL file failed to load.")     (exit)     );progn )));dialog default setup   ; Set Dialog Initial Settings  (set_tile "Title" "GetExcel - AutoCAD to Excel for Instrument Index")  (set_tile "Dir" @excel_file)  (set_tile "eb1" @excel_row)  (set_tile "eb2" @excel_col)  (set_tile "dir" @excel_file)  (mode_tile "eb1" 2)  (mode_tile "eb1" 3)  (set_tile "Rad101" "1")  (set_tile "Rad102" "0")  (set_tile "Rad103" "1")  (if (= (get_tile "Rad100") "Rad101")(mode_tile "But102" 1) );if   ; Dialog Actions  (action_tile "Rad101" "(mode_tile "But102" 1)")   (action_tile "eb1" "(setq ptx (atoi $value))")  (action_tile "eb2" "(setq pty (atoi $value))")  (action_tile "dir" "(setq @excel_file (atoi $value))")  (action_tile "accept" (strcat"(progn(setq @Excel_COL (get_tile "eb2"))""(setq @Excel_ROW (get_tile "eb1"))"" (done_dialog 1))");strcat);action tile  (action_tile "cancel" "(done_dialog 0)(setq result nil)")  (action_tile "But102" "(GET_CURRENT_STATE)(done_dialog 4)")  (action_tile "Browse" "(folderdia)(done_dialog 5)")  (action_tile "Rad102" "(mode_tile "Rad103" 0)(setq appendfile T)(setq newfile nil)")   (action_tile "Rad103" "(mode_tile "Rad102" 0)(setq newfile T)(setq appendfile nil)")  (setq Return# (start_dialog))   ; Unload Dialog  (unload_dialog Dcl_Id%)  (setq *MyRadios@ (list nil Radio1$ Radio2$ Radio3$))  (setq *start_excel@ (list nil ptx pty))(cond((= return# 0)(exit))((= return# 1)(checktype))((= return# 4)(getexcelblocks))((= return# 5)(putex @excel_file)));cond  (princ));defun c:MyToggles (princ);;;;;;;(defun checktype ()(cond ((= appendfile t)(runputexcel))  ;cond1 ((= newfile t)(C:putex))    ;cond2);cond);defun;;;;;;;;(princ "\nSelect Instruments:")(setq ss (ssget "_X" (list (cons 0 "INSERT"))))(if ss    (runputexcel ss)    (princ "\nSelected Items are not blocks."));if(princ));defun(princ)
 
and the most pertinent portion right here:
  1. (defun c:MyToggles (/ Dcl_Id% Radio1$ Radio2$ Radio3$ Radio4$ Return# ptx pty *error*)  (princ "\nGetExcel...")(princ)(defun closeout ( / ) (vlax-invoke-method (vlax-get-property *ExcelApp% "ActiveWorkbook") 'Close :vlax-False) (vlax-invoke-method *ExcelApp% 'Quit) (vlax-release-object *ExcelApp%)(gc) (setq *ExcelApp% nil *ExcelFile$ nil) );defun closeout(defun MyExit (msg)(cond  ((not msg)) ; no error, normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ;  or (quit) ((princ (strcat "\nError: " msg)))) ; error, display it (closeout)(princ));defun(setq *error* MyExit);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Set Default Variables(if (not *MyRadios@)      ;Unique global variable name to store dialog info   (setq *MyRadios@ (list nil "1" "0" "1" )))   ;if    (if (not @excel_row)      ;start excel row   (setq @excel_row "8"))     ;if (if (not @excel_col)      ;start excel col   (setq @excel_col "A"))     ;if (if (not @excel_file)      ;start excel file name   (setq @excel_file       "Y:\\bhull\\_LispBox\\_In_Works\\213035-INST-IND-00000001-00.xls"             ));if(setq Radio1$ (nth 1 *MyRadios@)     Radio2$ (nth 2 *MyRadios@)     Radio3$ (nth 3 *MyRadios@)  newfile T ptx "8"       pty "A") (setq *ExcelApp% (vlax-get-or-create-object "Excel.Application"))  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Done Set Default Variables  (if (not (setq Dcl_Id% (load_dialog "GetExcel.dcl")))      (progn   (princ "\nDCL file not loaded. Notify Brandon Hull.")   (exit)   );progn     (progn(if (not (new_dialog "GetExcel" Dcl_Id%))     (progn     (princ "\nThe DCL file failed to load.")     (exit)     );progn )));dialog default setup   ; Set Dialog Initial Settings  (set_tile "Title" "GetExcel - AutoCAD to Excel for Instrument Index")  (set_tile "Dir" @excel_file)  (set_tile "eb1" @excel_row)  (set_tile "eb2" @excel_col)  (set_tile "dir" @excel_file)  (mode_tile "eb1" 2)  (mode_tile "eb1" 3)  (set_tile "Rad101" "1")  (set_tile "Rad102" "0")  (set_tile "Rad103" "1")  (if (= (get_tile "Rad100") "Rad101")(mode_tile "But102" 1) );if   ; Dialog Actions  (action_tile "Rad101" "(mode_tile "But102" 1)")   (action_tile "eb1" "(setq ptx (atoi $value))")  (action_tile "eb2" "(setq pty (atoi $value))")  (action_tile "dir" "(setq @excel_file (atoi $value))")  (action_tile "accept" (strcat"(progn(setq @Excel_COL (get_tile "eb2"))""(setq @Excel_ROW (get_tile "eb1"))"" (done_dialog 1))");strcat);action tile  (action_tile "cancel" "(done_dialog 0)(setq result nil)")  (action_tile "But102" "(GET_CURRENT_STATE)(done_dialog 4)")  (action_tile "Browse" "(folderdia)(done_dialog 5)")  (action_tile "Rad102" "(mode_tile "Rad103" 0)(setq appendfile T)(setq newfile nil)")   (action_tile "Rad103" "(mode_tile "Rad102" 0)(setq newfile T)(setq appendfile nil)")  (setq Return# (start_dialog))   ; Unload Dialog  (unload_dialog Dcl_Id%)  (setq *MyRadios@ (list nil Radio1$ Radio2$ Radio3$))  (setq *start_excel@ (list nil ptx pty))(cond((= return# 0)(exit))((= return# 1)(checktype))((= return# 4)(getexcelblocks))((= return# 5)(putex @excel_file)));cond  (princ));defun c:MyToggles (princ);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;checktype subfunction;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(defun checktype ()(cond ((= appendfile t)(runputexcel))  ;cond1 ((= newfile t)(C:putex))    ;cond2);cond);defun;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;pick blocks subfunction;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(defun getexcelblocks (/)(princ "\nSelect Instruments:")(setq ss (ssget "_X" (list (cons 0 "INSERT"))))(if ss    (runputexcel ss)    (princ "\nSelected Items are not blocks."));if(princ));defun
 
So I'm setting up the default as
(setq newfile T)
which, in turn, runs the Putex subfunction, which uses the (openExcel) function to open the excel file. This runs fine, but I'm not sure why I am getting the error if they do not first toggle the radio choices.
 
Please help and thank you, please offer any advise with my routine/application.
回复

使用道具 举报

15

主题

243

帖子

228

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-5 23:33:11 | 显示全部楼层
How would I construct a statement that reads:
 
(if   (not (and ;the following variables do not have a value set to them; Appendfile Newfile,
(setq newfile T);
 
So if the following variables do not have a value set to them then set the value of newfile to be true.
 
I just don't know how to construct an (if (not (and statement to check two vars....as well as why i'm getting that error that goes away simply by toggling the same button that should be already selected....pls help
Thank you
回复

使用道具 举报

1

主题

116

帖子

115

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 23:45:08 | 显示全部楼层
For your second question.
(if (not (and... would perform the task if either one of Appendfile or Newfile returned nil.
 
But if I understand correctly you want to perform the task only when both symbols return nil?
 
"Are both of them nil?"
  1. (if (and (null Appendfile) (null Newfile)) (setq newfile T))
which effectively is the same as "Are neither of them True?"
  1. (if (not (or Appendfile Newfile)) (setq newfile T))
回复

使用道具 举报

15

主题

243

帖子

228

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-5 23:52:58 | 显示全部楼层
Thank you Clint!
回复

使用道具 举报

1

主题

116

帖子

115

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 23:57:50 | 显示全部楼层
Brandon, I've been having a look at the code to see if I can spot the problem. It would be easier if I had the DCL file as well, because I'm having to guess which of the key names represent the radio buttons you speak of.
 
I currently assume that the radio buttons are "Rad102" and "Rad103"? The one thing I have noticed is that you haven't localised the variables 'appendfile' & 'newfile'.
As such the symbol 'appendfile' would be maintaining its value from the last time you ran the function. You are setting 'newfile' to T each time you run the function, but only using the radio buttons sets 'appendfile' to be the compliment of 'newfile' (T & nil respectively).
Since 'appendfile' appears to not be localised, you could have both variables equal to True when you exit the dialog box.
回复

使用道具 举报

15

主题

243

帖子

228

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 00:03:48 | 显示全部楼层
Yes Exactly Clint, that is part of the issue I am having.
Here, let me post the DCL
As well as a dwg that has the blocks so you can see how the app works.
Thank you for your help with this, you know how it is when you look at something for weeks on end, it can be hard to spot the obvious!
Anyways, here's the DCl
  1. //---------------------------------------------------------------------------------------------------------// MyToggles//--------------------------------------------------------------------------------------------------------- GetExcel : dialog {  key = "Title";  label = "";//Title$ from lsp file  spacer;     : boxed_row { label = "Parameters"; width = 30; height = 4; fixed_width = false;    : row { label = "Block Selection" ; fixed_width = false; alignment = left; width = 50 ;: row { alignment = top; height = 1; spacer;}: radio_button { key = "Rad101"; label = "*ALL* Blocks"; alignment = middle; }: button { label = "Pick Blocks>>"; key = "But102"; width = 12; fixed_width = true; alignment = middle; mnemonic = "P"; }: spacer { width= 5.0; height = 1.0;}}: column { alignment = right; fixed_width = true; label = "Excel Options";: column { : spacer { width = 2.0; } }: edit_box { key = "eb1"; alignment = top ; label = "&Starting Row:     "; width = 4; fixed_width = true; } : edit_box { key = "eb2"; alignment = top ; label = "&Starting Column:"; width = 4; fixed_width = true; }}}//   :spacer {height=1.0;}   : boxed_row { width = 50; fixed_width = true; label = "File Options";: row { label = "Excel File Location" ; fixed_width = true; width = 50; spacer;: spacer { width= 5.0; height = 1.0;}: edit_box { key = "Dir" ; edit_width = 55 ; fixed_width = true; edit_limit = 256 ; alignment = left ; } : button { key = "Browse" ; label = "Browse>>" ; mnemonic = "B" ; width = 15 ; alignment = middle ; }       } : column { label = "File Status" ; width = 15;: radio_button { key = "Rad102"; label = "Append (Following)"; }   : radio_button { key = "Rad103"; label = "New (Leading)"; }     }}  spacer;  ok_cancel;}//MyToggles
 
Alright now let me explain what I'm attempting to have happen with this app:
So, depending on the users needs they will either be creating an excel file (from a template) if "New" is selected. This will cause the @excel_row variable to start at "1" on cell A8 (8 because of a header, this is editable in the DCL as an edit box field). So, if it's a new excel sheet and they run the program, it will fill out starting at row 8, and go all the way down, counting each line as it does so. This means that the last item will end on a line that is 8 spots further than the "count" (or itemdata as it's called in the code).
 
So, they've ran it once from "new" and they end up on row 100 showing 92 items, so column A will show "92" (the running count).
This is where the problems come in.
So after they've done a new sheet, now they've opened up the next drawing in cad and are ready to append the excel file with the new dwg attribute information.
They can enter into the DCL the last line used, i.e. the furthest-most-left column, the row counter not the running-total-item-counter that is itemdata.
So as per our example, they enter "100" in the row edit box in the DCl, and execute the routine.
I need it to continue inputting data, starting with line 101 (because it ended on line 100), but it must pick up the running total i.e. 93 will go into row 101...
I hope this accurately and effectively describes the situation and issue i'm having with it.
I've tried a few things and there's nothing that I can think of at this moment that must be a certain way, I'm just trying to get it to work correctly as I described above so please don't think my methodology in the code is how it must be coded....just, looking for code that will do what I need it to do...feel that i'm very close....just having a few issues.
Thanks again Clint!
回复

使用道具 举报

1

主题

116

帖子

115

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 00:12:07 | 显示全部楼层
Happy to help Brandon, and indeed I do know how it can be when you look at something for a long time!!
 
Thanks for the DCL file. That certainly helps. I still can't run the program to help with "runtime" debugging as there are sub-functions unavailable to me (eg. string_, putcell, lm:listdupes,openexcel)... So any assistance I can give requires me to try following the flow of the code, and I'm a bit pushed for time at the moment. But I'll do what I can.
 
In answer to your last question, can you not use the row number (@excel_row) as your only reference for counting and always insert the number (- @excel_row  at each row? If you did that wouldn't it be the same whether the spreadsheet is new or being appended to?
 
Two other things I've seen worth commenting on. The 'load_dialog' function returns a positive integer value if successful, negative if unsuccessful. Hence
  1. (< (setq Dcl_Id% (load_dialog "GetExcel.dcl")) 0)
would be a better test for failure than
  1. (not (setq Dcl_Id% (load_dialog "GetExcel.dcl")))
And while I could be missing something with the cursory running through the code that I've done, isn't @excel_file a string value (name of file)? atoi?
  1. (action_tile "dir" "(setq @excel_file (atoi $value))")
回复

使用道具 举报

15

主题

243

帖子

228

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 00:21:48 | 显示全部楼层
Clint, can you PM me your email addr?
That way I can send you all of the files in order for you to be able to see this program work?
The cadtutor forums do not allow me to upload any items larger than a few kb, such as dwg files.
Also the 15000 character limit for forum posts really caused me to trim down the routine, as such i'd like to be able to send it to you in full.
回复

使用道具 举报

15

主题

243

帖子

228

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 00:26:22 | 显示全部楼层
And hey, I was able to get the subfunction to work properly, via this method:
  1. (defun doitem ( vallist / itemcell itemdata c)(setq c 0)(setq len (length vallist))(setq itemcell (strcat "A" @excel_row))(setq itemcell (string_ itemcell))(cond((= appendfile T)(setq itemdata (vl-bb-ref 'lastitem)))((and (= newfile T)(= @excel_row "8"))(setq itemdata "0")));cond(if (= @excel_row "8")(setq itemdata "0"));if(repeat len(setq itemdata (string_ itemdata))(putcell itemcell itemdata)(setq itemcell (string_ itemcell))(setq c (1+ c))(vl-bb-set 'lastitem itemdata));repeat(if (= c len)(dotype vallist));;goto type subfunction);defun doitem
 
Using the vl-bb-set/ref to store the lastitem.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 00:19 , Processed in 0.390640 second(s), 70 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表