Author Topic: Fomatting and Running Script files in ACCORECONSOLE  (Read 289 times)

0 Members and 1 Guest are viewing this topic.

CJ

  • Mosquito
  • Posts: 9
Fomatting and Running Script files in ACCORECONSOLE
« on: April 02, 2024, 12:10:10 PM »
Hello Everyone,  I am attempting to run a script file from ACCORECONSOLE that will remove MAP object data from recently created DXFs.  Since this is a one shot deal (no undo i discovered) I am trying to test the process by simply loading and calling a LISP file that just does a Zoom extents commands and saveas back to a DXF.

The BAT file must be simple as I have to automatically create a new file via LISP when the user calls the main function.  In this case the function is a DXFout that filters and preps the drawing.  The last thing it needs to do is create a script file that targets the DXFs, saved at a different folder location, run the script to open the 2-4 DXFs a ripped object data and finally delete the script file. I am having a couple of issues with this process.

The first is the format of the BAT language:
Code: [Select]
FOR %%f IN (C:\Users\"firstname.lastname"\Desktop\"Testing DWGS"\Projects\2024\0137\"6 - Document Control"\"1 - Project Files"\"2 - DWG & DXF"\*.dxf) DO START /WAIT c:\"Program Files"\Autodesk\"AutoCAD 2022"\accoreconsole.exe /i "%%f" /s C:\Users\firstname.lastname\"OneDrive - Surveys Ltd"\Documents\Projects\LISP\DXFOUT\RemoveOBData.scr /l en-US
When I can get it to stop/crash it seems to truncate some of the folder locations. for example something like C:\Users\firstname.lastname\OneDrive\RemoveOBData.scr.  I do not know the correct format for folder locations with spaces ( I can not avoid this).  I have tried a few variants and nothing seems work better.  My format is almost identical to a demo I seen by Dan Abbott but his worked.

Secondly, when I run the BAT file, little black screens pop up with crazy text and disappears!  Is there any way of debugging a BAT file so that I can step-through to check for errors?

Thanks

JohnK

  • Administrator
  • Seagull
  • Posts: 10651
Re: Fomatting and Running Script files in ACCORECONSOLE
« Reply #1 on: April 02, 2024, 12:24:42 PM »
Who's Dan Abbot?

That bat file will run the script on each file in a directory and launch accoreconsole for each. Not the way I would choose to do this.

Why are you trying to run batch operations from within AutoCAD (why does someone need to start AutoCAD to run a script on a set of files in a directory--you don't open AutoCAD every time you want to make lunch do you)?

...I'd say, talk to Dan because it seems his logic is a bit flawed in a few areas.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CJ

  • Mosquito
  • Posts: 9
Re: Fomatting and Running Script files in ACCORECONSOLE
« Reply #2 on: April 02, 2024, 01:32:41 PM »
Hello John, I am not trying to make lunch.  Not to make my post too wordie I perhaps left out more details than I should have.  The user has opened a working DWG, as required by the client, and the user runs a LISP routine that will filter only line-work and information needed for up to fours different DXFs.  This is an automated process.  I last thing I want the function to do is to strip the attached MAP Object Data from those DXFs.  I can not use the function ade_oddeletetab while in the working DWG because I have learned this action can not be undone.

I can not get AutoLISP to switch different DWGs, jumping from the working DWG to the DXF and then back.

From the reading I have done, ACCORECONSOLE opens as a separate instance of AutoCAD. The script file I am trying to create would use ACCORECONSOLE to run the lisp file.

JohnK

  • Administrator
  • Seagull
  • Posts: 10651
Re: Fomatting and Running Script files in ACCORECONSOLE
« Reply #3 on: April 02, 2024, 02:00:16 PM »
Let me try to get this straight (this sounds very complicated).

1. The drawing (DWG) exists.
2. The drawing exchange file(s) exist (DXF).
3. When you open the DWG, you want to read the DXF and get "layers" to turn on/off in the DWG?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CJ

  • Mosquito
  • Posts: 9
Re: Fomatting and Running Script files in ACCORECONSOLE
« Reply #4 on: April 02, 2024, 03:03:29 PM »
Yes John the DWG exists.  When the client approves of the project they want DXFs sent with the final PDFs.

The user will open the working DWG, does what they need to do to finalize the project.  My other LISP routine gives the user a one button action to create the DWFs but the user must still open each of the the DXFs to remove Object Data.

I had considered saving the DWG as a DXF at first, do what needs to be done to the DWG and then just saving.  This however requires the user to open the same working DWG and do the same thing each time.

I am hoping to be able to create a routine that will open the finished DXFs and remove the extra object data.

BIGAL

  • Swamp Rat
  • Posts: 1419
  • 40 + years of using Autocad
Re: Fomatting and Running Script files in ACCORECONSOLE
« Reply #5 on: April 02, 2024, 06:53:08 PM »
You can save in a sequence to get around your problem.

Save dwg as a DWG do not close !
remove map data
make dwf pdf or what ever else
Save as DXF and close
You now have 2 files.

You still have original dwg if need to do again.
A man who never made a mistake never made anything