Jump to content

Block attribute in insert command


monkey7

Recommended Posts

I'm currently working on a script to (semi) automise drawing rail constructions. This is going fine, except for one very odd issue. I'm quite a beginner, so please bear with me.

 

I have to insert a block with an attribute. Since I want to avoid using ent* commands, I wrote the script using (command "INSERT" blockname coordinates "" "" "" attributevalue). At home this worked, yet at work the lisp engine treats the 'attributevalue' as a new command. Is there an AutoCAD variable or something else that determines the definition of attributes in the insert command?

 

Both AutoCAD versions are 2010 vanilla, except for some heavy third party scripts and programs for work, which I can't and don't want to disable.

Link to comment
Share on other sites

there are several things that can throw a script. Is it definitely the same block being used at home and work with exactly the same number of attributes? Is the "uniform scale" set the same on both blocks?

 

I normally have ATTREQ = 0 so that my blocks arre inserted without attributes and I have to correct them later. Although not ideal if you know the attribute value it does make the script easier :)

Link to comment
Share on other sites

ATTREQ was the one. It's default at 0, setting it at 1 enabled the script to set the attribute.

 

Will have to set ATTREQ to 1 just before inserting and set it back to 0 just after insertion. Don't want a dialog popping up during normal usage.

 

The attribute defines a unique number assigned to every power line masts, so filling them in later was not really an option. It would require the user to find out which one it was, possible point of confusion when you have a lot of masts. The block does vary depending on the drawing, different clients require different drawing styles.

 

Thanks a lot for the replies.

Link to comment
Share on other sites

ATTREQ turns off the asking for attribute values, I would have thought ATTDIA (shame I forgot about it) which is the command line version would have been what you wanted. Never mind, if it works all is good. :)

Link to comment
Share on other sites

Doesn't seem to work with ATTDIA 1 and ATTREQ 0. Anyway, it does work with ATTREQ 1, so like you said it's all good :)

 

If you don't mind me moving onto the next issue, I have encountered the following:

Whenever I want to get string input I am only able to get a single word. As soon as the spacebar is pressed the script moves on and I end up with a one word comment being inserted. I tried using (getstring "") and pausing the script at input moments. Is there a workaround allowing multiple words to be used as input?

Link to comment
Share on other sites

you are moving into the LISP area that is not a strong point of mine (I prefer VBA or scripts) however try

(getstring T "Input")

the should allow spaces

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