Linking attribute to parameter and action value

Linking attribute to parameter and action value

Anonymous
Not applicable
1,574 Views
1 Reply
Message 1 of 2

Linking attribute to parameter and action value

Anonymous
Not applicable

 Is there a way I can link attribute to rotation action? I want to be able to change angle value of a rotational action through vba. If not can I change the rotation action/parameter through vba, and how?

0 Likes
Accepted solutions (1)
1,575 Views
1 Reply
Reply (1)
Message 2 of 2

norman.yuan
Mentor
Mentor
Accepted solution

Attribute (AcadAttributeReference) can be rotated manually, or through code (VBA code included, of course). When you say "... link to action...", what does the action mean? A dynamic block's action? If that is what you mean, then you must have a dynamic block, that defines a rotation action, which applies to attribute(s), so that user can manually change the rotation parameter value to rotate the attribute(s). If this is your situation, then yes, you can also use code to change the rotation parameter to change the attribute rotation, as if user does it manually. The code would be like (psedo code)

 

Dim blk As AcadBlockReference

Set blk = ...Identify the block reference (selecting, or loop through Model/PaperSpace...)

 

Dim pro As AcadDynamicBlockReferenceProperty

Dim props As Varaint

Dim i As Inteter

 

Set props=blk.GetDynamicBlockProperties()

For i=0 To Ubound(props)

  Set prop = props(i)

  If UCase(prop.PropertyName) = "[MY ROTATION PARAMETER NAME]" Then

    prop.Value=3.1415926/2     '  rotate 90 degree, assume the original rotation is 0

    Exit For

  End If

Next

 

Again, attributes, like other AutoCAD entities, can be rotated by code (i.e. you do not have to mate the block dynamic).

 

Norman Yuan

Drive CAD With Code

EESignature