+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16
  1. #1
    Full Member sakinen's Avatar
    Computer Details
    sakinen's Computer Details
    Operating System:
    Windows 7
    Using
    AutoCAD 2011
    Join Date
    Oct 2007
    Location
    Belgrade, Serbia
    Posts
    68

    Idea Block name same as drawing name

    Registered forum members do not see this ad.

    Im building a lisp that is going to automaticaly make a block with the same name as the file thats in. With what function i can do that?

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,743

    Default

    Quote Originally Posted by sakinen View Post
    With what function i can do that?
    Do what? Make the block? Get the Drawing filename? What part do you need help with?
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  3. #3
    Full Member sakinen's Avatar
    Computer Details
    sakinen's Computer Details
    Operating System:
    Windows 7
    Using
    AutoCAD 2011
    Join Date
    Oct 2007
    Location
    Belgrade, Serbia
    Posts
    68

    Default

    Sorry, my question was a little bit clumsy. I need to Get the Drawing filename.

  4. #4
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,743

    Default

    Two ways:

    Code:
    (vla-get-Name
      (vla-get-ActiveDocument
        (vlax-get-acad-object)
      )
    )
    Code:
    (getvar 'DWGNAME)
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  5. #5
    Super Member David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    1,926

    Default

    That should lead to an error:

    'BLOCK is self referencing'

    -David
    R12 (Dos) - A2K

  6. #6
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,112

    Default

    Will this have the same effect?

    Code:
     
    (command "-wblock" (vla-get-fullname 
                          (vla-get-activedocument 
                           (vlax-get-acad-object))) "Y" "")

  7. #7
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,007

    Default

    Quote Originally Posted by David Bethel View Post
    That should lead to an error:

    'BLOCK is self referencing'

    -David
    I’m afraid that there is no restriction for having a block with the same name as the drawing that contains it - just tested in 2008 and 2010.

    Regards,
    Mircea

  8. #8
    Super Member David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    1,926

    Default

    Make a drawing with a block with the same name defined.

    Try inserting that dwg file into a new dwg file. You should get an error/ warning. -David
    R12 (Dos) - A2K

  9. #9
    Senior Member
    Using
    Architecture 2011
    Join Date
    Dec 2010
    Posts
    175

    Default

    While this is true, not everybody inserts blocks in this way.

    Perhaps if Sakinen could say what exactly he's trying to achieve (i.e. why he needs the block's name to match the drawing) we may be able to help some more.

    dJE

  10. #10
    Super Member David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    1,926

    Default

    Registered forum members do not see this ad.

    In 2000 it errors out


    Command: -insert
    Enter block name or [?]: testb
    Block testb references itself
    *Invalid*

    So in general, it is a bad practice, in real world scenarios, it is an unacceptable format. -David
    Attached Files
    R12 (Dos) - A2K

Similar Threads

  1. insert-block from other drawing
    By flopo in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 15th Nov 2010, 05:26 pm
  2. Need to offset BLOCK in drawing
    By cadamrao in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 26th Apr 2010, 02:43 pm
  3. Change block to different block in drawing
    By Kathy in forum AutoCAD Drawing Management & Output
    Replies: 8
    Last Post: 24th May 2006, 12:34 am
  4. Block name but picking the block in a drawing?
    By muck in forum AutoLISP, Visual LISP & DCL
    Replies: 9
    Last Post: 18th May 2006, 01:36 pm
  5. Drawing Standards Block
    By gcp310 in forum Tutorials & Tips'n'Tricks
    Replies: 2
    Last Post: 14th Mar 2005, 10:34 pm

Bookmarks

Posting Permissions

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