Jump to content

Script problem


feargt

Recommended Posts

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

 

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 
_-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:

(if (tblsearch "block" "titleblocktext_att")
;**insert your code here
)

Link to comment
Share on other sites

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

 

 
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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...