.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Lock Block Attributes?

5 REPLIES 5
Reply
Message 1 of 6
vasantpadhiyar71
2330 Views, 5 Replies

How to Lock Block Attributes?

Hi Experts,

 

I am filling values of Attributtes into title block using Code. I want no User can go and Update the value of Attribute.

 

Is it Possible to Lock the Attributes of the Title Block?

 

Thanks,

Vasant PADHIYAR
5 REPLIES 5
Message 2 of 6
Artvegas
in reply to: vasantpadhiyar71

Have you tried setting the attribute mode to "Constant"? There is a checkbox in the Attribute Definition dialog box for this. I haven't tried it but it should set the attribute so that your user won't be prompted to edit the value. Note that this will only be set once for each drawing so it may not work for you if you want to assign different values for each block reference. Refer to the AttributeDefinition.Constant property in the ObjectARX docs (arxmgd.chm) for further details on this. You can set this in code as well. Of course this won't stop a user from editing the attribute definition itself, but if a user wants to start messing with your block definitions then they can't complain if it breaks your setup.
Message 3 of 6
Artvegas
in reply to: Artvegas

You could also create seperate block definitions for eack block reference if you need different values for different block references - i.e. name them something like TitleBlock01, TitleBlock02, etc.
Message 4 of 6
vasantpadhiyar71
in reply to: Artvegas

Actually I want to Set the value of these Attributes using Command "TITLEBLOCK".

 

My Actual Requirement is as:

The Command "EATTEDIT" should not work if fired from AutoCAD by any User.

I want automation everywhere. No manual thing should be Possible.

 

Thanks,

Vasant PADHIYAR
Message 5 of 6

Hi,

 

>> My Actual Requirement is as:

>> The Command "EATTEDIT" should not work

Then redefine the EATTEDIT-command or check the CommandWillStart event.

 

But what will you do if the user modifies the attributes in the property-window then?

So I think concentrating to just this command may not be the solution.

 

Maybe the most simple solution: what about setting the layer of your titleblocks to "locked" and just watch this layer is not unlocked by the user?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 6 of 6
Artvegas
in reply to: Alfred.NESWADBA

Ok if you'd like to get fancy how about you create an anonymous block!

 

Anonymous blocks aren't available for editing by the user (i.e. BEDIT won't list it). For this you create your BlockTableRecord in code as per usual, except you must set its name to "*U" before you add it to the BlockTable.

 

I'm not sure whether attributes will work with this, but it doesn't matter because with anonymouse blocks you won't need them. Instead you can programatically add any text you like to your anonymous block definition and the user won't be able to modify it at all.

 

You could be even more fancy by nesting an anonymous block inside of your normal title block.

 

You could even go further and add a hard reference pointer to the block reference from an XRecord so that it can't be erased.

 

Sounds simple heh? :~)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost