visability staes and block names

not sure if this is the right section of the forum, but hopefully it is.

I have a door part model that is inserted into my drawings as a block.
The model has three parametric visibility states for black, white and graphic.
The model is saved with white being the on state.
When inserted into my drawing as a block, I run the company pick parts and insert into quote routine and it's inserted as 'door in white' into the database.
If I change the state to be black, then run the same routine; the part is then calling itself *u260
it also has two flip states and changing those also results in the name change.
What I need it to do, is change its name to being 'door in black' when in the black state; or 'door in G' when in the graphic state.
Or at least stay as 'door in white' for all states, the *u name is no good for what I need to do.
Is this possible

Comments

  • If your using a dynamic block it will always be made an individually named block you can not stop that.

    You can get what every door is currently set to by making a selection set of "*U*" blocks and looking at their "Effectivename", this is still very fast using lisp. Next step is say a table of all doors, with a sorted and count of each door style.

    Yes code is readily available for this task.

  • You can’t change the name. but you can map it

    Each state of a dynamic block, may be saved to an anonymous block. As Alan mentions, you can use EffectiveName via API, to retrieve the original block name, I’m sure you can do this with data extraction as well

    import traceback
    from pyrx import Db, Ed, Ge, Ap, Rx, Gs
    
    @Ap.Command()
    def doit():
        try:
            db = Db.curDb()
            ms = db.modelSpace()
            refs = [Db.BlockReference(id) for id in ms.objectIds([Db.BlockReference.desc()])]
            btrs = [Db.BlockTableRecord(ref.blockTableRecord()) for ref in refs]
            names = [(btr.getName(), btr.effectiveName()) for btr in btrs]
            print(names)
        except Exception as err:
            traceback.print_exception(err)