Dynamic Block using visibility and attribute test

Dynamic Block using visibility and attribute test

themattman007
Participant Participant
1,646 Views
19 Replies
Message 1 of 20

Dynamic Block using visibility and attribute test

themattman007
Participant
Participant

Is there any way to create a dynamic block which incorporates both attribute text and visibility states?

I'm looking for a block that when you click the blue arrow to choose between the different visibility states, only the attribute text on that visibility layer is active. All of the other attribute text on all of the other visibility layers are inactive, or turned off. 

 

When I run ATTEXT to extract the data associated with this block, only the data on the visible layer gets extracted. None of the attribute text on any of the other visibility layers gets extracted because it is basically not there. 

 

I created a block with different attribute text on each visibility layer, but when I click the blue arrow to choose a different visibility layer, the only attribute text that ever appears is the text on the first visibility layer.

0 Likes
1,647 Views
19 Replies
Replies (19)
Message 2 of 20

steven-g
Mentor
Mentor
Try the attached block. If you still have problems then post a copy of your block, there may be something that needs doing differently. Do you actually need to extract all the attributes, if so that would need rethinking?
0 Likes
Message 3 of 20

steven-g
Mentor
Mentor
Sorry I can't attach a file, the site won't work correctly with my work's computer. I'll try later, if someone else doesn't make any offers. (I can't even view the forums Autodesk is blocked after 7am)
0 Likes
Message 4 of 20

pendean
Community Legend
Community Legend

You come to the website forum right here, not reply by email, click on REPLY button under the message you are responding to then click on this button to attach a DWG file 

 

Capture.PNG

0 Likes
Message 5 of 20

Libbya
Mentor
Mentor

