Author Topic: Block Help  (Read 2250 times)

0 Members and 1 Guest are viewing this topic.

HarleyHetz

  • Guest
Block Help
« on: April 03, 2008, 07:55:10 AM »
Maybe someone can help me figure out how to do what I'm trying to do here...or at least tell me that it is not possible!!
First of all, I'm using 06 Electrical. I am trying to create a block that is a bunch of circles with two pieces of text in them. The first piece of text would be a sheet number, the next piece of text would be the line number. Now, here is the tricky part. I want to set it up so that when I insert this block, it will prompt me for "Sheet Number" one time and then fill all of those in. The line numbers would be static and never change, so I can just set them up as I am "drawing" the block. Essentially, they will wind up being like 1 - 50 or so.
The closest I've been able to come so far is to create an attribute whose "tag" is set to "SH", prompt is set to "Enter sheet number" and value is set to "01". Then I copy this attribute and paste it into the 50 circles over the line numbers. The problem is that it asks me 50 freakin' times to enter my sheet number!!
I know that there must be an easier way... :ugly:

Chuck Gabriel

  • Guest
Re: Block Help
« Reply #1 on: April 03, 2008, 08:06:36 AM »
If you set the ATTREQ system variable to zero before you insert the block, you won't be prompted for the attribute values.  Then you can use -ATTEDIT (answer No and Yes to the first two prompts respectively) to change all of the attributes with the SH tag.  Note:  I've assumed that the attributes have a default value.  If they don't that changes things a little.

Of course you could automate the whole thing, but I don't know if that's your bag.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Block Help
« Reply #2 on: April 03, 2008, 08:30:28 AM »
If you post your code I'm sure someone could help you automate the process.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

HarleyHetz

  • Guest
Re: Block Help
« Reply #3 on: April 03, 2008, 08:48:12 AM »
Actually, I have never done any automating, but I wouldn't mind trying it. I have done tons of VB, the only concern I would have there would be could everyone else use my "automation" when they insert the block as well?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Block Help
« Reply #4 on: April 03, 2008, 09:01:38 AM »
Perhaps if you posted a sample DWG of your block?
That is if the "set the ATTREQ system variable to zero" didn't fix your problem.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

HarleyHetz

  • Guest
Re: Block Help
« Reply #5 on: April 03, 2008, 09:07:34 AM »
I'll post it up here once I finish it up. I've yet to complete but a small sample of what I wanted that I have been testing with. Shouldn't be long!!
Thanks for the help BTW!!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Block Help
« Reply #6 on: April 03, 2008, 09:07:42 AM »
When you say TEXT to actually mean Attribute in the block.
Define the "Line Number" as a Constant Attribute or just Plain Text and the "Sheet Number" as an Attribute.

Perhaps this will help.
When you use the command to insert a block with attributes you must address the following system variables.
Code: [Select]
;|
ATTDIA
Controls whether the -INSERT command uses a dialog box for attribute value entry. See "INSERT Command Line."
0        Issues prompts on the command line
1        Uses a dialog box

ATTMODE
Controls display of attributes.
0        Off: Makes all attributes invisible
1        Normal: Retains current visibility of each attribute: visible attributes are
                displayed; invisible attributes are not
2        On: Makes all attributes visible

ATTREQ
Determines whether the INSERT command uses default attribute settings during insertion of blocks.
0        Assumes the defaults for the values of all attributes
1        Turns on prompts or dialog box for attribute values, as specified by ATTDIA

