Jump to content

How to open a password protected drawing via Visual LISP?


Ahankhah

Recommended Posts

CADTutorians,

 

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

Link to comment
Share on other sites

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • Ahankhah

    8

  • ReMark

    5

  • MarcoW

    2

  • hanhphuc

    2

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Lee,

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

: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 :(

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 7 months later...

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.

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