Atribute data extraction based on visability state in blocks

Hi i have a question, that much searching hasnt really answered.

We have parts that we insert into our drawings, each one has atributes defining what it is.

They are inserted as blocks, but the base drawing isnt blocked; it is just drawn items and the atribute.

We have lisp routine ,that when run on a drawing; reads all the attributes in the various blocks. This produces a text file, containing the atribute name; how many there are and the total weight of each amount.

I am trying to streamline some of the blocks, as they could be done with just one part and visability states.

However, i cant think of a way to make the lisp routine read/count only the visible atributes, it always reads all of them; whether visible or not.

Is it possible to add a funtion to the lisp, to say only read the data based on visability?

Do i have to do something differnt with the base model of the part, before it is inserted as a block?

Any info would be much apreciated.

Comments

  • There must be some form of extended data that links the attributes to a visibility state. Pulling a dynamic block apart is very complex, maybe post a dwg with a block setup with different visibility states.

    A dump of a dynamic block shows

    ; HasAttributes (RO) = -1
    ; HasExtensionDictionary (RO) = -1

  • The attched is the part i created, which has multiple visability states. it currently has blocked atributes for the white and cyan states.

    This is inserted into our working drawings as a block.

    Also attched the lisp routine that does the counting, unfortunately its a two part proccess; as this routine then calls a second to give the weights, so cant be run on its own.

    All files need to be in a cad searchpath.

    Type extract at the commandline, hit enter, double click the extract template.txt, then save the file it creates somewhere. it will then ask you to select the entities, do so by crossing window and right click.

    Right click two more times and it wall ask you to select the weight template.

    Double click it and save the file to the same place as the previous one. Hit enter and this will bring up the comanline as per the attched screen shot; showing the counted strings. (no need to save it to file)

    As you can see it shows both, which is the only bit that is an issue; as i need to find a way for the count to only be the visible one.

  • Are these dynamic blocks? if not

    AcDbAttribute::isInvisible is bit 1 of DXF group code 70

  • Like, Its_Alive the blocks don't appear to be dynamic ?

  • Thanks for getting back to me on this, no the blocks currently have no dynamic quialitys and for this one no need for any more than visability states.

    I might need to add dynamic or paramtric states to future ones that i want to streamline; but one step at time.

    i will attempt to incorporate Its_Alives code snipet and see where i get (not an expert on coding)