Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: How to get the number of opening drawing and its name in Lisp ?

  1. #1
    Member
    Join Date
    2008-11
    Posts
    23

    Default How to get the number of opening drawing and its name in Lisp ?

    Hi,

    I want to ask here:

    1. How can I create a new drawing with a name instead of the default name, "drawing1", "drawing2", ...
    2. Where I can get the total number of the drawings openned actually and how to get their name by lisp rouine ?

    Thanks

    Felix

  2. #2
    Certified AUGI Addict rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Houston
    Posts
    7,519

    Default Re: How to get the number of opening drawing and its name in Lisp ?

    1. Save the drawing with the desired name right after you create it.

    2.
    Code:
    
    
    (vl-load-com)
    (setq *doc* (vla-get-Documents (vlax-get-acad-object)))
    ;;; next line returns document count
    (vla-get-Count *doc*)
    ;;; next line echoes each document name to the command line
    (vlax-for d *doc* (princ (strcat "\n" (vla-get-Name d))))
    
    

  3. #3
    Member
    Join Date
    2008-11
    Posts
    23

    Default Re: How to get the number of opening drawing and its name in Lisp ?

    Thanks.

    It works very well.

    Thanks again !

  4. #4
    AUGI Addict
    Join Date
    2006-04
    Location
    (0,0,+|Z|)
    Posts
    1,119

    Default Re: How to get the number of opening drawing and its name in Lisp ?

    Quote Originally Posted by rkmcswain View Post
    1. Save the drawing with the desired name right after you create it.

    2.
    Code:
    
    
    (vl-load-com)
    (setq *doc* (vla-get-Documents (vlax-get-acad-object)))
    ;;; next line returns document count
    (vla-get-Count *doc*)
    ;;; next line echoes each document name to the command line
    (vlax-for d *doc* (princ (strcat "\n" (vla-get-Name d))))
    
    
    Sorry, I might change the subject - from the dwg name inquiry to dwg identification.

    Could LISP also be able to identify the person who created/modified the drawing?
    If so, how?

    Thanks.

  5. #5
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: How to get the number of opening drawing and its name in Lisp ?

    From the document object, you obtain the SummaryInfo object, which has a LastSavedBy property. E.g.
    Code:
    (vl-load-com)
    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ;Get the current drawing
    (setq si (vla-get-SummaryInfo doc)) ;Get the summary info object
    (princ "Last saved by: ")
    (princ (vla-get-LastSavedBy si)) ;Prints login name of user last saved
    I don't know how you'll get the creator, unless he's saved his name manually (File --> Drawing Properties), or through a custom lisp, to something like the Author property of the SummaryInfo object.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  6. #6
    AUGI Addict
    Join Date
    2006-04
    Location
    (0,0,+|Z|)
    Posts
    1,119

    Default Re: How to get the number of opening drawing and its name in Lisp ?

    Quote Originally Posted by irneb View Post
    From the document object, you obtain the SummaryInfo object, which has a LastSavedBy property. E.g.
    Code:
    (vl-load-com)
    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ;Get the current drawing
    (setq si (vla-get-SummaryInfo doc)) ;Get the summary info object
    (princ "Last saved by: ")
    (princ (vla-get-LastSavedBy si)) ;Prints login name of user last saved
    I don't know how you'll get the creator, unless he's saved his name manually (File --> Drawing Properties), or through a custom lisp, to something like the Author property of the SummaryInfo object.
    Thanks.

    Instead of the owner's name, can I find the PC's ID, or the autocad license' code ,which the drawing was created/saved on?
    If it is possible, how to do with a LISP?

    Thanks again.

  7. #7
    Certified AUGI Addict rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Houston
    Posts
    7,519

    Default Re: How to get the number of opening drawing and its name in Lisp ?

    Quote Originally Posted by BoKirra View Post
    Thanks.

    Instead of the owner's name, can I find the PC's ID, or the autocad license' code ,which the drawing was created/saved on?
    If it is possible, how to do with a LISP?

    Thanks again.
    You can probably find the PC ID and/or the AutoCAD S/N, but only the current version - not the version that last saved the drawing - since this information is not stored in the DWG file.

  8. #8
    AUGI Addict
    Join Date
    2006-04
    Location
    (0,0,+|Z|)
    Posts
    1,119

    Default Re: How to get the number of opening drawing and its name in Lisp ?

    Quote Originally Posted by rkmcswain View Post
    You can probably find the PC ID and/or the AutoCAD S/N, but only the current version - not the version that last saved the drawing - since this information is not stored in the DWG file.
    How to find the PC ID, and auotcad S/N with a routine?

    Thanks.

  9. #9
    Certified AUGI Addict rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Houston
    Posts
    7,519

    Default Re: How to get the number of opening drawing and its name in Lisp ?

    Code:
    
    ;;; Hostname
    (getenv "COMPUTERNAME")
    
    ;;; AutoCAD S/N
    (getvar "_PKSER")
    

  10. #10
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    6,836

    Default Re: How to get the number of opening drawing and its name in Lisp ?

    Depending on your security permissions, you might be able to find out the owner of the file using the file system object. Of course, this is dependent on your IT not changing file permissions recently as well.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Page 1 of 2 12 LastLast

Similar Threads

  1. Auto number attribute lisp fix
    By Zuke in forum AutoLISP
    Replies: 71
    Last Post: 2011-10-11, 04:26 PM
  2. Room area and Number from polyline lisp
    By mike.ford in forum AutoLISP
    Replies: 3
    Last Post: 2010-06-30, 11:42 AM
  3. a lisp to know if a number is PRIME or NOT
    By devitg.89838 in forum AutoLISP
    Replies: 2
    Last Post: 2009-08-02, 02:07 PM
  4. Replies: 2
    Last Post: 2008-07-09, 12:17 AM
  5. Help with number placing LISP routine
    By Heather_W in forum AutoLISP
    Replies: 10
    Last Post: 2007-02-15, 01:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •