Jump to content
Ahankhah

How to open a password protected drawing via Visual LISP?

Recommended Posts

Ahankhah

CADTutorians,

 

Does anyone know whether it is possible to open a password protected drawing via Visual LISP, and for positive answer how?

Share this post


Link to post
Share on other sites
MSasu

This may do the trick:

 

(setq theDocsObj (vla-get-documents (vlax-get-acad-object)))
(vla-activate (vla-open theDocsObj MyFileName :vlax-false MyPassword))

 

Regards,

Mircea

Share this post


Link to post
Share on other sites
Ahankhah

Excellent Mircea:).

Thanks a lot:D.

Share this post


Link to post
Share on other sites
MarcoW

Just hopping in, can you give me an example how to protect and unprotect a drawing? I am curious how it works.

Thanks in advance!

Share this post


Link to post
Share on other sites
Ahankhah
Just hopping in, can you give me an example how to protect and unprotect a drawing? I am curious how it works.

Thanks in advance!

1- Issue SAVEAS command

2- In the Save Drawing As dialog, open Tools menu in the upper right of the window.

3- Select Security Options... item.

4- In the new dialog, under the Password tab, you can set, change, or remove password for the current drawing.

Share this post


Link to post
Share on other sites
ReMark

All that really does is prevent someone from opening a drawing. It does not prevent a person from editing a drawing once it is opened. Don't forget the password either as there is no means to brute force the drawing open.

Share this post


Link to post
Share on other sites
MarcoW

Thanks, I did not realize it was that kind of protection, like in word and excel.

I have no intentions to use this however. Thanks again for the explaining!

Share this post


Link to post
Share on other sites
Ahankhah
All that really does is prevent someone from opening a drawing. It does not prevent a person from editing a drawing once it is opened. Don't forget the password either as there is no means to brute force the drawing open.

 

Thanks, I did not realize it was that kind of protection, like in word and excel.

I have no intentions to use this however. Thanks again for the explaining!

 

Assume that you have a protected dwg file containing some blocks, hatches, linetypes, etc. and you want to use them just by your program. It is a good way to do the task. So you don't need to enclose *.pat or *.lin with your program... :wink:

 

But one thing is remaining. How is it possible to insert a protected .DWG file into another drawing?

Share this post


Link to post
Share on other sites
ReMark

You want to password protect a drawing then insert it into another drawing? Why? Would good would that be?

Share this post


Link to post
Share on other sites
Ahankhah
You want to password protect a drawing then insert it into another drawing? Why? Would good would that be?

I want to use some encrypted info in it.

Share this post


Link to post
Share on other sites
Lee Mac

Regarding password protection, this object may be of interest :wink::

 

(defun c:test ( / acsec )
 (vl-catch-all-apply
   (function
     (lambda nil
       (setq acsec
         (vla-getinterfaceobject (vlax-get-acad-object)
           (strcat "AutoCAD.SecurityParams." (itoa (atoi (getvar 'ACADVER))))
         )
       )
       (vlax-dump-object acsec t)
     )
   )
 )
 (if acsec (vlax-release-object acsec))
 (princ)
)

Share this post


Link to post
Share on other sites
Ahankhah

Lee,

:unsure:I didn't find any difference between dumped info about password protected and password free drawings:?.

Share this post


Link to post
Share on other sites
ketxu
Regarding password protection, this object may be of interest :wink::

 

(defun c:test ( / acsec )
 (vl-catch-all-apply
   (function
     (lambda nil
       (setq acsec
         (vla-getinterfaceobject (vlax-get-acad-object)
           (strcat "AutoCAD.SecurityParams." (itoa (atoi (getvar 'ACADVER))))
         )
       )
       (vlax-dump-object acsec t)
     )
   )
 )
 (if acsec (vlax-release-object acsec))
 (princ)
)

 

Oh Lee, i didn't find what difference between before and after lock password..

And can you tell me how to auto set protect password by Lisp (same way goto Option ....)

Share this post


Link to post
Share on other sites
Lee Mac
:unsure:I didn't find any difference between dumped info about password protected and password free drawings:?.

 

Oh Lee, i didn't find what difference between before and after lock password..

 

I probably should've fully tested the code before posting - it appears the security parameters can't be retrieved that way :(

Share this post


Link to post
Share on other sites
ReMark

You're entirely welcomed. Did you actually test it out?

Share this post


Link to post
Share on other sites
Ahankhah
You're entirely welcomed. Did you actually test it out?

Yes ReMark, it works nicely.

... But, to be honest, I have written a program to explode unnamed and minserted blocks. I hope I can find it and sent to forum.

Share this post


Link to post
Share on other sites
kristinbennett1911

hi

 

It may be caused by entering wrong password.

so try to enter right password may your document will open.If you don't know the right password the you install ms office password recovery software.This software gives u to right password of document then you will open your document in easy way.

Share this post


Link to post
Share on other sites
ReMark

How does using a password recovery program meant for MS Office help the OP open a password protected drawing created in AutoCAD?

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...