todouble22 Posted December 31, 2009 Posted December 31, 2009 Hi all, I wrote a script to put an "X" in a checkbox on our title blocks for either preliminary or approved for construction and by using the dtext command I am having a problem with it working. the script goes to the specified spot but then it goes to user input on the autocad screen not the command line to enter the text in the textbox. I know I can just insert it as a block but I was wondering if it works this way and i'm missing something? (very plausible).. Dbroada got any ideas?? Quote
Lee Mac Posted December 31, 2009 Posted December 31, 2009 I would write a LISP, and call the LISP from the script (unless you are using LT of course). DText (and Attdef) are terrible for running from the command line, as the prompt order changes, depending on the drawing. I would use either entmake(x) or vla-AddText. Quote
todouble22 Posted December 31, 2009 Author Posted December 31, 2009 I would write a LISP, and call the LISP from the script (unless you are using LT of course). DText (and Attdef) are terrible for running from the command line, as the prompt order changes, depending on the drawing. I would use either entmake(x) or vla-AddText. Thanks LeeMac, Im gonna go that route I finished the attdef one that I was working on using script, lisp and batch. I'm still working on a better lisp like we spoke of in the other thread. its a work in progress. learning as i go. Quote
Lee Mac Posted December 31, 2009 Posted December 31, 2009 Here's a helper: (defun Make_Text (pt str hgt) (entmakex (list (cons 0 "TEXT") (cons 10 pt) (cons 40 hgt) (cons 1 str)))) Call it like this: (Make_Text <Point> <String> <TextHeight>) You can add more DXF codes to the list to get more control over layer/style/rotation etc. But as it stands, it will just use the defaults. Lee Quote
todouble22 Posted December 31, 2009 Author Posted December 31, 2009 Here's a helper: (defun Make_Text (pt str hgt) (entmakex (list (cons 0 "TEXT") (cons 10 pt) (cons 40 hgt) (cons 1 str)))) Call it like this: (Make_Text <Point> <String> <TextHeight>) You can add more DXF codes to the list to get more control over layer/style/rotation etc. But as it stands, it will just use the defaults. Lee The numbers are group codes correct? I looked through the dxf reference in help and 0 was for object type. hopefully I'm not completely wrong here haha . where do I find a complete listing if im correct of the group codes? Quote
Lee Mac Posted December 31, 2009 Posted December 31, 2009 http://autodesk.com/techpubs/autocad/acad2000/dxf/ Quote
dbroada Posted December 31, 2009 Posted December 31, 2009 Hi all, I wrote a script to put an "X" in a checkbox on our title blocks for either preliminary or approved for construction and by using the dtext command I am having a problem with it working. the script goes to the specified spot but then it goes to user input on the autocad screen not the command line to enter the text in the textbox. I know I can just insert it as a block but I was wondering if it works this way and i'm missing something? (very plausible).. Dbroada got any ideas?? me? I'm on holiday! At least I was until 4:30 this afternoon. You can turn off the dialogue boxes with a (I think) CMDDIA = 0 and then provide the text in your script. I think this will work with DTEXT. I won't have autocad in front of me 'till Monday so if it doesn't stick with Lee's stuff. Quote
dbroada Posted December 31, 2009 Posted December 31, 2009 DText (and Attdef) are terrible for running from the command line, as the prompt order changes, depending on the drawing. I can't say I've ever noticed that. I have a lot of scripts already written and am not aware of any with DTEXT falling over - maybe I've been lucky. Quote
todouble22 Posted December 31, 2009 Author Posted December 31, 2009 me? I'm on holiday! At least I was until 4:30 this afternoon. You can turn off the dialogue boxes with a (I think) CMDDIA = 0 and then provide the text in your script. I think this will work with DTEXT. I won't have autocad in front of me 'till Monday so if it doesn't stick with Lee's stuff. isnt it suppose to be a long new years weekend? Quote
dbroada Posted December 31, 2009 Posted December 31, 2009 isnt it suppose to be a long new years weekend?I don't go back to work until Monday but the last few days have been out of my annual allowance, tomorrow is a "Bank Holiday" (public holiday in American?) and then its the weekend - so MY holiday ended at 4:30 today, I'm now just off work. oh, and don't forget to turn CMDDIA = 1 back on afterwards (just to add something non chat) Quote
Lee Mac Posted December 31, 2009 Posted December 31, 2009 I've seen it quite a few times, normally if various textstyles are used - sometimes the user is prompted for height/style, sometimes not. But in any case, entmake is far quicker anyway. Quote
todouble22 Posted December 31, 2009 Author Posted December 31, 2009 I don't go back to work until Monday but the last few days have been out of my annual allowance, tomorrow is a "Bank Holiday" (public holiday in American?) and then its the weekend - so MY holiday ended at 4:30 today, I'm now just off work. oh, and don't forget to turn CMDDIA = 1 back on afterwards (just to add something non chat) thanx for the reminder for the cmddia, i made sure i added that in. Quote
dbroada Posted December 31, 2009 Posted December 31, 2009 I've seen it quite a few times, normally if various textstyles are used - sometimes the user is prompted for height/style, sometimes not. But in any case, entmake is far quicker anyway. you may think that, I ccouldn't possibly comment! possibly if the current text style has a height set it won't be asked for where if it is set to 0 it is always asked for. I don't remember seeing it but I consider setting a text height to be a sackable offence. Quote
Recommended Posts
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.