+ Reply to Thread
Page 3 of 3 FirstFirst 1 2 3
Results 21 to 28 of 28
  1. #21
    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

    Registered forum members do not see this ad.

    Quote Originally Posted by Agent 31 View Post
    Thank you all for the help. I will be away most of the day working on some other diagrams for work. I just wanted to let you know I have received everything. I have a quick question though, am I supposed to put that other code into Lee's? Just curious.
    My code will (should) function correctly without any modification - the error about which Se7en commented had been fixed in my post #15
    Lee Mac Programming

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

    Just another Swamper

  2. #22
    Junior Member Agent 31's Avatar
    Computer Details
    Agent 31's Computer Details
    Operating System:
    Windows VISTA
    Using
    AutoCAD 2010
    Join Date
    Jun 2010
    Posts
    12

    Default

    Quote Originally Posted by Grant View Post
    I am assuming the block is not in a Autocad search path so it cannot find it.

    I think all you need to do is to write block out the block to an Autocad search path (or make your own in options, Files tab, search file support path). This will make autocad search your drawing and when it does not find it there it should look in the search paths for Autocad and the ones you can create.

    Hope this helps
    Well the problem with that, the block IS in the support path. I keep the all of my LISPs for work and their associated files (dwgs, dcls, etc...) under the support path. Thats why I can not figure this out.

    I am about to try Lee's code though, I will probably respond soon to let everyone know how it works out. Wish me luck!

  3. #23
    Junior Member Agent 31's Avatar
    Computer Details
    Agent 31's Computer Details
    Operating System:
    Windows VISTA
    Using
    AutoCAD 2010
    Join Date
    Jun 2010
    Posts
    12

    Default

    Lee,

    Thank you greatly for the routine you sent out to me. I was quite impressed that you rewrote the entire thing and extremely quickly. I trust you have much experience on this. On that note, do you know of a good reference book I could pick up? I found a few on Amazon, but am unsure what would be good.

    Anyone who sees this, feel free to chime in or point me to an appropriate thread, =)

    I have posted below, however, the code I worked with on Lee's. I ran it as is, editing the block definitions, different variations, etc... Below are the common errors I keep receiving no matter what I do. Any ideas?

    xblock Block terminal references itself

    ; error: misplaced dot on input
    The part of the code in question;

    Code:
    (defun LM:ForceBlockDefinition ( block / path ext base )
      ;; © Lee Mac 2010
      (setq path  (C:\\Program Files\\AutoCAD 2010\\Support)
            ext   (.dwg)
            base  (terminal))

  4. #24
    Senior Member
    Using
    not specified
    Join Date
    May 2006
    Posts
    294

    Default

    Well from what i can see you are using Lee's function wrong; The function accepts an argument.

    Sorry, i cant help more then that; I dont really understand Lee's code.


    EDIT: Should be more specific.
    this is wrong.
    Code:
    (setq path  (C:\\Program Files\\AutoCAD 2010\\Support)
            ext   (.dwg)
            base  (terminal))
    Use like this:
    (LM:ForceBlockDefinition "C:\\Program Files\\AutoCAD 2010\\Support\\terminal.dwg")

  5. #25
    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

    Agent, are you using the code I attached? If so there should be no need for modification.

    As for the earlier subfunction I posted, as Se7en correctly points out, the function is not to be modified, but rather takes arguments (as any other LISP function would).

    I have engineered the function to accept any form of the block as an input, i.e. "block" or "block.dwg" or "C:\\Folder\\block.dwg".

    May I ask why you would want to modify the subfunction - does my attached code error?
    Lee Mac Programming

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

    Just another Swamper

  6. #26
    Junior Member Agent 31's Avatar
    Computer Details
    Agent 31's Computer Details
    Operating System:
    Windows VISTA
    Using
    AutoCAD 2010
    Join Date
    Jun 2010
    Posts
    12

    Default

    When I use Lee's code without any modification, this is what comes up.
    Code:
    Command: (load"xblock") LM:FORCEBLOCKDEFINITION
    Command: xblock Block terminal references itself
    *Invalid*
    When I use Se7en's modification, this is the error I come up with.
    Code:
    Command: (load"xblock") ; error: syntax error
    Command: xblock Block terminal references itself
    *Invalid*
    And in case you are wondering, yes I changed the name to fit the macros I already have set in place, though I did leave all identifications that links it to Lee.

    Any ideas?

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

    Hi Agent,

    This is not due to the code, but because of your block.

    This usually happens if you have a block saved within a drawing of the same name, i.e. you have a block called 'terminal' in a drawing called 'terminal.dwg' and then you are trying to insert the drawing 'terminal.dwg' into another drawing, causing the error.

    The Solution: check for the above case, if so - explode & purge the block definition out of the 'terminal.dwg' and retry the code.
    Lee Mac Programming

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

    Just another Swamper

  8. #28
    Super Member asos2000's Avatar
    Computer Details
    asos2000's Computer Details
    Operating System:
    WinXP
    Using
    AutoCAD 2007
    Join Date
    Sep 2007
    Location
    Cairo Egypt
    Posts
    573

    Default

    Registered forum members do not see this ad.

    This version no need for cad file
    this subroutine create a layer called Point and block called Terminal

    Add this line at first of lisp
    Code:
    (defun C:XBLOCK ( / )    ;WHAT DOES "(/ souk)" MEAN?
     (TerminalBlock)
     (setup)
     (getboxinput)


    And add this subroutine at end of lisp
    Code:
    (defun TerminalBlock ()
      (if (not (tblsearch "LAYER" "Point"))
        (progn
          (entmake (list
                   '(0 . "LAYER")
                   '(100 . "AcDbSymbolTableRecord")
                   '(100 . "AcDbLayerTableRecord")
                   (cons 2  "Point") ;layer name
                   (cons 62  2) ;layer color
                   '(70 . 0) ; on, unlocked, thawed
                 ))))
      (if (not (tblsearch "BLOCK" "Point"))
        (progn
          (entmake '((0 . "BLOCK") (100 . "AcDbEntity") (67 . 0) (8 . "0")
       (100 . "AcDbBlockReference") (2 . "Terminal") (10 0.0 0.0 0.0) (70 . 0)))
          (entmake '((0 . "HATCH") (100 . "AcDbEntity") (8 . "POINT")
       (62 . 2) (100 . "AcDbHatch")
       (10 0.0 0.0 0.0) (210 0.0 0.0 1.0) (2 . "ANSI31")
       (70 . 0) (71 . 0) (91 . 1) (92 . 7) (72 . 1) (73 . 1)
       (93 . 2) (10 -0.06285 0.0 0.0) (42 . 1.0) (10 0.06285 0.0 0.0)
       (42 . 1.0) (97 . 0) (75 . 0) (76 . 1) (52 . 0.0) (41 . 0.03125)
       (77 . 0) (78 . 1) (53 . 0.785398163397448) (43 . 0.0) (44 . 0.0)
       (45 . -0.00276213586401) (46 . 0.00276213586401) (79 . 0)
       (47 . 0.000519971032496) (98 . 1)
       (10 0.001298342685957 0.002354605870909 0.0)))
          (entmake '((0 . "CIRCLE") (100 . "AcDbEntity")
       (67 . 0) (8 . "POINT") (62 . 2) (100 . "AcDbCircle") (10 0.0 0.0 0.0) (40 . 0.06285)))
          (entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0")))
          )
        )  
      (princ)
    )
    Sorry for my English.

Similar Threads

  1. Insert dynamic block from file with multiple dynamic blocks
    By BUrBaKy in forum AutoCAD Drawing Management & Output
    Replies: 17
    Last Post: 14th Nov 2012, 11:38 pm
  2. A lisp to insert all blocks in the file
    By asos2000 in forum AutoLISP, Visual LISP & DCL
    Replies: 9
    Last Post: 18th Dec 2009, 05:21 am
  3. insert blocks from a drawing containing multiple blocks
    By comcu in forum AutoCAD Drawing Management & Output
    Replies: 12
    Last Post: 16th Feb 2009, 02:35 am
  4. Insert Blocks are small!
    By craigp in forum AutoCAD Drawing Management & Output
    Replies: 5
    Last Post: 13th Dec 2006, 08:56 pm
  5. Insert Blocks in VB
    By Fedge in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 9th Jun 2006, 05:05 am

Tags for this Thread

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