TEXTEVAL
Controls the method of evaluation of text strings.
0        All responses to prompts for text strings and attribute values are taken literally
1        Text starting with an opening parenthesis [ ( ] or an exclamation mark (!) is
            evaluated as an AutoLISP expression, as for nontextual input
|;

(setq sysattdia (getvar "ATTDIA"))
(setq sysattreq (getvar "ATTREQ"))
(setq systxteva (getvar "TEXTEVAL"))
(setvar "ATTDIA" 0)
(setvar "ATTREQ" 0)
(setvar "TEXTEVAL" 0)


<do your lisp>


(setvar "ATTDIA"   sysattdia)
(setvar "ATTREQ"   sysattreq)
(setvar "TEXTEVAL" systxteva)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CottageCGirl

  • Guest
Re: Block Help
« Reply #7 on: April 03, 2008, 11:19:08 AM »
I am not sure if I fully get your task, but it sounds similar to a problem I had a while back....I have up to 50 rooms of funiture, each pice is it's own block w/ attributes, one of which is "room #"  so, I did not want to edit each one at a time (up to 800 blocks) but I did not want everyone on the plan to be the same.....here is the solution.. Continued thanks to CAB.....use it all the time!  I just made a button and it asks what I want the attribute to say...then I just select anyitem I want to change.
Hope it helps?


(defun c:roomnumber ()

(setq rm# (getstring t "\nEnter new room number: ")
        attname "ROOM"  ; uppercase only
        bc 0) ; block counter

  (prompt "\n***  Select blocks to change room number.  ***")
  ;;  get only blocks with attributes
  (if (and rm#
           (not (eq rm# ""))
           (setq ss (ssget (list '(0 . "INSERT") '(66 . 1))))
      )
    (progn
      (setq count -1)
      (while (< (setq count (1+ count)) (sslength ss))
        (setq blk   (vlax-ename->vla-object (ssname ss count))
              atts2 (vlax-invoke blk "getattributes")
        )
        (foreach att2 atts2
          (if (= attname (vla-get-tagstring att2))
            (progn
              (vla-put-textstring att2 rm#)
              (vla-update att2)
              (vla-update blk)
              (setq bc (1+ bc))
            )
          )
        )
      )
      (prompt (strcat "\n-=< " (itoa bc) " blocked updated  >=-"))
    ) ; progn
    (prompt "\n---  No blocks Updated  ---")
  ) ; endif
  (princ)
) ; defun
(prompt "\nRoom Number Update Loaded, Enter Rm#Update to run.")
(princ)
)

Kate M

  • Guest
Re: Block Help
« Reply #8 on: April 03, 2008, 01:11:09 PM »
Sounds like a job for a FIELD, doesn't it? I bet there's one that would suit.

Guest

  • Guest
Re: Block Help
« Reply #9 on: April 03, 2008, 01:18:00 PM »
Sounds like a job for a FIELD, doesn't it? I bet there's one that would suit.

Could the SHEET NUMBER be the layout tab name?  In which case you could reference the CTAB sysvar in a field.

HarleyHetz

  • Guest
Re: Block Help
« Reply #10 on: April 04, 2008, 06:30:21 AM »
Yea, uhm, I think all of this has gone a bit over my head!  :lmao:
You guys are an invaluable resource, but I'm not sure that the problem is worth all of this attention.
I was hoping that there was some setting somewhere, or some copy/paste type of solution. I can just as easily leave the sheet number out of the "Line Number".
To clarify the EXACT problem, (prolly should have done this first I guess) the "Line Number" circle thingy is simply a tool that will be used by a technician when he wants to follow a wire from one sheet to the next. There will be instructions at the end of a wire that tell where it is continued in the drawing. Usually (but not always) on a different sheet, and at some line. Now, the sheet number is in the title block, so putting it in the Line Number is really kind of redundant anyway, but it is the way the legacy (drawn by hand) drawings are done and I was trying to kind of duplicate that as a courtesy.
Not worth a bunch of code that I don't understand and would take a week to perfect, I am in a production type environment so time is of the essence. I have the only set of drawings in the whole wide world sitting on my desk, so if anything goes wrong with the machine, I have to give them up so it can be fixed.
That leads me to my next question...but I'll start a new post for that one after I do a search to see if it's been covered before...
Thanks to all who racked thier brains over the problem, I sincerely appreciate the effort. And someday soon, I'm going to get into some of this code so that the next time I have a similar issue and you guys throw some code my way, I'll understand better what it is that it does. For now, I must press on with the drawing!!
Thanks again guys & gals!!!!!

CottageCGirl

  • Guest
Re: Block Help
« Reply #11 on: April 04, 2008, 08:47:18 AM »
Yea, uhm, I think all of this has gone a bit over my head!  :lmao:

Harley...I am not a code person either, when you get some free time....(I am assuming you don't already know how) learn how to take existing code and place it in a folder that lauches every time you open cad, and make a button for it...I can't write code, only edit a little but now that I cant do this, I can take existing code and make it work for me.  It seems daunting..but baby steps (thats how I am doing it)

Have a great day!

HarleyHetz

  • Guest
Re: Block Help
« Reply #12 on: April 04, 2008, 10:26:37 AM »
Thanks CG, the time thing is going to be the deciding factor there...
After I've been here awhile, I'll make some time to do it...for now, I'm the new guy and need to get as much done as quickly as possible...at least until they figger out how great I am!!  :kewl: :lol:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Block Help
« Reply #13 on: April 04, 2008, 10:49:31 AM »
If you post a DWG with your block in it we can offer a rapid solution to your problem.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Block Help
« Reply #14 on: April 04, 2008, 10:59:14 AM »
My best guess is that you need to make the attributes PRESET. That way you will not be prompted each time
the block is inserted. After they are inserted you may then update all those blocks on the sheet at one time with the Sheet #.

If you have already made & are using the block, use expresstools BATTMAN to modify the attributes to PRESET.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.