+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Forum Newbie
    Using
    AutoCAD 2010
    Join Date
    Dec 2011
    Posts
    5

    Default Insert a block in multiple drawings using script

    Hi
    I'm trying to write a script which would enable me to redefine a block, save and close the drawing. I would like to run it on multiple drawings. I have managed to write a script which does redefine the block but it stops and either I get "Unit-scaling inserted database..." message or it starts a new command..... ("Command: 1.000000")

    I did not get the script to save the changes or close the drawings. Any help would me very much appreciated.

    Below you will find the script file

    Code:
    (command "._insert" "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0
    _units 1.00
    _basepoint 0,0
    _scale 1.0
    _rotate 0.0
    )
    qsave
     
    (princ)
    close
    Last edited by SLW210; 13th Dec 2011 at 02:26 pm.

  2. #2
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x86
    CPU:
    Pentium(R) Dual-Core CPU E5500 @ 2.80GHz
    RAM:
    4 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2011
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    9,979

    Default

    Please read the CODE POSTING GUIDELINES.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  3. #3
    Forum Newbie
    Using
    AutoCAD 2010
    Join Date
    Dec 2011
    Posts
    5

    Default

    apologies , I did wasn't aware of code posting guidelines. Please find below coding with the code tags

    Code:
    (command "._insert" "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0
    _units 1.00
    _basepoint 0,0
    _scale 1.0
    _rotate 0.0
    )
    qsave
    
    (princ)
    close
    thanks,
    Arek

  4. #4
    Luminous Being
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    5,007

    Default

    Your mixing lisp and script togther

    Code:
     
    insert U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg 
    0.0
    1.00
    0,0
    1.0
    0.0
    qsave
    close
    A man who never made mistakes never made anything

  5. #5
    Forum Newbie
    Using
    AutoCAD 2010
    Join Date
    Dec 2011
    Posts
    5

    Default

    Thanks Bigal,
    I modified your code a little however after I specify the rotation angle 0.0, I need to cancel modifing the attributes in the title block. How do I do it? At the moment the script is changing my attributes to "_.save", "_Y" etc.... Any help would be very much appreciated!

    Code:
    ._insert "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0
    1.00
    1.00
    0.0
    ;here I need to cancel revising the attributes within title block
    _.save
    _Y
    _.close

  6. #6
    Full Member
    Computer Details
    JGA's Computer Details
    Operating System:
    Win7
    Using
    AutoCAD 2014
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    59

    Default

    Create a script, test on one file. If it works, use autodesk scriptpro (search online for it) to apply it to a number of drawings

  7. #7
    Forum Newbie
    Using
    AutoCAD 2010
    Join Date
    Dec 2011
    Posts
    5

    Default

    I have managed to make the script working!! It's my first one, so I'm even more happy!

  8. #8
    Forum Newbie
    Using
    AutoCAD 2010
    Join Date
    Dec 2011
    Posts
    5

    Default

    Just thought will share this script which works. The empty lines are "enter" for the attributes to remain unchanged. And will use ScriptPro to apply it to multiple drawings.

    Code:
    ._insert "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0
    1.00
    1.00
    0.0
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    _.erase
    _L
    
    _.zoom
    _E
    _.qsave
    _.close
    _N

  9. #9
    Luminous Being
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    5,007

    Default

    Registered forum members do not see this ad.

    I was going to post often you need extra lines as if you pressed the enter button, the other way is to uses spaces as the same thing but can be on the same line makes the script a bit easier to read sometimes if its all 1 line.

    Try it with yours 2nd line would be next drawing.

    Code:
    open dwg1 ._insert "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0 1 1 0.0       etc
    open dwg2 ._insert "Drawing Sheet A1=U:/27979/Config/DWGSheets/test/Drawing Sheet A1.dwg" 0.0 1 1 0.0
    A man who never made mistakes never made anything

Similar Threads

  1. Lisp or Script - Procedure on Multiple Drawings?
    By ILoveMadoka in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 22nd Aug 2011, 03:43 am
  2. Use Lisp to search & insert multiple drawings as blocks.
    By rob150588 in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 22nd Feb 2011, 12:28 pm
  3. Multiple Block Insert By Selection
    By WCCSAM in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 5th Aug 2009, 12:15 pm
  4. need help with a script - OPEN, INSERT BLOCK, SAVE
    By walmartjanitor in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 20th Sep 2008, 08:34 am
  5. Insert block multiple times
    By Dipali in forum AutoCAD Drawing Management & Output
    Replies: 5
    Last Post: 11th Apr 2008, 11:15 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