Jump to content

Create a .bat with acad.exe, a PostGIS connection and load 3 tables


agmartin

Recommended Posts

Hi,

 

First of all i am quite newbie in AutoCAD.

 

I want to create a .bat file or any executable file which runs "acad.exe", adds a PostGIS Connection, and loads 3 specific tables of the public schema in the postgis database.

 

I need this because i dont want the person that will be executing the file daily,be able to stablish the connection (he doesnt have to know the password for the connection to postgis) and doesnt have to be able to add any other table to the workspace apart from these 3 tables.

 

Regards,

 

Aitor

Link to comment
Share on other sites

You could write a lisp that checks the user ID on normal startup of Acad by adding load "myusergis.lisp" to ACADDOC.lsp and then runs the necessary steps. You can also add to the history list using Appload

 

User name 
(setq whoisit (GETENV "username"))

Link to comment
Share on other sites

Im quite newbie in Autocad and I dont know very well how it works and what do al thoes archives do. Could you extend your explantion so i can get the idea of what you mean?

Link to comment
Share on other sites

Write down all the steps starting with a normal open autocad you then need to create a program to do the same steps, it can be a VBA .net LSP or a script.

 

The code above would be used to check for a user name if match found then run program.

 

Recreate the steps in notepad save as a script file for testing, then post a copy here we can advise further, obviously correct password not required. Once you have it you can add to the "Auto" startup options say acaddoc.lsp to run every time autocad starts.

 

Copy and paste line above (....)) to command line it should return your login name.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...