Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoCAD VBA - Log-in when drawing is opened..

Status
Not open for further replies.

basepointdesignz

Programmer
Jul 23, 2002
566
GB
Hi peeps,

Before you read the first couple of sentences and assume this should go in the VBA forum, this question is about VBA for AutoCAD, and I wondered if anyone could help me. I'm posting this thread on the VBA (Microsoft) forum too..

I have a template for my survey drawing at work and from this I draw all the drawings for our customers. Want I'm itching to do is set up a VBA program that will allow me or my boss only to 'log-in' to the finished drawings and if the password is incorrect, the drawing becomes Read-Only, so that anyone trying to edit or tamper with the drawings won't be able to and able to save it over the original if they do.. Obviously, if they log-in correctly, the drawing opens up as normal and not Read-Only..

I want the log-in form to occur when the drawing loads, this way they have to log-in to edit the drawing - if they incorrectly log-in they can still study/review/look at the drawing but they won't be able to change anything..

I tried a little while ago with a log-in form that, if an incorrect log-in occurs, the drawing should close automatically (after showing a message box) but I couldn't get it to close the drawing..

I can do the code for the login form and all the correct IF/Case statements etc. but I don't know how to change the drawing to Read-Only - I've tried searching and asking about but I can't find what I need..

Also, I'm not sure exactly how to have the form load up when the drawing does. When I tried it a while ago I couldn't get the form to load upon start up, I had to manually load the macro. Does anyone know how to do this? I tried loading the program into the start-up suite but it still doesn't do it..

If anyone could give me a push or and help with what I need to know or where to look, I'd be extremely grateful!!

Thanks for listening and thanks, in advance for any help..

Renegade..
 
Hi,
While I have never done this, it appears that you may want to create a reactor so that when a person uses the Open command, they must log in to open certain drawings. You can set the property of the drawing to Read-Only on your network before you open it through the FileSystemObject methods. I hope this helps some.

BU
 
You can try undefining and redefining the OPEN (& SAVE & QSAVE ?) commands.

Write a lisp file that autoloads, that contains something like ...

(command "UNDEFINE" "OPEN")
(vl-vbaload "C:\\acad\\MyFileRoutines.dvb")

(C:OPEN ( / )
(vl-vbarun "MyNewOpen")
(princ)
)

If you need more help, contact me

Nick
nick.hall@altasystems.co.uk
 
Const LoginNameCompare = xyz

DwgName = "C:\Program Files\AutoCAD 2002\MyDrawing.dwg"
If LogInName = LoginNameCompare Then
ThisDrawing.Application.Documents.Open DwgName, False
ElseIf LogInName <> LoginNameCompare Then
ThisDrawing.Application.Documents.Open DwgName, True
End If

Thank you 4 your support

allfro@ev1.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top