+ Reply to Thread
Results 1 to 9 of 9

Thread: Script problem

  1. #1
    Senior Member
    Computer Details
    feargt's Computer Details
    Operating System:
    win 7
    Using
    Civil 3D 2012
    Join Date
    Sep 2008
    Location
    Austria
    Posts
    321

    Default Script problem

    Registered forum members do not see this ad.

    Hi,

    I want to replace a block in a set of drawings with a script file. When I tried entering the commands on the command line with _insert autocad asked if i wanted to redefine the block. But when I use the script below to script is crashing because where Iam expecting the question whether I want to redefine the block autocad is actually looking for an insertion point. Is there something I am missing? Any ideas welcome.

    thanks

    Code:
     
    _-insert
    D:\Personal\CAD\Research\titleblocktext_att.dwg
    _yes
    0,0
    _erase
    _L
    attsync
    n
    plankopf_att_neu
    _qsave

  2. #2
    Super Member Patrick Hughes's Avatar
    Computer Details
    Patrick Hughes's Computer Details
    Operating System:
    Win 2000
    Graphics:
    Quadro fx500
    Monitor:
    2x 1920x1080
    Discipline
    Mechanical
    Patrick Hughes's Discipline Details
    Occupation
    Self unemployed - Machine Design
    Discipline
    Mechanical
    Details
    Machine Design
    Using
    AutoCAD pre 2000
    Join Date
    May 2008
    Location
    Rockford, Illinois
    Posts
    588

    Default

    Look into including the "EXPERT" sysvar into your script before issue the command in question. Something like:

    expert
    2
    ...
    ...
    expert
    0



    You will also want to reset it afterwards.
    www.cadtempo.com
    Time tracking for AutoCAD, Inventor, Revit and other CAD programs

  3. #3
    Full Member
    Using
    AutoCAD 2007
    Join Date
    May 2008
    Posts
    54

    Default

    How about, renaming the existing block before inserting the new block?
    ...
    peace out

  4. #4
    Luminous Being dbroada's Avatar
    Computer Details
    dbroada's Computer Details
    Operating System:
    XP Pro
    Computer:
    Dell
    CPU:
    Intel Xeon 2.13GHz
    RAM:
    2GB
    Graphics:
    NVIDA Quadro FX 580
    Monitor:
    DELL 23" & SAMSUNG 21"
    Discipline
    Electro/Mech
    dbroada's Discipline Details
    Occupation
    Design Engineer
    Discipline
    Electro/Mech
    Using
    Electrical 2013
    Join Date
    Nov 2005
    Location
    Sussex, UK
    Posts
    5,070

    Default

    that is certainly how I do it. Are you sure the "new" block resides in the drawing already? It sounds like its not there so doesn't need redefining.
    "That's it. It's one thing for a ghost to terrorize my children, but quite another for him to play my Theremin." Homer Simpson

    Dave

  5. #5
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    6,015

    Default

    Quote Originally Posted by feargt View Post
    Hi,

    I want to replace a block in a set of drawings with a script file. When I tried entering the commands on the command line with _insert autocad asked if i wanted to redefine the block. But when I use the script below to script is crashing because where Iam expecting the question whether I want to redefine the block autocad is actually looking for an insertion point. Is there something I am missing? Any ideas welcome.

    thanks

    Code:
     
    _-insert
    D:\Personal\CAD\Research\titleblocktext_att.dwg
    _yes
    0,0
    _erase
    _L
    attsync
    n
    plankopf_att_neu
    _qsave

    when i type "insert" you will not get the same prompts as when you (command "insert"). the command way will prompt you for xyz coords, etc.

    you could just write it to only execute if it finds the block in your drawing:
    Code:
    (if (tblsearch "block" "titleblocktext_att")
     ;**insert your code here
    )

  6. #6
    Senior Member
    Computer Details
    feargt's Computer Details
    Operating System:
    win 7
    Using
    Civil 3D 2012
    Join Date
    Sep 2008
    Location
    Austria
    Posts
    321

    Default

    So thank you for all the assistance. There was no one answer that did the trick. Was more of a combination of things. Below is the script that worked for me

    Code:
     
    attdia
    0
    attreq
    0
    expert
    2
    _insert
    plankopf_att_neu=D:\Personal\CAD\Research\plankopf_att_neu.dwg
    0,0
    1
    1
    _erase
    _L
    attsync
    n
    plankopf_att_neu
    expert
    0
    _qsave
    Thanks again for taking interest in this one. Always appreciated.

  7. #7
    Luminous Being dbroada's Avatar
    Computer Details
    dbroada's Computer Details
    Operating System:
    XP Pro
    Computer:
    Dell
    CPU:
    Intel Xeon 2.13GHz
    RAM:
    2GB
    Graphics:
    NVIDA Quadro FX 580
    Monitor:
    DELL 23" & SAMSUNG 21"
    Discipline
    Electro/Mech
    dbroada's Discipline Details
    Occupation
    Design Engineer
    Discipline
    Electro/Mech
    Using
    Electrical 2013
    Join Date
    Nov 2005
    Location
    Sussex, UK
    Posts
    5,070

    Default

    I forgot about the = method. With that you are telling AutoCAD that the block must be redefined so I don't think you need to fiddle with the expert setting.
    "That's it. It's one thing for a ghost to terrorize my children, but quite another for him to play my Theremin." Homer Simpson

    Dave

  8. #8
    Senior Member
    Computer Details
    feargt's Computer Details
    Operating System:
    win 7
    Using
    Civil 3D 2012
    Join Date
    Sep 2008
    Location
    Austria
    Posts
    321

    Default

    Just wanted to be on the safe side

  9. #9
    Luminous Being dbroada's Avatar
    Computer Details
    dbroada's Computer Details
    Operating System:
    XP Pro
    Computer:
    Dell
    CPU:
    Intel Xeon 2.13GHz
    RAM:
    2GB
    Graphics:
    NVIDA Quadro FX 580
    Monitor:
    DELL 23" & SAMSUNG 21"
    Discipline
    Electro/Mech
    dbroada's Discipline Details
    Occupation
    Design Engineer
    Discipline
    Electro/Mech
    Using
    Electrical 2013
    Join Date
    Nov 2005
    Location
    Sussex, UK
    Posts
    5,070

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by feargt View Post
    Just wanted to be on the safe side





    .
    "That's it. It's one thing for a ghost to terrorize my children, but quite another for him to play my Theremin." Homer Simpson

    Dave

Similar Threads

  1. PDF Script
    By SeaRR85 in forum AutoCAD General
    Replies: 3
    Last Post: 3rd Dec 2008, 02:30 pm
  2. Script in cad
    By Insener07 in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 9th Jun 2008, 02:36 pm
  3. Script problem
    By Rooster in forum AutoCAD General
    Replies: 8
    Last Post: 2nd May 2008, 06:39 pm
  4. Sub script and Super script Text
    By edwin in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 1st Aug 2007, 08:07 pm
  5. funny problem about command "section" in a script
    By phymilton in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 18th Jan 2006, 03:36 am

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