Author Topic: Changing properties of blocks & attributes  (Read 1776 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
Changing properties of blocks & attributes
« on: June 14, 2007, 04:38:11 PM »
Hello,
I have been doing a search for some info about this topic, but haven't really found any.
I'm wondering if someone could guide me through a process of how I can change the properties of a block with attributes.
My environment:
I have a drawing at 1/8" scale.  The dim style is called STRUCT.
I have a text style called ARCHITXT, scaled at 9".
I have several blocks; details cuts for example, that are created on an "S-Marks" layer and set to the appropriate dim scale, complete with a wipeout mask created on "S-Mask".  All blocked together of course.
Notes are created on an "S-Notes" layer.

So I have another window in my paperspace tab for a detail blowup of a particular area of the drawing.  the window is scaled to 1/4"
I need to show some things in this window that I don't want shown in the main window which is scaled at 1/8" an vice versa.
So I have created another text style named ARCHITXT_48.  Another Dim style named STRUCT_48.  Another layer(s) called S-Marks_48, S-Notes_48, etc.

When I drop my detail cuts in, they are created on the "S-Marks" layer as I explained earlier.  I need a routine that I can run to change the detail cut to the "S-Marks_48" layer, the attribute text of the cut to "S-Marks_48" with the color set to 6, AND the style of the text to ARCHITXT_48.

The pic attached is what my detail cut looks like.  The pic on the left is almost complete in it's running routine, requesting the use of the mask.  The pic on the right shows the cut in front of an object.  It is selected so you can see what all is included in this block.

Thank you for your help.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Changing properties of blocks & attributes
« Reply #1 on: June 14, 2007, 04:53:07 PM »
How much of the routine have you tried?  This shouldn't be that hard, as you will need 'ssget' (to select more than one at a time), then you will use 'entnext' to step through the block object to get the attributes, and 'entmod' with 'subst' to change the layer for the attribute and block, and to change the text style and color of the attributes. Of course other functions are needed, but these are the main ones, besides a 'while' loop or 'repeat' function.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

sena

  • Guest
Re: Changing properties of blocks & attributes
« Reply #2 on: November 05, 2007, 11:27:33 PM »
(DEFUN CHATTRIB (OLDATT NEWATT)
  (IF (AND (PRINC "\nSelect Block with attribute :")
           (SETQ SS (SSGET '((0 . "INSERT") (66 . 1))))) (PROGN
   (SETQ I -1)
   (REPEAT (SSLENGTH SS)
    (SETQ ENT (ENTGET (SSNAME SS (SETQ I (1+ I))))
          ENT1 ENT)
    (WHILE (= (CDR (ASSOC 0 (SETQ ENT1 (ENTGET (ENTNEXT (CDR (ASSOC -1 ENT1))))))) "ATTRIB")
     (IF (= (CDR (ASSOC 1 ENT1)) OLDATT) (PROGN
   (SETQ ENT1 (SUBST (CONS 1 NEWATT) (ASSOC 1 ENT1) ENT1))
   (ENTMOD ENT1)
   (ENTMOD ENT)
  ))
    )
   )
  ))
  (PRINC)
)
(DEFUN C:A () ;exam
  (IF (AND (SETQ OATT (GETSTRING "\nOld Attrib:"))
        (SETQ NATT (GETSTRING "\nNew Attrib:")))
   (CHATTRIB OATT NATT)
  )
  (PRINC)
)