sketch11 Posted October 10, 2020 Posted October 10, 2020 Hi, please see amended code and list. (setq tx1 "C:\\Drawing Conversion\\List.txt" ; File holding a list of MicroStation drawings to be imported tx2 "C:\\Drawing Conversion\\In\\" ; Input folder tx3 "C:\\Drawing Conversion\\Out\\" ; Output folder tx4 "Default" ; Drawing model name ) List.txt Quote
BIGAL Posted October 10, 2020 Posted October 10, 2020 Just a comment you have 3 blank lines at end of file either remove or check if blank. Quote
sketch11 Posted October 11, 2020 Posted October 11, 2020 Yes, I did notice that. It didn't seem to have any effect on the outcome when I tested prior to posting. Now that I've used the LISP routine more, it has about a 3/4 success rate. Some batches have converted at 90%, some at close to 50%. It's beyond my understanding but as a guess, the nature of the reference files maybe one aspect to it. Quote
pkenewell Posted October 12, 2020 Posted October 12, 2020 (edited) Hi Sketch11. Thanks for the file list. I cannot see how your program is failing. Perhaps it is the files you are converting - I can't be certain. I have tested it on my end and it seems to work well for me. However - I don't have a huge amount of dgn files to test. NOTE: This program relies heavily on the order of command sequences. I suggest you try to open one of the files it failed on. Then perform each command in the program manually and note if there are any changes to the prompts. You could do this easily by opening the dgn file, the copying each (command...) string from the program 1 at a time and see if there are any errors or invalid responses. There might be an additional prompts based on some circumstance that happens with the files that are failing! As BIGAL said - you should remove the extra blank lines from the file. It may not effect the processing, but the program would possibly not end cleanly leave behind un reset system variables and undo marks. Edited October 12, 2020 by pkenewell 1 Quote
BIGAL Posted October 12, 2020 Posted October 12, 2020 You can trap the error as often done in code, but more importantly you can look at the actual error message so could run a defun to possibly keep going answering more questions as suggested by pekenewell. Maybe add a on error use "alert" to see file name so can tell which one is crashing if its not obvious. Quote
sketch11 Posted October 13, 2020 Posted October 13, 2020 OK thanks, I'll bear that in mind. I don't know anything about error messages or trapping errors so if you have a code snippet, please send. It would be a bonus, as I was happy enough with partial conversion, the remainder I did manually one by one. Quote
pkenewell Posted October 13, 2020 Posted October 13, 2020 Did you try this? Since I cannot adequately test it. If you tell me the results of this, I might have been able to give you options for the code. Alternatively, You could send me a sample of the files giving you problems and I could test it. 22 hours ago, pkenewell said: NOTE: This program relies heavily on the order of command sequences. I suggest you try to open one of the files it failed on. Then perform each command in the program manually and note if there are any changes to the prompts. You could do this easily by opening the dgn file, the copying each (command...) string from the program 1 at a time and see if there are any errors or invalid responses. There might be an additional prompts based on some circumstance that happens with the files that are failing! Quote
sketch11 Posted October 14, 2020 Posted October 14, 2020 Thanks for looking into. It's hard to document what's going on. - AutoCAD closes automatically after conversion so I can't read error messages (except for error noted below). - After running the code on 30+ drawings, it converted 1/2 to 2/3. On the next try, after amending the list to include those not converted, another part of the remaining batch was converted. After 4 iterations I was left with 3 drawings. The error message is shown below (AutoCAD did not close). It's hard to tell if a specific drawing is the problem. Before posting originally I changed the "DELAY" to 5000ms (from 1000ms) but no luck. I couldn't message you to send the file as I had the message "You are only allowed to send 0 messages per day. Please try again later." Specify conversion units [Master/Sub] <Master>: Specify mapping setup or [?] <Standard>: _ZOOM _ZOOM not found. Specify mapping setup or [?] <Standard>: _E _E not found. Specify mapping setup or [?] <Standard>: ._DELAY ._DELAY not found. Specify mapping setup or [?] <Standard>: 1000 1000 not found. Specify mapping setup or [?] <Standard>: _SAVEAS _SAVEAS not found. Specify mapping setup or [?] <Standard>: 2007(LT2007) 2007(LT2007) not found. Specify mapping setup or [?] <Standard>: C:\Drawing Conversion\Out\D112-M-832 C:\Drawing Conversion\Out\D112-M-832 not found. Specify mapping setup or [?] <Standard>: _UNDO _UNDO not found. Specify mapping setup or [?] <Standard>: _BACK _BACK not found. Specify mapping setup or [?] <Standard>: _QUIT _QUIT not found. Specify mapping setup or [?] <Standard>: _Y _Y not found. Specify mapping setup or [?] <Standard>: Specify mapping setup or [?] <Standard>: *Cancel* Quote
BIGAL Posted October 14, 2020 Posted October 14, 2020 (edited) Change this it will stop and ask you to continue but can see the current file name. (setq fil (open tx1 "r") tx5 (read-line fil)) (alert (strcat "Got tp file " tx5)) something in this is not working "_-DGNIMPORT" (strcat tx2 tx5) tx4 "" "" Edited October 14, 2020 by BIGAL Quote
pkenewell Posted October 14, 2020 Posted October 14, 2020 13 hours ago, sketch11 said: Thanks for looking into. It's hard to document what's going on. - AutoCAD closes automatically after conversion so I can't read error messages (except for error noted below). - After running the code on 30+ drawings, it converted 1/2 to 2/3. On the next try, after amending the list to include those not converted, another part of the remaining batch was converted. After 4 iterations I was left with 3 drawings. The error message is shown below (AutoCAD did not close). It's hard to tell if a specific drawing is the problem. Before posting originally I changed the "DELAY" to 5000ms (from 1000ms) but no luck. I couldn't message you to send the file as I had the message "You are only allowed to send 0 messages per day. Please try again later." Specify conversion units [Master/Sub] <Master>: Specify mapping setup or [?] <Standard>: _ZOOM _ZOOM not found. Specify mapping setup or [?] <Standard>: _E _E not found. Specify mapping setup or [?] <Standard>: ._DELAY ._DELAY not found. Specify mapping setup or [?] <Standard>: 1000 1000 not found. Specify mapping setup or [?] <Standard>: _SAVEAS _SAVEAS not found. Specify mapping setup or [?] <Standard>: 2007(LT2007) 2007(LT2007) not found. Specify mapping setup or [?] <Standard>: C:\Drawing Conversion\Out\D112-M-832 C:\Drawing Conversion\Out\D112-M-832 not found. Specify mapping setup or [?] <Standard>: _UNDO _UNDO not found. Specify mapping setup or [?] <Standard>: _BACK _BACK not found. Specify mapping setup or [?] <Standard>: _QUIT _QUIT not found. Specify mapping setup or [?] <Standard>: _Y _Y not found. Specify mapping setup or [?] <Standard>: Specify mapping setup or [?] <Standard>: *Cancel* @sketch11 The problem is definitely in the command sequence. There is an extra prompt that is not being accounted for. As I said - All you have to do is open one of the troubled files MANUALLY, and perform the "-DGNIMPORT" command MANUALLY to determine what prompting in the command is different! It is certain from the feed you just sent that the prompt that is not being accounted for is "Specify mapping setup or [?] <Standard>:". If you can determine why it is asking this on some files and not on others, you have the answer and we can figure out a contingency for it. 1 Quote
pkenewell Posted October 14, 2020 Posted October 14, 2020 (edited) @sketch11 Shot in the dark - try changing: (command "_UNDO" "_MARK" "_-DGNIMPORT" (strcat tx2 tx5) tx4 "" "" "_ZOOM" "_E" "._DELAY" 1000 "_SAVEAS" "2013(LT2013)" (strcat tx3 tx5) "_UNDO" "_BACK" ) to (command "_UNDO" "_MARK" "_-DGNIMPORT" (strcat tx2 tx5) tx4 "" "" ) (while (= (logand (getvar "cmdactive") 1) 1) (command "")) (command "_ZOOM" "_E" "._DELAY" 1000 "_SAVEAS" "2013(LT2013)" (strcat tx3 tx5) "_UNDO" "_BACK" ) Let me know if this works. Edited October 14, 2020 by pkenewell 1 Quote
maratovich Posted October 14, 2020 Posted October 14, 2020 Try using this: AutoImportCADMaybe it will be convenient. Quote
sketch11 Posted October 15, 2020 Posted October 15, 2020 pkenewell, I can't believe it but it works. I tested it on 33 drawings and all of them converted. I appreciate your efforts on this. 1 Quote
pkenewell Posted October 15, 2020 Posted October 15, 2020 14 hours ago, sketch11 said: pkenewell, I can't believe it but it works. I tested it on 33 drawings and all of them converted. I appreciate your efforts on this. No problem Sketch. I'm glad I could help. Sometimes it's just something simple that's easy to miss. When you posted the output from a failed file it became clear, but I was not sure it any of the extra prompts of the DGNIMPORT command required a response other than <enter>. I took a stab at it and fortunately just entering through the prompts did the trick! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.