@steven-g wrote:
(I can't even view the forums Autodesk is blocked after 7am)

That's kind of funny.  Maybe 'they' don't want anyone 'wasting' their time on the forums finding answers to work problems...  

0 Likes
Message 6 of 20

Libbya
Mentor
Mentor

@themattman007 wrote:

Is there any way to create a dynamic block which incorporates both attribute text and visibility states?

I'm looking for a block that when you click the blue arrow to choose between the different visibility states, only the attribute text on that visibility layer is active. All of the other attribute text on all of the other visibility layers are inactive, or turned off. 

 

When I run ATTEXT to extract the data associated with this block, only the data on the visible layer gets extracted. None of the attribute text on any of the other visibility layers gets extracted because it is basically not there. 

 

I created a block with different attribute text on each visibility layer, but when I click the blue arrow to choose a different visibility layer, the only attribute text that ever appears is the text on the first visibility layer.


How about scaling the attributes you do not want 'visible' so that they are 1/1000 in size?  Use a lookup rather than visibility parameter to control the scale action.  

0 Likes
Message 7 of 20

steven-g
Mentor
Mentor

When I say I can't, I meant it is not working, I choose the file and post, but any attachements are ignored, it is something to do with how our system at work blocks social media, and after 7am most content is blocked 

blank.JPG

Anyway hopefully it works as normal from home,

see the attached file

0 Likes
Message 8 of 20

themattman007
Participant
Participant

Thanks you for your response.

The "NowYouSeeMe" block you created works great because there are no two Tags with the same name. If you look at the CB.dwg block I attached, it has three selections to choose from.  

If you choose 1A, and then double click the block, you will see only one attribute.

If you choose 1.5A you get the same result.

But if you choose 2A and double click the block you will see 6 different attribute tags.

If you take the block into block editor and look at the attributes in the upper right section of the block you will see there is 5 different attributes on each visibility state. As you switch between the three different visibility states you will notice that the Default setting for the tags vary from one visibility state to the next. 

Unfortunately, when you exit block editor and double click on the block, the only time you see all 6 of the different attributes is on the 2A visibility state. 

 

Is there any way to have more then one attribute with the same tag ID in a block without one tag overriding the defaut text of another attribute with the same tag ID?

 

Thanks,

Matt

0 Likes
Message 9 of 20

Libbya
Mentor
Mentor

Every attribute MUST have a unique tag.

 

All attributes within a dynamic block should have locked=yes.  If you want to be able to move then, add a point/move.

0 Likes
Message 10 of 20

steven-g
Mentor
Mentor

It's odd behaviour for Autocad, it will allow you to create attributes with the same tag name, without showing an error message, but it will not work. It is one of those things that you just have to know, you cannot succesfully repeat tag names in a single block, there are no workarounds, no tips and tricks, it just won't work, what you can do is use a single attribute and have that visible in multiple visibility states (or only in some), you also can't have different values for the same attribute in different visibility states.

So unfortunately you will have to rethink what needs to happen in your block and either use a single attribute over different states or use multiple attributes with similar though unique names.

So the question is, why did you need the same tag names ? and how to make a working block without the need for too many different attributes.

0 Likes
Message 11 of 20

gleesondsgndraft
Explorer
Explorer

I have solved this one by having a control layer in my visability states with all of the atributes visible & in the locked state.

As I build the different Visabilitystates I want to see each of the atributes can be made invisable etc.

 

 

0 Likes
Message 12 of 20

e_dickerN7U7M
Explorer
Explorer

This seems to possibly answer a problem i have been having.
I have a blocks with multiple attributes and routine for reading the default value, which creates a text file of the default values.
All my attributes have the tag PTNO, but their default values vary - CLAD CORNER-LEG-BLACK or CLAD CORNER-LEG-BLUE etc.
All this works fine, if I need to read all the values from multiple parts; but I am trying to reduce the number of parts
Once i learned how to use visibility states, I thought I could make one part that functions for many.
However, if I try to make one part with multiple attributes with different visibility states; it does not do as I expected.
I was trying to get it to only read only the value of the visible attribute, but it always reads and displays them all in the text file, even if their visibility was off.
This is no good.
if i read you correctly it never will work?

0 Likes
Message 13 of 20

h_s_walker
Mentor
Mentor

@e_dickerN7U7M 

Only use one attribute. You can make it visible in multiple visibility states. See the attached drawing for an example

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 14 of 20

e_dickerN7U7M
Explorer
Explorer

Hi Thanks for responding.

I think i need to add abit more info

The attached is my model, in which there are several attributes, each with a visability state.

These are in this model as blocked attributes, one for each colour variation.

When i insert this model into a main plan, it was my hope to be able to use it to represent all the different colours; rather than have seperate models or each.

The stumbling block, is with my bom lisp routine; that looks at all the part blocks in a drawing. This calculates the amount of each, based on the text string of the blocked atributes.

The trouble is, it reads all the blocked atributes in my new part; even those not visible and that is no good.

I need it to only read the one that has an 'on'  visbability state.

0 Likes
Message 15 of 20

h_s_walker
Mentor
Mentor

Your drawing does not have a proper block in it. As I said just use one attribute in all visibility states and you can change what it says depending on the visibility state. Look at the block properties table in the drawing I posted

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 16 of 20

e_dickerN7U7M
Explorer
Explorer

Hi Howard

Thanks for your help on this.

Part of the problem, is i am stuck trying to make this work under the exact same systems/constraints as all our existing parts.

 

The clad corner text is a blocked attribute though! 

if you explode it you get the actual att, Tag = PTNO- Default name  = CLAD CORNER-LEG-BLACK 1

This has to be in this format, as the lisp that reads the inserted blocks looks for that.

The 'Colour is' attribute, is the only one i want to be able to edit when the part is inserted as block. That would be for adding the actual paint code.

I fear i am going to have to give up on this idea though, its proving to be more troublesome than i expected.

I am now convinced the issue is in the lisp that reds the parts, rather than the part itself.

 

0 Likes
Message 17 of 20

h_s_walker
Mentor
Mentor

Try the attached block

 

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 18 of 20

e_dickerN7U7M
Explorer
Explorer

Alas same result, more than just the one is counted by the routine..

As i say, i think its the routine that is the issue now.

When the extract info routine was writen, there werer no visability states.

Therefore i now believe that the ruotine needs to have some form of code inserted; to make it take notice of visability states.

I am not much of a coder and what does what in that lisp just isnt obvious to me.

0 Likes
Message 19 of 20

h_s_walker
Mentor
Mentor

@e_dickerN7U7M The lisp forums are in the link below

Visual LISP, AutoLISP, General Customization Forum Autodesk

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 20 of 20

e_dickerN7U7M
Explorer
Explorer

thanks again for your help.

0 Likes