CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.093.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator. New AutoCAD 2026 commands and variables.

CAD tip CAD tip # 11404:

Question

CAD 
 %  platform  category 
A
If you want to perform an operation with attribute values directly inside a given block, you can define this operation either in the block definition or later in the block reference (insertion of the block instance).

You have e.g. a block with 3 attributes and you want the third attribute to contain a text string concatenated (merged) from the current values of the first two attributes. See an example in ConcatAtt.dwg - Block #15079.

To setup the requested operation in the block definition, set the third attribute's value from the fields referencing the objects (values) of the definitions of both source attributes (in Field: Object>Attribute Definition>Value and check Display value for block reference). To evaluate the attribute operation/fields after you insert the block or change its values, the block has to be dynamic - i.e. it must contain any dynamic action, e.g. a position, a visibility state, etc. plus you have to invoke this dynamic action at least once after you insert the block into your DWG drawing - e.g. drag the position node, change the visibility state. See the example, the block Concat (left).

For an operation defined in the block reference, you just use the attribute editor to set a field referencing the same object (the inserted reference) and the values of its first and second attributes. Such definition is evaluated automatically - i.e. e.g. on a regen. See the example, the block ConcatRef (right).

So after you change the value of the source attributes, perform the necessary update action and the block will reflect the changed value in the target attribute.

You can use a similar approach to link/mirror two attributes together - have two different attributes carrying the same value in a single block.


To calculate values through the block definition you can also use a simplified method independent of dynamic blocks, with simple automatic updates on block insertion and on any subsequent DWG Open or Regen operations.

An example - the block TestHiLo (see) with the controlling master attribute "Val0" and with two dependent attributes "Hi" and "Lo". These will be automatically assigned values always incremented and decremented by one off the value set to the master attribute. Just insert the textual form of the calculation expression to their preset (default) values - here specifically:

%<\AcExpr (%<\AcObjProp.16.2 Object(?BlockRefId,1).Val0>%+1)>%

and:

%<\AcExpr (%<\AcObjProp.16.2 Object(?BlockRefId,1).Val0>%-1)>%

ACAD
100% *CAD
27.4.2017    15726×  
Share the tip:
Digg it! Del.icio.us Facebook Twitter Google bookmark Technorati StumbleUpon
applies to: AutoCAD ·

See also:
Tip 14537:Automation of AutoCAD drawing texts using fields.
Tip 14526:How to export geometry from AutoCAD DWGs to JSON files and import it back?
Tip 14446:Undocumented options in AutoCAD FIELDs - hyperlinks, hexadecimal or binary format
Tip 14402:What is the difference between the BLOCKREPLACE, BREPLACE, REPLACEBLOCK, RIBLOCK and BLKREDEF commands?
Tip 14361:Extended ATTOUT/ATTIN for block attribute management in Excel (also for LT).


Back    All CAD Tips



Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD: 
OS: 
Categ: 
Text:
 FAQ
  



Featuring:
Increase your productivity with our set of BIM add-on functions for Autodesk Revit
CADstudio Revit Tools More info


Please use these tips at your own risk.
ARKANCE is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist