Small Fish 发表于 2022-7-6 12:14:20

'Uber' Gatte

hi
I am trying to write some code that applies the ATTIN command across all tabs in a drawing. It cycles through the tabs but I can not seem to make the path (TextFile) work with ATTIN command. Any ideas what needs to change?
Thanks
 

(defun c:UberGatte(/ TextFile OldFld LayList)(setq OldFld (getvar "filedia"))(setvar "filedia" 0)(setq TextFile(dos_getfiled "Select a Text file for global attributes edit"       "C:\\Documents and Settings\\rxbeeto0\\Temp\\"       "Text files (*.txt)|*.txt|All files (*.*)|*.*||"))(setq LayList (layoutlist))(foreach Ln LayList(setvar "CTAB" Ln)(command "ATTIN" TextFile ));foreach(setvar "filedia" OldFld)(princ));defun

BIGAL 发表于 2022-7-6 12:19:54

I can not find info on ATTIN ? but I think I know the answer to your problem
 
C:\\Documents and Settings
 
Once the directory path has a space in it the file name stops try a new path without spaces (underscores etc are ok). I had to use a bit of vba code within lisps to get round this problem. If Autodesk is listening it may be a bug in the software.

alanjt 发表于 2022-7-6 12:25:06

Attin is an Express Tools' Lisp Routine. I cannot be called with (command "attin")

alanjt 发表于 2022-7-6 12:29:30

Really? I've never experienced that problem.

Small Fish 发表于 2022-7-6 12:30:38

BigAl Thanks
No- that does not work. eg I tried C:\\Temp\\ and I still have the same problem.
There is info regarding ATTIN command. You need to go to express tools and then HELP.
As ATTIN is not compiled I could edit the file but I am not really sure how to.
Perhaps someone could help me?

Small Fish 发表于 2022-7-6 12:37:36

Hi Alanjt - So if I can not use (command "ATTIN" ....
then what do I use?

alanjt 发表于 2022-7-6 12:41:35

 
 
Have to do a little research and get a little creative:
 
Completely untested, since I know nothing about AttIn.
 

(defun c:UberGatte (/ TextFile) (and   (or bns_attin (load (findfile "attout.lsp") nil))   (setq TextFile (getfiled "Select a Text file for global attributes edit"                            "C:\\Documents and Settings\\rxbeeto0\\Temp\\"                            "txt;*"                            8                  ) ;_ getfiled   ) ;_ setq   (foreach Ln (layoutlist)   (setvar "CTAB" Ln)   (if (equal 4 (logand 4 (getvar "cmdactive")))       (bns_attin TextFile nil) ;a script is running so no interactive placement       (bns_attin TextFile T) ;Allow interactive placement   ) ;_ if   ) ;_ foreach ) ;_ and (princ)) ;_ defunI hope you don't mind, I did a little reworking on your code. BTW, you can use getfiled when only needing to select 1 file and avoid relying on dos_lib.

Small Fish 发表于 2022-7-6 12:43:20

Thanks! Alan you are pure genius!!
Just wondering what the function bns_attin does and how it does work?

alanjt 发表于 2022-7-6 12:49:03

 
It's just the subroutine that performs all the functions that AttIn facilitates.
 
Did it work?

alanjt 发表于 2022-7-6 12:50:24

I updated the code to check for existence/load AttOut.lsp before file selection. That way, it will exit if it can't find the file. Sorry, wasn't thinking clearly.
页: [1] 2
查看完整版本: 'Uber' Gatte